/* =====================================================================
   大水牛 · 管理后台 · 样式表
   视觉参考：biz-license-app/admin.html
   主色 #1668dc   顶栏 #0d4fb8   卡片白底+圆角10+阴影
   ===================================================================== */

* { box-sizing: border-box; }

:root {
  --c-primary: #1668dc;
  --c-primary-hover: #0f5ac7;
  --c-primary-soft: #e6f0fd;
  --c-topbar: #0d4fb8;
  --c-success: #16a34a;
  --c-success-soft: #dcfce7;
  --c-danger: #dc2626;
  --c-danger-soft: #fee2e2;
  --c-warn: #d97706;
  --c-warn-soft: #fef3c7;
  --c-gray: #6b7280;
  --c-gray-soft: #f1f5f9;
  --c-blue-soft: #e0ecff;

  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-soft: #6b7280;
  --text-mute: #9ca3af;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --nav-w: 200px;
  --topbar-h: 56px;
}

html, body { height: 100%; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ==================== 通用按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { box-shadow: var(--shadow-sm); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
.btn-secondary { background: var(--c-blue-soft); color: var(--c-primary); border-color: var(--c-blue-soft); }
.btn-accent { background: var(--c-success); color: #fff; border-color: var(--c-success); }
.btn-accent:hover { background: #128a3d; border-color: #128a3d; }
.btn-danger { background: var(--c-danger); color: #fff; border-color: var(--c-danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-ghost { background: transparent; color: var(--text-soft); border-color: transparent; }
.btn-ghost:hover { background: rgba(22,104,220,.08); color: var(--c-primary); }
.btn-link { background: transparent; color: var(--c-primary); border: none; padding: 0 4px; }
.btn-link:hover { color: var(--c-primary-hover); text-decoration: underline; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 18px; font-size: 15px; }
.btn-row { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ==================== 表单 ==================== */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row-inline { flex-direction: row; align-items: center; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin-top: 10px;
}
.form-row-span2 { grid-column: span 2; }
.form-label {
  font-size: 12px;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.form-input, .form select, .form textarea, input[type="text"].form-input, select.form-input, textarea.form-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(22,104,220,.15);
}
textarea.form-input { resize: vertical; min-height: 70px; }
.form-actions { display: flex; gap: 8px; }
.form-check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); cursor: pointer; }

/* ==================== Tip icon & Tooltip ==================== */
.tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 11px;
  font-weight: 600;
  font-style: normal;
  color: #fff;
  background: var(--c-primary);
  border-radius: 50%;
  cursor: help;
  user-select: none;
  position: relative;
  vertical-align: middle;
  box-shadow: 0 1px 2px rgba(22,104,220,.3);
}
.tip-icon:hover { background: var(--c-primary-hover); }
.tip-icon::after {
  content: "?";
  line-height: 1;
}

.dsn-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 320px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .12s, transform .12s;
  box-shadow: var(--shadow);
  white-space: pre-wrap;
  word-break: break-word;
}
.dsn-tooltip.is-show { opacity: 1; transform: translateY(0); }
.dsn-tooltip::before {
  content: "";
  position: absolute;
  left: 14px;
  top: -5px;
  border: 5px solid transparent;
  border-bottom-color: rgba(15, 23, 42, 0.94);
  border-top: 0;
}

/* ==================== 登录页 ==================== */
.page-login {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d4fb8 0%, #1668dc 55%, #2c80ec 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-bg {
  display: flex;
  gap: 24px;
  width: 100%;
  max-width: 980px;
  background: rgba(255,255,255,.07);
  border-radius: 20px;
  padding: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 30px 80px rgba(8, 30, 78, .25);
}
.login-card {
  flex: 1 1 420px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-logo {
  width: 52px;
  height: 52px;
  background: var(--c-primary);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-titles h1 { margin: 0; font-size: 20px; color: var(--text); }
.login-titles p { margin: 2px 0 0; font-size: 12px; color: var(--text-mute); }
.login-foot { font-size: 12px; margin-top: 16px; }

.login-aside {
  flex: 0 0 320px;
  color: #fff;
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-aside h2 { margin: 0 0 8px; font-size: 24px; }
.login-aside p { font-size: 13px; line-height: 1.6; opacity: .92; }
.aside-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.aside-list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  font-size: 13px;
  opacity: .95;
}
.aside-list li::before {
  content: "🐃";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 12px;
}

@media (max-width: 880px) {
  .login-bg { flex-direction: column; }
  .login-aside { display: none; }
}

/* ==================== 后台主框架 ==================== */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  background: var(--c-topbar);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(13, 79, 184, 0.18);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-logo {
  width: 30px; height: 30px; background: rgba(255,255,255,.18);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-tag {
  margin-left: 6px;
  background: rgba(255,255,255,.18);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-welcome { font-size: 13px; opacity: .9; }
.topbar .btn-ghost { color: rgba(255,255,255,.9); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.15); color: #fff; }

.main-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ==================== 侧栏 ==================== */
.sidenav {
  width: var(--nav-w);
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: var(--topbar-h);
  align-self: flex-start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.nav-list { list-style: none; margin: 0; padding: 0; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
  cursor: pointer;
}
.nav-item:hover { background: var(--c-primary-soft); color: var(--c-primary); }
.nav-item.is-active {
  background: var(--c-primary-soft);
  color: var(--c-primary);
  border-left-color: var(--c-primary);
  font-weight: 600;
}
.nav-ico { font-size: 16px; width: 20px; text-align: center; }
.nav-flag {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 6px;
  background: var(--c-warn-soft);
  color: var(--c-warn);
  border-radius: 999px;
}
.nav-admin-only.hidden-by-flag { display: none; }
.nav-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.muted { color: var(--text-soft); }
.muted-xs { color: var(--text-mute); font-size: 11px; }

/* ==================== 主区 ==================== */
.content {
  flex: 1;
  padding: 22px 26px 60px;
  min-width: 0;
}
.page { display: none; }
.page.is-active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.manual-btn { white-space: nowrap; }

/* ==================== KPI 卡片 ==================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  border: 1px solid #eef2f9;
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 70px; height: 70px;
  background: var(--c-primary-soft);
  border-radius: 50%;
  transform: translate(35%, -35%);
  opacity: .7;
}
.kpi-label {
  font-size: 12px;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 1;
}
.kpi-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--c-primary);
  margin: 6px 0 4px;
  position: relative;
  z-index: 1;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-soft);
  position: relative;
  z-index: 1;
}
.kpi-sub b { color: var(--text); font-weight: 600; }

/* ==================== 图表 ==================== */
.chart-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px 22px;
  box-shadow: var(--shadow);
  border: 1px solid #eef2f9;
}
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
  flex-wrap: wrap;
}
.chart-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chart-tabs { display: inline-flex; gap: 6px; }
.chip {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--c-gray-soft);
  color: var(--text-soft);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 12px;
}
.chip:hover { background: var(--c-blue-soft); color: var(--c-primary); }
.chip.is-on { background: var(--c-primary); color: #fff; }
.chart-wrap { position: relative; height: 280px; }

/* ==================== 工具栏 + 表格 ==================== */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
  background: var(--card);
  padding: 12px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid #eef2f9;
}
.toolbar .search-input { flex: 1; min-width: 200px; }
.toolbar select.form-input, .toolbar input[type="date"].form-input { width: auto; }

.table-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid #eef2f9;
  overflow: hidden;
}

.dsn-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.dsn-table thead th {
  background: #f8fafc;
  color: var(--text-soft);
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.dsn-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.dsn-table tbody tr:hover { background: #f8fafc; }
.dsn-table tbody tr:last-child td { border-bottom: none; }
.dsn-table .col-mono { font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px; }
.dsn-table .col-truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsn-table .empty-row td {
  text-align: center;
  color: var(--text-mute);
  padding: 36px 14px;
  font-style: italic;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-soft);
}

/* ==================== Tag 徽章 ==================== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 999px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.tag-ok { background: var(--c-success-soft); color: var(--c-success); }
.tag-bad { background: var(--c-danger-soft); color: var(--c-danger); }
.tag-wait { background: var(--c-warn-soft); color: var(--c-warn); }
.tag-gray { background: var(--c-gray-soft); color: var(--c-gray); }
.tag-blue { background: var(--c-blue-soft); color: var(--c-primary); }

/* ==================== 系统配置分组 ==================== */
.config-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid #eef2f9;
  padding: 16px 18px 18px;
  margin-bottom: 14px;
}
.config-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.config-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.smtp-test {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.smtp-test .form-input { flex: 1; min-width: 220px; }

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.switch-row input[type="checkbox"] {
  appearance: none;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #d1d5db;
  position: relative;
  cursor: pointer;
  transition: background .15s;
  outline: none;
  flex-shrink: 0;
}
.switch-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch-row input[type="checkbox"]:checked {
  background: var(--c-primary);
}
.switch-row input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}
.switch-label { font-size: 14px; color: var(--text); }

/* ==================== Toast ==================== */
.toast-host {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toastIn .18s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.is-out { animation: toastOut .2s ease forwards; }
.toast-ok { background: var(--c-success); }
.toast-bad { background: var(--c-danger); }
.toast-warn { background: var(--c-warn); }
.toast-info { background: var(--c-primary); }
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateX(20px); opacity: 0; } }

/* ==================== Modal ==================== */
.modal-host, .drawer-host { position: fixed; inset: 0; pointer-events: none; z-index: 9990; }
.modal-host .modal, .drawer-host .modal { pointer-events: auto; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 9991;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  animation: maskIn .15s ease;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative;
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: cardIn .18s ease;
}
.modal-card.is-wide { max-width: 720px; }
.modal-card.is-extra-wide { max-width: 880px; }
@keyframes cardIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  color: var(--text-mute);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--c-gray-soft); color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f8fafc;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* 批量生成向导的卡片内容样式 */
.wizard-step {
  background: var(--c-primary-soft);
  color: var(--c-primary);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
}
.wizard-result {
  background: #0b1f3a;
  color: #cce0ff;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
  padding: 12px;
  border-radius: 8px;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre;
}
.wizard-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ==================== Drawer (用户详情侧栏) ==================== */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 95vw;
  background: #fff;
  box-shadow: -8px 0 24px rgba(15,23,42,.12);
  z-index: 9992;
  display: flex;
  flex-direction: column;
  animation: drawerIn .2s ease;
}
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }
.drawer-mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 9991;
  animation: maskIn .15s ease;
}
.drawer-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.drawer-body { padding: 18px; overflow-y: auto; flex: 1; }
.detail-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.detail-grid dt { color: var(--text-soft); }
.detail-grid dd { margin: 0; color: var(--text); word-break: break-all; }
.detail-section {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-top: 12px;
}
.detail-section h4 {
  font-size: 13px;
  color: var(--text-soft);
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==================== 操作手册弹窗（Markdown） ==================== */
.manual-card { max-width: 720px; }
.markdown-body { line-height: 1.7; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--text);
}
.markdown-body h1 { font-size: 18px; }
.markdown-body h2 { font-size: 16px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.markdown-body h3 { font-size: 14px; color: var(--c-primary); }
.markdown-body p { margin: 8px 0; }
.markdown-body ul, .markdown-body ol { margin: 8px 0; padding-left: 22px; }
.markdown-body li { margin: 4px 0; }
.markdown-body code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #c7254e;
}
.markdown-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
}
.markdown-body pre code { background: transparent; color: inherit; padding: 0; }
.markdown-body blockquote {
  border-left: 3px solid var(--c-primary);
  background: var(--c-primary-soft);
  padding: 8px 12px;
  margin: 10px 0;
  border-radius: 0 6px 6px 0;
  color: var(--text);
}
.markdown-body hr { border: 0; border-top: 1px dashed var(--border); margin: 14px 0; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12px; }
.markdown-body table th, .markdown-body table td {
  border: 1px solid var(--border); padding: 6px 8px; text-align: left;
}
.markdown-body table th { background: #f8fafc; }

/* ==================== Loading overlay ==================== */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  font-size: 12px;
  color: var(--text-soft);
}
.loading-overlay::before {
  content: "";
  width: 24px; height: 24px;
  border: 3px solid var(--c-primary);
  border-top-color: transparent;
  border-radius: 50%;
  margin-right: 8px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== Scrollbar 美化 ==================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(15,23,42,.18); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(15,23,42,.3); }
::-webkit-scrollbar-track { background: transparent; }

/* ==================== 响应式 ==================== */
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-row-span2 { grid-column: span 1; }
  .sidenav { width: 64px; }
  .nav-item span:not(.nav-ico):not(.nav-flag) { display: none; }
  .nav-foot { display: none; }
  .content { padding: 16px; }
  .topbar-title { display: none; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-num { font-size: 22px; }
  .drawer { width: 100%; }
}
