:root {
  --primary: #2f6bff;
  --primary-dark: #1e54e0;
  --primary-light: #e3ecff;
  --accent: #6366f1;
  --accent-light: #e0e7ff;
  --sidebar-bg: #0a101f;
  --sidebar-hover: rgba(255, 255, 255, .07);
  --sidebar-active: linear-gradient(90deg, #2f6bff 0%, #7c5cf0 100%);
  --sidebar-text: #93a4bd;
  --topbar-bg: #ffffff;
  --content-bg: #f2f4f8;
  --card-border: #e5e9f2;
  --text: #0f172a;
  --text-muted: #64748b;
  --table-head-bg: #233355;
  --table-head-text: #eef2f8;
  --radius: 12px;
}

* { -webkit-font-smoothing: antialiased; }

body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--content-bg);
  color: var(--text);
  font-size: .925rem;
}

/* ============ 布局骨架 ============ */
.layout { display: flex; min-height: 100vh; }
.layout-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ============ 侧边栏 ============ */
.sidebar {
  width: 242px; flex-shrink: 0;
  background:
    radial-gradient(600px 300px at -10% -5%, rgba(59, 130, 246, .14), transparent 60%),
    linear-gradient(180deg, #0b1220 0%, #101a30 100%);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, .05);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 22px 20px 18px;
  color: #fff; font-size: 1.02rem; font-weight: 700; letter-spacing: .3px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.sidebar-brand .logo {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #2f6bff 0%, #6366f1 60%, #8b5cf6 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(124, 92, 240, .45);
}
.sidebar-brand .name-line { line-height: 1.15; }
.sidebar-brand .name-line small {
  display: block; font-size: .66rem; font-weight: 500;
  color: #64748b; letter-spacing: .6px; margin-top: 2px;
}
.sidebar-nav { flex: 1; padding: 14px 12px 10px; overflow-y: auto; }
.sidebar-nav .nav-section {
  font-size: .66rem; text-transform: uppercase; letter-spacing: 1.1px;
  color: #52627e; padding: 12px 10px 6px; font-weight: 600;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px;
  color: var(--sidebar-text); text-decoration: none;
  padding: 10px 12px; margin-bottom: 3px;
  border-radius: 9px; font-size: .9rem;
  transition: all .16s ease; position: relative;
  border: 1px solid transparent;
}
.sidebar-nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; transition: opacity .16s; }
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #dbe4f2; border-color: rgba(255, 255, 255, .05); }
.sidebar-nav a:hover svg { opacity: 1; }
.sidebar-nav a.active {
  background: var(--sidebar-active); color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px rgba(47, 107, 255, .32);
}
.sidebar-nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: #93c5fd;
}
.sidebar-nav a.active svg { opacity: 1; }
.sidebar-foot {
  padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .07);
  color: #52627e; font-size: .72rem; display: flex; align-items: center; justify-content: space-between;
}
.sidebar-foot .dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px #22c55e; display: inline-block; margin-right: 6px; }

/* ============ 顶栏 ============ */
.topbar {
  background: var(--topbar-bg);
  padding: 0 26px; min-height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid var(--card-border);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, #2f6bff, #6366f1 45%, transparent 90%);
  opacity: .55;
}
.topbar h1 { font-size: 1.08rem; font-weight: 800; margin: 0; letter-spacing: .2px; }
.topbar .crumb { font-size: .74rem; color: var(--text-muted); margin-top: 3px; }
.topbar-user { display: flex; align-items: center; gap: 13px; }
.topbar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #2f6bff, #8b5cf6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  box-shadow: 0 3px 10px rgba(124, 92, 240, .35);
}
.topbar-user .who { font-size: .82rem; line-height: 1.2; font-weight: 600; }
.topbar-user .who small { display: block; color: var(--text-muted); font-size: .72rem; font-weight: 400; }
.topbar-user .btn-outline-secondary {
  color: #64748b; border-color: #dbe1ea; border-radius: 8px;
}
.topbar-user .btn-outline-secondary:hover { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }

/* ============ 内容区 ============ */
.content { padding: 24px 26px 44px; flex: 1; }
.content h4 { font-size: 1.14rem; font-weight: 800; margin-bottom: 18px; letter-spacing: .2px; }

/* ============ 卡片 ============ */
.card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .04);
  background: #fff;
}
.card-header {
  background: #fff; border-bottom: 1px solid var(--card-border);
  border-radius: var(--radius) var(--radius) 0 0 !important;
  font-weight: 700; padding: 14px 20px; font-size: .92rem;
}
.card-body { padding: 20px; }

