/* ==========================================================================
   临床试验数据收集系统 · 管理后台样式
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #d97706;
  --warning-soft: #fffbeb;

  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --line: #e5e7eb;
  --line-2: #eef1f5;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --sidebar: #101a2e;
  --sidebar-2: #1a2740;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 4px 16px rgba(15, 23, 42, .08);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, .18);
  --sidebar-w: 224px;
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

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

/* ============================ 登录页 ============================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 15% 10%, #1e3a8a 0%, transparent 55%),
    radial-gradient(900px 500px at 85% 90%, #0f766e 0%, transparent 55%),
    #0b1220;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 18px;
  padding: 40px 36px 32px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 700;
  margin-bottom: 18px;
}

.login-card h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: .3px; }
.login-card .sub { color: var(--text-3); font-size: 13px; margin: 0 0 26px; }

.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-2); margin-bottom: 7px;
}
.field .req { color: var(--danger); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.input::placeholder, .textarea::placeholder { color: #b6c0cd; }
.textarea { resize: vertical; min-height: 78px; line-height: 1.6; }
.input[disabled], .select[disabled], .textarea[disabled] {
  background: #f8fafc; color: var(--text-3); cursor: not-allowed;
}

.login-tip {
  margin-top: 18px; padding: 10px 12px;
  background: var(--primary-soft); border-radius: var(--radius-sm);
  font-size: 12.5px; color: #1e40af; line-height: 1.7;
}

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

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
}

.brand {
  padding: 20px 18px 18px;
  display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand-mark {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.brand-text { min-width: 0; }
.brand-text b { display: block; color: #fff; font-size: 14px; letter-spacing: .2px; }
.brand-text span { display: block; font-size: 11px; color: #64748b; letter-spacing: .5px; }

.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-title {
  font-size: 11px; color: #475569; letter-spacing: 1px;
  padding: 8px 10px 6px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  color: #cbd5e1;
  margin-bottom: 3px;
  transition: background .15s, color .15s;
  user-select: none;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, .95), rgba(37, 99, 235, .72));
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-item .badge-count {
  margin-left: auto; font-size: 11px; background: rgba(255,255,255,.14);
  padding: 1px 7px; border-radius: 9px;
}

.sidebar-foot {
  padding: 12px 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.user-box {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px; background: rgba(255, 255, 255, .05);
}
.user-avatar {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
}
.user-meta { min-width: 0; flex: 1; }
.user-meta b { display: block; color: #fff; font-size: 13px; }
.user-meta span { display: block; font-size: 11px; color: #64748b; }
.foot-actions { display: flex; gap: 6px; margin-top: 9px; }
.foot-actions button {
  flex: 1; padding: 7px 0; font-size: 12px; cursor: pointer;
  background: rgba(255, 255, 255, .07); color: #cbd5e1;
  border: none; border-radius: 7px; transition: background .15s, color .15s;
}
.foot-actions button:hover { background: rgba(255, 255, 255, .15); color: #fff; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h2 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar .crumb { font-size: 12.5px; color: var(--text-3); }
.topbar .spacer { flex: 1; }

.content { padding: 22px 24px 40px; flex: 1; }

/* ============================ 卡片 ============================ */
.card {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--text-3); }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 18px; }
.card-body.flush { padding: 0; }

/* ============================ 统计卡 ============================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
.stat {
  background: #fff; border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; right: -18px; top: -18px;
  width: 74px; height: 74px; border-radius: 50%; background: var(--primary-soft);
  opacity: .75;
}
.stat .label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat .value {
  font-size: 27px; font-weight: 700; letter-spacing: -.5px;
  margin-top: 6px; font-variant-numeric: tabular-nums;
  position: relative; z-index: 1;
}
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.stat .foot { font-size: 12px; color: var(--text-3); margin-top: 6px; position: relative; z-index: 1; }
.stat .delta-up { color: var(--success); font-weight: 600; }
.stat .delta-down { color: var(--danger); font-weight: 600; }
.stat .delta-flat { color: var(--text-3); }

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  background: #fff; color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  transition: all .15s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); border-color: #fca5a5; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn svg { width: 15px; height: 15px; }

/* ============================ 表格 ============================ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--text-2);
  padding: 11px 14px; background: #fafbfc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap; font-size: 12.5px;
}
table.tbl td {
  padding: 12px 14px; border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: #fafcff; }
table.tbl .num { font-variant-numeric: tabular-nums; }
table.tbl .nowrap { white-space: nowrap; }
.cell-actions { display: flex; gap: 5px; justify-content: flex-end; }
.cell-actions .btn { padding: 4px 9px; font-size: 12.5px; }

.thumb-strip { display: flex; gap: 4px; align-items: center; }
.thumb-strip img {
  width: 34px; height: 34px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--line); cursor: pointer;
  background: #f1f5f9;
}
.thumb-strip .more { font-size: 12px; color: var(--text-3); }

/* ============================ 徽章 ============================ */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: 12px;
  background: #f1f5f9; color: var(--text-2); white-space: nowrap;
}
.tag-blue { background: var(--primary-soft); color: #1d4ed8; }
.tag-green { background: var(--success-soft); color: #15803d; }
.tag-red { background: var(--danger-soft); color: #b91c1c; }
.tag-amber { background: var(--warning-soft); color: #b45309; }
.tag-gray { background: #f1f5f9; color: #64748b; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================ 筛选栏 ============================ */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
}
.filters .f { display: flex; flex-direction: column; gap: 5px; }
.filters .f label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.filters .f .input, .filters .f .select { min-width: 150px; padding: 7px 11px; font-size: 13px; }
.filters .f.grow { flex: 1; min-width: 180px; }
.filters .f.grow .input { width: 100%; }
.filters .actions { display: flex; gap: 8px; padding-bottom: 1px; }

/* ============================ 分页 ============================ */
.pager {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-top: 1px solid var(--line-2);
  font-size: 13px; color: var(--text-2); flex-wrap: wrap;
}
.pager .spacer { flex: 1; }
.pager .pages { display: flex; gap: 5px; }
.pager .pg {
  min-width: 32px; height: 32px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; border-radius: 7px;
  cursor: pointer; font-size: 13px; color: var(--text-2);
}
.pager .pg:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager .pg.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager .pg:disabled { opacity: .45; cursor: not-allowed; }
.pager .pg.dots { border: none; background: transparent; cursor: default; }

/* ============================ 模态框 ============================ */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
  animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985) } to { opacity: 1; transform: none } }

.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal.wide { max-width: 860px; }
.modal.xwide { max-width: 1040px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 10px;
}
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-head .spacer { flex: 1; }
.modal-head .x {
  border: none; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--text-3); padding: 0 4px;
}
.modal-head .x:hover { color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--line-2);
  display: flex; gap: 10px; justify-content: flex-end;
}
.modal-foot .spacer { flex: 1; }

/* ============================ 表单网格 ============================ */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.hint { font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.6; }
.err-text { color: var(--danger); font-size: 12.5px; margin-top: 5px; }