/* ============ 统计卡片 ============ */
.stat-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 15px;
  background: #fff; border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 18px 18px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 18px rgba(15, 23, 42, .05);
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, #2f6bff, #7c5cf0); opacity: .9;
}
.stat-card:has(.stat-icon.green)::before { background: linear-gradient(180deg, #10b981, #059669); }
.stat-card:has(.stat-icon.amber)::before { background: linear-gradient(180deg, #f59e0b, #d97706); }
.stat-card:has(.stat-icon.red)::before { background: linear-gradient(180deg, #ef4444, #dc2626); }
.stat-card:has(.stat-icon.indigo)::before { background: linear-gradient(180deg, #6366f1, #7c5cf0); }
.stat-card:has(.stat-icon.cyan)::before { background: linear-gradient(180deg, #06b6d4, #0891b2); }
.stat-card:has(.stat-icon.orange)::before { background: linear-gradient(180deg, #f97316, #ea580c); }
.stat-card:has(.stat-icon.purple)::before { background: linear-gradient(180deg, #8b5cf6, #7c3aed); }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(15, 23, 42, .1); }
.stat-icon {
  width: 50px; height: 50px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 23px; height: 23px; }
.stat-icon.blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1d4ed8; }
.stat-icon.green { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #15803d; }
.stat-icon.amber { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #b45309; }
.stat-icon.red { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #b91c1c; }
.stat-icon.indigo { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #4338ca; }
.stat-icon.cyan { background: linear-gradient(135deg, #cffafe, #a5f3fc); color: #0e7490; }
.stat-icon.orange { background: linear-gradient(135deg, #ffedd5, #fed7aa); color: #c2410c; }
.stat-icon.purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: #6d28d9; }
.stat-value {
  font-size: 1.5rem; font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums; letter-spacing: -.3px;
}
.stat-label { font-size: .77rem; color: var(--text-muted); margin-top: 3px; }

/* ============ 表格（强对比） ============ */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * {
  padding: .66rem .8rem;
  border-bottom-color: #eef1f6;
  color: var(--text);
}
.table thead th {
  background: linear-gradient(180deg, #2a3d68, var(--table-head-bg)) !important;
  color: var(--table-head-text) !important;
  font-weight: 600; font-size: .76rem;
  letter-spacing: .5px; text-transform: uppercase;
  border-bottom: none !important;
  white-space: nowrap;
}
.table thead th:first-child { border-radius: 0 0 0 10px; }
.table thead th:last-child { border-radius: 0 0 10px 0; }
.table tbody tr:nth-child(even) { background: #f8fafc; }
.table tbody tr:hover { background: #eff5ff; }
.table td { vertical-align: middle; }
.table code {
  background: #f1f5f9; color: #334155; border-radius: 5px;
  padding: 1px 7px; font-size: .8em;
}
.table .empty { text-align: center; color: var(--text-muted); padding: 34px 0 !important; }

/* ============ 徽章（柔和底 + 深字，对比清晰） ============ */
.badge.text-bg-primary { background: #e3ecff !important; color: #1e54e0 !important; }
.badge.text-bg-success { background: #dcfce7 !important; color: #166534 !important; }
.badge.text-bg-warning { background: #fef3c7 !important; color: #92400e !important; }
.badge.text-bg-danger { background: #fee2e2 !important; color: #991b1b !important; }
.badge.text-bg-secondary { background: #e8edf5 !important; color: #475569 !important; }
.badge.text-bg-light { background: #f8fafc !important; color: #475569 !important; }
.badge { font-weight: 600; font-size: .74rem; padding: .38em .78em; }

/* ============ 按钮 ============ */
.btn { border-radius: 8px; font-size: .85rem; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(47, 107, 255, .32);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), #5b4bd8); border-color: transparent; }
.btn-outline-primary { color: var(--primary); border-color: #93c5fd; }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-outline-secondary { color: #64748b; border-color: #dbe1ea; }
.btn-outline-secondary:hover { background: #f1f5f9; color: #334155; }

/* ============ 表单 ============ */
.form-control, .form-select {
  border-radius: 8px; border-color: #cdd6e2; font-size: .875rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 .22rem rgba(47, 107, 255, .13);
}
.form-label { font-weight: 600; font-size: .8rem; color: #334155; }
.form-text { font-size: .74rem; }

/* ============ 筛选条 ============ */
.filter-bar {
  background: #fff; border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 13px 18px; margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .03);
}

/* ============ 详情页定义列表 ============ */
.dl-card dt { color: var(--text-muted); font-weight: 600; font-size: .78rem; }
.dl-card dd { font-size: .9rem; margin-bottom: .6rem; word-break: break-all; }

/* ============ 登录页 ============ */
.login-body {
  min-height: 100vh; margin: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(99, 102, 241, .35), transparent 60%),
    radial-gradient(800px 460px at -10% 110%, rgba(59, 130, 246, .3), transparent 60%),
    linear-gradient(135deg, #0b1220 0%, #16234a 55%, #1e3a8a 100%);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
.login-card {
  width: 404px; max-width: 92vw; background: #fff;
  border-radius: 18px; padding: 42px 40px 34px;
  box-shadow: 0 30px 70px rgba(2, 6, 23, .5);
}
.login-card .brand {
  display: flex; align-items: center; gap: 13px; margin-bottom: 28px;
  justify-content: center;
}
.login-card .brand .logo {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(135deg, #2f6bff, #6366f1 60%, #8b5cf6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(124, 92, 240, .4);
}
.login-card .brand .name { font-size: 1.22rem; font-weight: 800; color: var(--text); }
.login-card .brand .sub { font-size: .72rem; color: var(--text-muted); display: block; letter-spacing: .4px; }
.login-card .btn { padding: .58rem 1rem; border-radius: 9px; }

/* ============ 趋势图 ============ */
.chart-bars { display: flex; align-items: flex-end; gap: 9px; height: 185px; }
.chart-bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart-bars .bar {
  width: 68%; border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  transition: height .4s ease, filter .15s ease;
}
.chart-bars .bar.rev { background: linear-gradient(180deg, #34d399, #059669); }
.chart-bars .bar:hover { filter: brightness(1.12); }
.chart-bars .val { font-size: .72rem; color: var(--text-muted); margin-bottom: 5px; }
.chart-bars .lbl { font-size: .72rem; color: var(--text-muted); margin-top: 7px; }

/* ============ 操作日志页 ============ */
.log-sub { font-size: .76rem; color: var(--text-muted); }
.log-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.log-count {
  background: var(--primary-light); color: var(--primary-dark);
  font-weight: 700; font-size: .78rem; padding: .34em .82em; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.log-range {
  font-size: .76rem; color: var(--text-muted); background: #f1f5f9;
  border: 1px solid #e2e8f0; border-radius: 999px; padding: .3em .78em;
  font-variant-numeric: tabular-nums;
}

.log-quick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.log-quick-label { font-size: .74rem; color: var(--text-muted); font-weight: 600; }
.log-quick .btn { padding: .22rem .74rem; font-size: .78rem; border-radius: 999px; }

.log-time { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .82rem; }
.log-op { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.log-op .avatar-sm {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #2f6bff, #8b5cf6); color: #fff;
  font-size: .68rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.log-target-type {
  font-size: .72rem; color: #475569; background: #e8edf5;
  border-radius: 5px; padding: 1px 6px; margin-right: 4px;
}
.log-state {
  max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .82rem;
}
.log-ip { font-variant-numeric: tabular-nums; }

.log-empty { text-align: center; padding: 44px 0 !important; color: var(--text-muted); }
.log-empty svg { width: 34px; height: 34px; opacity: .4; margin-bottom: 10px; }
.log-empty-title { font-weight: 600; color: #475569; }
.log-empty-hint { font-size: .76rem; margin-top: 4px; }

.log-pager {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-top: 14px;
}
.log-pager .pagination { margin-bottom: 0; }
.log-pager .page-link {
  color: var(--primary); border-color: var(--card-border);
  border-radius: 8px; margin: 0 2px; font-size: .8rem;
}
.log-pager .page-link:hover { background: var(--primary-light); border-color: #bfd3ff; }
.log-pager .page-item.active .page-link {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: transparent; color: #fff;
  box-shadow: 0 3px 10px rgba(47, 107, 255, .3);
}
.log-pager .page-item.disabled .page-link { color: #b6c2d4; background: #fff; }

/* ============ 回调日志页 ============ */
.log-txn {
  font-size: .8rem; font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.log-detail summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 5px;
  font-size: .78rem; font-weight: 600; color: var(--primary);
  padding: .16em .6em; border-radius: 999px;
  background: var(--primary-light); border: 1px solid #dbe6ff;
  transition: background .15s ease, color .15s ease;
}
.log-detail summary::-webkit-details-marker { display: none; }
.log-detail summary::before {
  content: "▸"; font-size: .68rem; line-height: 1; transition: transform .15s ease;
}
.log-detail[open] summary::before { transform: rotate(90deg); }
.log-detail summary:hover { background: #dbe6ff; color: var(--primary-dark); }
.log-raw {
  margin: 9px 0 0; padding: 11px 13px;
  background: #0f172a; color: #cbd5e1; border-radius: 9px;
  font-size: .74rem; line-height: 1.55;
  max-height: 260px; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .18);
}
.log-raw code { color: inherit; background: transparent; padding: 0; font-size: inherit; }

/* ============ 响应式 ============ */
@media (max-width: 991.98px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; }
  .sidebar-brand { border-bottom: none; padding: 10px 14px; }
  .sidebar-nav { display: flex; overflow-x: auto; padding: 6px 8px; }
  .sidebar-nav .nav-section { display: none; }
  .sidebar-nav a { white-space: nowrap; margin: 0 3px; }
  .sidebar-nav a.active::before { display: none; }
  .sidebar-foot { display: none; }
  .content { padding: 18px 14px 34px; }
}