/* 注意：.field label 的 display:block 优先级更高，这里必须提高选择器权重 */
.switch,
.field label.switch,
.field-item-body label.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.switch input { display: none; }
.switch .track {
  width: 38px; height: 21px; border-radius: 20px; background: #cbd5e1;
  position: relative; transition: background .18s; flex: 0 0 38px;
}
.switch .track::after {
  content: ''; position: absolute; top: 2.5px; left: 2.5px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch span.txt { font-size: 13px; color: var(--text-2); white-space: nowrap; }

/* ============================ 字段设计器 ============================ */
.field-list { display: flex; flex-direction: column; gap: 10px; }
.field-item {
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  overflow: hidden; transition: border-color .15s;
}
.field-item.locked { background: #fbfdff; border-color: #dbeafe; }
.field-item.dragging { opacity: .5; }
.field-item-head {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; background: #fafbfc; border-bottom: 1px solid var(--line-2);
}
.field-item.locked .field-item-head { background: #eff6ff; }
.field-item-head .handle { color: var(--text-3); cursor: grab; font-size: 15px; user-select: none; }
.field-item-head .idx {
  width: 22px; height: 22px; border-radius: 6px; background: var(--primary);
  color: #fff; font-size: 11.5px; display: flex; align-items: center; justify-content: center;
  flex: 0 0 22px; font-variant-numeric: tabular-nums;
}
.field-item-head .nm { font-weight: 600; font-size: 13.5px; }
.field-item-head .spacer { flex: 1; }
.field-item-head .mini {
  border: none; background: transparent; cursor: pointer; color: var(--text-3);
  padding: 3px 5px; border-radius: 5px; font-size: 12.5px;
}
.field-item-head .mini:hover { background: #e2e8f0; color: var(--text); }
.field-item-head .mini.danger:hover { background: #fee2e2; color: var(--danger); }
.field-item-body { padding: 13px 14px; }

.opt-list { display: flex; flex-direction: column; gap: 7px; }
.opt-row { display: flex; gap: 7px; align-items: center; }
.opt-row .input { padding: 6px 10px; font-size: 13px; }

/* ============================ 空状态 ============================ */
.empty { padding: 54px 20px; text-align: center; color: var(--text-3); }
.empty .ico { font-size: 40px; opacity: .5; margin-bottom: 10px; }
.empty p { margin: 6px 0 14px; font-size: 13.5px; }

/* ============================ 图片查看 ============================ */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.img-grid .cell {
  position: relative; padding-top: 100%; border-radius: 9px; overflow: hidden;
  border: 1px solid var(--line); background: #f1f5f9; cursor: zoom-in;
}
.img-grid .cell img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.img-grid .cell .no {
  position: absolute; left: 6px; bottom: 6px; background: rgba(15,23,42,.7);
  color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 10px;
}
.lightbox {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .92); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 30px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.lightbox .close {
  position: absolute; top: 18px; right: 24px; color: #fff; font-size: 32px;
  background: none; border: none; cursor: pointer; line-height: 1;
}
.lightbox .nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.14); color: #fff; border: none; cursor: pointer;
  width: 46px; height: 46px; border-radius: 50%; font-size: 22px; line-height: 1;
}
.lightbox .nav.prev { left: 22px; }
.lightbox .nav.next { right: 22px; }
.lightbox .bar {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: #e2e8f0; font-size: 13px; background: rgba(15,23,42,.7);
  padding: 5px 14px; border-radius: 20px;
}

/* ============================ 详情表 ============================ */
.dl { display: grid; grid-template-columns: 116px 1fr; gap: 0; }
.dl dt {
  padding: 10px 12px; background: #fafbfc; color: var(--text-2);
  font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line-2);
}
.dl dd {
  padding: 10px 12px; margin: 0; border-bottom: 1px solid var(--line-2);
  word-break: break-word; font-size: 13.5px;
}
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: none; }

/* ============================ 二维码 ============================ */
.qr-box { text-align: center; padding: 8px 0 4px; }
.qr-canvas-wrap {
  display: inline-block; padding: 14px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px;
}
.qr-canvas-wrap img, .qr-canvas-wrap canvas, .qr-canvas-wrap table {
  display: block; border: 0; border-collapse: collapse;
}
.qr-canvas-wrap img { width: 208px; height: 208px; image-rendering: pixelated; }
.qr-link {
  margin-top: 14px; display: flex; gap: 8px; align-items: center;
}
.qr-link .input { font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.qr-meta { margin-top: 12px; font-size: 12.5px; color: var(--text-3); line-height: 1.8; }

/* ============================ 图表 ============================ */
.chart { width: 100%; }
.bars {
  display: flex; align-items: flex-end; gap: 4px; height: 168px;
  padding: 0 2px; border-bottom: 1px solid var(--line);
}
.bars .bar-col {
  flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; height: 100%; position: relative; min-width: 8px;
}
.bars .bar {
  width: 100%; max-width: 34px; border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  min-height: 3px; transition: height .3s ease, filter .15s;
  position: relative;
}
.bars .bar-col:hover .bar { filter: brightness(1.12); }
.bars .bar-col .tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; font-size: 11.5px; padding: 4px 9px;
  border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .15s; z-index: 5;
}
.bars .bar-col:hover .tip { opacity: 1; }
.bars .bar.zero { background: #e2e8f0; }
.axis { display: flex; gap: 4px; padding: 7px 2px 0; }
.axis span {
  flex: 1; text-align: center; font-size: 10.5px; color: var(--text-3);
  overflow: hidden; white-space: nowrap; min-width: 8px;
}

.rank { display: flex; flex-direction: column; gap: 11px; }
.rank-row { display: flex; align-items: center; gap: 11px; }
.rank-row .no {
  width: 21px; height: 21px; flex: 0 0 21px; border-radius: 6px;
  background: #f1f5f9; color: var(--text-2); font-size: 11.5px;
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.rank-row:nth-child(1) .no { background: #fef3c7; color: #b45309; }
.rank-row:nth-child(2) .no { background: #e2e8f0; color: #475569; }
.rank-row:nth-child(3) .no { background: #ffedd5; color: #c2410c; }
.rank-row .nm { flex: 1; min-width: 0; }
.rank-row .nm b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .nm span { font-size: 11.5px; color: var(--text-3); }
.rank-row .track {
  width: 110px; height: 7px; border-radius: 4px; background: #f1f5f9; overflow: hidden; flex: 0 0 110px;
}
.rank-row .track i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #60a5fa, #2563eb); }
.rank-row .cnt { width: 46px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; }

/* ============================ 提示条 ============================ */
.toast-wrap {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 9px; align-items: center;
  pointer-events: none;
}
.toast {
  background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 9px;
  font-size: 13.5px; box-shadow: var(--shadow-lg); animation: pop .18s ease;
  max-width: 80vw; display: flex; align-items: center; gap: 8px;
}
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }
.toast.warn { background: #b45309; }

/* ============================ 加载 ============================ */
.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
.spinner.dark { border-color: rgba(15,23,42,.15); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg) } }
.loading-block { padding: 50px; text-align: center; color: var(--text-3); }

/* ============================ 响应式 ============================ */
@media (max-width: 900px) {
  :root { --sidebar-w: 62px; }
  .brand-text, .nav-item span.lbl, .nav-title, .user-meta, .foot-actions { display: none; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .brand { justify-content: center; padding: 16px 8px; }
  .user-box { justify-content: center; padding: 6px; }
  .sidebar-foot { padding: 10px 8px; }
  .content { padding: 16px 14px 34px; }
  .topbar { padding: 0 14px; }
}

/* ============================ 观察台栅格 ============================ */
.dash-grid,
.dash-grid-2 {
  display: grid;
  gap: 16px;
  align-items: start;
}
.dash-grid   { grid-template-columns: 1.9fr 1fr; }
.dash-grid-2 { grid-template-columns: 1.6fr 1fr; }
.dash-grid > .card + .card,
.dash-grid-2 > .card + .card { margin-top: 0; }
.dash-grid > .card,
.dash-grid-2 > .card { min-width: 0; }

@media (max-width: 1180px) {
  .dash-grid,
  .dash-grid-2 { grid-template-columns: 1fr; }
}

/* 代码片段 */
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 5px;
  color: #0f172a;
}

/* 表格内滚动条留白 */
.table-wrap { scrollbar-width: thin; }

/* 打印二维码弹窗（方便直接打印渠道物料） */
@media print {
  body * { visibility: hidden; }
  .mask, .mask * { visibility: visible; }
  .mask { position: absolute; background: #fff; }
  .modal-head, .modal-foot { display: none !important; }
}
