/* ============================================================
   全域系统管理平台 - 主壳样式
   纯原生 CSS，无构建、无框架依赖
   ============================================================ */

:root {
  --c-bg: #f4f6f9;
  --c-panel: #ffffff;
  --c-side: #16203a;
  --c-side-hover: #1f2b4a;
  --c-side-active: #2b6cf6;
  --c-line: #e4e8ef;
  --c-text: #1f2430;
  --c-text-2: #5b6478;
  --c-text-3: #97a0b3;
  --c-primary: #2b6cf6;
  --c-primary-dark: #1c56d0;
  --c-primary-soft: #eaf1ff;
  --c-success: #16a34a;
  --c-warn: #d97706;
  --c-danger: #dc2626;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --side-w: 224px;
  --top-h: 56px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }

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

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

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

/* ---------------- 骨架 ---------------- */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.side {
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  background: var(--c-side);
  color: #cdd5e6;
  display: flex;
  flex-direction: column;
  transition: width .18s ease, flex-basis .18s ease;
}

.layout.collapsed .side {
  width: 64px;
  flex-basis: 64px;
}

.side-brand {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  flex: 0 0 var(--top-h);
  overflow: hidden;
  white-space: nowrap;
}

.brand-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  background: var(--c-primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0;
}

.brand-name {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  letter-spacing: .2px;
}

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 20px;
}

.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .14);
  border-radius: 3px;
}

.nav-group-title {
  padding: 14px 10px 6px;
  font-size: 11px;
  letter-spacing: .6px;
  color: #6c7893;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}

.layout.collapsed .nav-group-title { visibility: hidden; height: 12px; padding: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 2px;
  border-radius: var(--r-md);
  color: #c3cde0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  border: 0;
  background: transparent;
  width: 100%;
  font-size: 13.5px;
  font-family: inherit;
  text-align: left;
  transition: background .12s, color .12s;
}

.nav-item:hover { background: var(--c-side-hover); color: #fff; }

.nav-item.active {
  background: var(--c-side-active);
  color: #fff;
}

.nav-item.active .nav-ico { opacity: 1; }

.nav-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  opacity: .8;
}

.nav-ico svg { width: 100%; height: 100%; display: block; }

.nav-text { overflow: hidden; text-overflow: ellipsis; }

.layout.collapsed .nav-text { display: none; }

.side-foot {
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 12px;
  color: #6c7893;
  white-space: nowrap;
  overflow: hidden;
}

/* ---------------- 主区 ---------------- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--top-h);
  flex: 0 0 var(--top-h);
  background: var(--c-panel);
  border-bottom: 1px solid var(--c-line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--c-text-2);
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-btn:hover { background: #eef1f6; color: var(--c-text); }
.icon-btn svg { width: 18px; height: 18px; }

.crumb {
  font-size: 14px;
  color: var(--c-text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.crumb b { color: var(--c-text); font-weight: 500; }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--c-text);
}

.user-chip:hover { background: #f2f5fa; border-color: var(--c-line); }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-primary-soft);
  color: var(--c-primary);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 500;
}

.dropdown {
  position: absolute;
  right: 14px;
  top: 50px;
  min-width: 190px;
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 900;
}

.dropdown[hidden] { display: none; }

.dd-head {
  padding: 9px 10px 10px;
  border-bottom: 1px solid var(--c-line);
  margin-bottom: 6px;
}

.dd-head strong { font-weight: 500; display: block; }
.dd-head span { font-size: 12px; color: var(--c-text-3); }

.dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--c-text);
  border: 0;
  background: transparent;
  width: 100%;
  font-family: inherit;
  text-align: left;
}

.dd-item:hover { background: #f2f5fa; }
.dd-item.danger { color: var(--c-danger); }

.content {
  flex: 1;
  overflow: auto;
  position: relative;
}

.page {
  padding: 20px 22px 40px;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  box-sizing: border-box;
}

.view-frame {
  border: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #fff;
}

/* ---------------- 通用组件 ---------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 19px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -.2px;
}

.page-desc {
  font-size: 13px;
  color: var(--c-text-3);
  margin: 0 0 2px;
}

.card {
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-head h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
}

.card-body { padding: 16px; }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar .spacer { flex: 1; }

/* 按钮 */
.btn {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-line);
  background: #fff;
  color: var(--c-text);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}

.btn:hover { background: #f6f8fb; border-color: #cfd6e2; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}

.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }

.btn-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-text {
  border-color: transparent;
  background: transparent;
  color: var(--c-primary);
  padding: 0 8px;
  height: 28px;
}

.btn-text:hover { background: var(--c-primary-soft); border-color: transparent; }

.btn-text.danger { color: var(--c-danger); }
.btn-text.danger:hover { background: #fdecec; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }

/* 表单 */
.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--c-text-2);
  margin-bottom: 6px;
}

.field label .req { color: var(--c-danger); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--c-text);
  background: #fff;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}

.textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.6; }

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(43, 108, 246, .12);
}

.input::placeholder, .textarea::placeholder { color: #b3bacb; }

.input-sm { height: 32px; width: auto; min-width: 170px; }

.field-hint { font-size: 12px; color: var(--c-text-3); margin-top: 5px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.form-grid .full { grid-column: 1 / -1; }

/* 表格 */
.table-wrap {
  overflow: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--c-line);
  background: var(--c-panel);
}

table.tb {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.tb th {
  text-align: left;
  font-weight: 500;
  color: var(--c-text-2);
  background: #f8fafc;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

table.tb td {
  padding: 11px 14px;
  border-bottom: 1px solid #f0f3f8;
  vertical-align: middle;
}

table.tb tbody tr:hover td { background: #fafbfe; }
table.tb tbody tr:last-child td { border-bottom: 0; }

.tb-actions { display: flex; gap: 2px; }

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

.empty-mark {
  width: 42px;
  height: 42px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #f1f4f9;
  display: grid;
  place-items: center;
  color: #b9c2d4;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef1f6;
  color: var(--c-text-2);
  white-space: nowrap;
}

.tag.ok { background: #e8f7ee; color: #15803d; }
.tag.warn { background: #fef4e6; color: #b45309; }
.tag.err { background: #fdecec; color: #b91c1c; }
.tag.info { background: var(--c-primary-soft); color: var(--c-primary-dark); }

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 4px 0;
  font-size: 13px;
  color: var(--c-text-2);
  flex-wrap: wrap;
}

.pager .spacer { flex: 1; }

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 20px;
  animation: fade .12s ease;
}

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.wide { max-width: 900px; }

.modal-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--c-line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-head h3 { margin: 0; font-size: 15px; font-weight: 500; }
.modal-head .icon-btn { margin-left: auto; }

.modal-body {
  padding: 18px;
  overflow: auto;
}

.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--c-line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #fcfdfe;
}

/* 提示 */
.toast-host {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 9px 16px;
  border-radius: var(--r-md);
  background: #fff;
  border: 1px solid var(--c-line);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slidein .16s ease;
  max-width: 520px;
}

@keyframes slidein { from { opacity: 0; transform: translateY(-6px) } to { opacity: 1; transform: none } }

.toast::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-primary);
  flex: 0 0 6px;
}

.toast.ok::before { background: var(--c-success); }
.toast.err::before { background: var(--c-danger); }
.toast.warn::before { background: var(--c-warn); }

/* 工作台 */
.hero {
  background: var(--c-side);
  color: #e8edf7;
  border-radius: var(--r-lg);
  padding: 22px 24px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.hero h2 { margin: 0 0 4px; font-size: 17px; font-weight: 500; color: #fff; }
.hero p { margin: 0; font-size: 13px; color: #9aa8c4; }
.hero .spacer { flex: 1; }

.hero-stats { display: flex; gap: 26px; }
.hero-stat b { display: block; font-size: 20px; font-weight: 500; color: #fff; line-height: 1.2; }
.hero-stat span { font-size: 12px; color: #8b99b6; }

.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(254px, 1fr));
  gap: 14px;
}

.mod-card {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 16px;
  cursor: pointer;
  transition: border-color .14s, box-shadow .14s, transform .14s;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  font-family: inherit;
  width: 100%;
}

.mod-card:hover {
  border-color: #c6d4ee;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .07);
  transform: translateY(-1px);
}

.mod-ico {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 9px;
  background: var(--c-primary-soft);
  color: var(--c-primary);
  display: grid;
  place-items: center;
}

.mod-ico svg { width: 19px; height: 19px; }

.mod-card h4 { margin: 1px 0 3px; font-size: 14px; font-weight: 500; }
.mod-card p { margin: 0; font-size: 12.5px; color: var(--c-text-3); line-height: 1.5; }

.stat-group { margin-bottom: 16px; }

.stat-group-title {
  font-size: 12.5px;
  color: var(--c-text-3);
  margin: 0 0 8px 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 1100px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stat {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
}

.stat > span:first-child { font-size: 12.5px; color: var(--c-text-3); display: block; }
.stat b { font-size: 22px; font-weight: 500; letter-spacing: -.3px; }
.stat .unit { font-size: 12px; color: var(--c-text-3); margin-left: 4px; font-weight: 400; display: inline; }

/* 权限树 */
.perm-group { border: 1px solid var(--c-line); border-radius: var(--r-md); margin-bottom: 10px; overflow: hidden; }

.perm-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--c-line);
  font-size: 13.5px;
  font-weight: 500;
}

.perm-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 2px 12px;
  padding: 10px 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--c-text-2);
  padding: 4px 0;
  cursor: pointer;
}

.check input { width: 14px; height: 14px; accent-color: var(--c-primary); cursor: pointer; }

/* 登录页 */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: #fff;
}

.auth-side {
  background: var(--c-side);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-brand {
  position: absolute; left: 48px; top: 44px;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--c-primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 21px;
  line-height: 1;
  letter-spacing: .5px;
}

.auth-side::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: rgba(43, 108, 246, .16);
  right: -190px;
  bottom: -220px;
}

/* ---- 左栏主体：平台名 + 超大标题 + 一句副文案（居中构图）---- */
.auth-side-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
}

.auth-side h1 { font-size: 25px; font-weight: 500; margin: 0 0 6px; letter-spacing: -.4px; color: #fff; }

.auth-hero { position: relative; margin-top: 34px; }

/* 发光球体：点阵球 + 辉光 + 轨道环 + 环绕图标 */
.auth-orb {
  position: absolute; left: 50%; top: 50%;
  width: 520px; height: 520px; margin: -260px 0 0 -260px;
  pointer-events: none;
}
.orb-glow {
  position: absolute; left: 50%; top: 50%;
  width: 300px; height: 300px; margin: -150px 0 0 -150px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(96, 170, 255, .30), transparent 60%),
    radial-gradient(circle at 68% 72%, rgba(109, 92, 255, .28), transparent 62%);
  filter: blur(26px);
  animation: orbFloat 10s ease-in-out infinite;
}
.orb-dots {
  position: absolute; left: 50%; top: 50%;
  width: 330px; height: 330px; margin: -165px 0 0 -165px;
  border-radius: 50%;
  background-image: radial-gradient(circle, rgba(163, 208, 255, .5) 1.1px, transparent 1.3px);
  background-size: 13px 13px;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 40%, rgba(0, 0, 0, .35) 66%, transparent 74%);
  mask-image: radial-gradient(circle at 50% 50%, #000 40%, rgba(0, 0, 0, .35) 66%, transparent 74%);
  animation: orbFloat 10s ease-in-out infinite reverse;
}
.orb-ring {
  position: absolute; left: 50%; top: 50%;
  width: 430px; height: 430px; margin: -215px 0 0 -215px;
  border-radius: 50%;
  border: 1px solid rgba(140, 190, 255, .16);
}
.orb-ring-2 {
  width: 520px; height: 520px; margin: -260px 0 0 -260px;
  border-color: rgba(140, 190, 255, .09);
}
.orb-chip {
  position: absolute; left: var(--x); top: var(--y);
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  font-size: 17px; line-height: 1;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(160, 200, 255, .18);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
  animation: chipFloat 7s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}

@keyframes orbFloat {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(0, -14px, 0); }
}
@keyframes chipFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-9px) scale(1.05); }
}

/* 超大标题：第一行纯白，第二行渐变高亮 */
.auth-hero-title {
  position: relative;
  margin: 0 0 18px;
  font-size: clamp(34px, 3.4vw, 50px);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -1px;
  color: #fff;
  text-shadow: 0 4px 26px rgba(4, 10, 24, .6);
}
.auth-hero-title span { display: block; }
.auth-hero-title .grad {
  background: linear-gradient(92deg, #a8d4ff 0%, #6d5cff 52%, #4ad6c9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-hero-sub {
  position: relative;
  margin: 0 auto;
  max-width: 460px;
  font-size: 14.5px;
  line-height: 1.9;
  color: #9db0d4;
  text-shadow: 0 2px 14px rgba(4, 10, 24, .85);
}

.auth-foot { font-size: 12px; color: #6c7893; position: absolute; left: 48px; bottom: 40px; }

.auth-form-wrap {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.auth-form { width: 100%; max-width: 340px; }
.auth-form h2 { font-size: 20px; font-weight: 500; margin: 0 0 26px; }

.auth-form .input { height: 40px; font-size: 14px; }
.auth-form .btn { height: 40px; width: 100%; justify-content: center; font-size: 14px; margin-top: 6px; }

.auth-err {
  background: #fdecec;
  color: #b91c1c;
  border: 1px solid #f8d4d4;
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.auth-err[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .orb-glow, .orb-dots, .orb-chip { animation: none; }
}

@media (max-width: 940px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 800; height: 100%; }
  .layout:not(.collapsed) .side { box-shadow: var(--shadow-lg); }
  .layout.collapsed .side { width: 0; flex-basis: 0; overflow: hidden; }
}

/* 加载骨架 */
.skeleton {
  background: linear-gradient(90deg, #f1f4f9 25%, #e8edf5 37%, #f1f4f9 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease infinite;
  border-radius: var(--r-sm);
  height: 14px;
}

@keyframes shimmer {
  from { background-position: 100% 50% }
  to { background-position: 0 50% }
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg) } }

/* ============================================================
   Element Plus 视觉对齐层
   对齐 Trae 原版 AdminLayout.vue 的配色与布局，同时承载多级折叠菜单。
   放在文件末尾以覆盖上方同名规则，便于整体回滚。
   ============================================================ */
:root {
  --c-bg: #f5f7fa;
  --c-panel: #ffffff;
  --c-side: #001529;
  --c-side-hover: #002140;
  --c-side-active: #1890ff;
  --c-line: #e4e7ed;
  --c-text: #303133;
  --c-text-2: #606266;
  --c-text-3: #909399;
  --c-primary: #409eff;
  --c-primary-dark: #337ecc;
  --c-primary-soft: #ecf5ff;
  --r-sm: 3px;
  --r-md: 4px;
  --r-lg: 6px;
  --side-w: 220px;
  --top-h: 56px;
  --shadow: 0 1px 4px rgba(0, 0, 0, .04);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .14);
}

.content { background: var(--c-bg); }

/* ---------------- 侧栏 ---------------- */
.side { background: var(--c-side); color: rgba(255, 255, 255, .75); }
.side-brand {
  height: var(--top-h);
  flex-basis: var(--top-h);
  padding: 0 20px;
  border-bottom-color: rgba(255, 255, 255, .08);
}
.brand-mark {
  width: 30px; height: 30px; flex-basis: 30px;
  border-radius: 6px; font-size: 12px;
}
.brand-name { font-size: 15px; }
.side-nav { padding: 8px 0 24px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); }
.side-foot { color: rgba(255, 255, 255, .38); border-top-color: rgba(255, 255, 255, .08); }

.nav-group-title {
  padding: 14px 20px 6px;
  font-size: 11px;
  letter-spacing: .5px;
  color: rgba(255, 255, 255, .34);
  text-transform: none;
}

/* el-menu 风格：直角块、40px 行高、深蓝 hover、左侧蓝条高亮 */
.nav-item {
  height: 40px;
  padding: 0 16px;
  margin-bottom: 0;
  border-radius: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, .75);
}
.nav-item:hover { background: var(--c-side-hover); color: #fff; }
.nav-item.active,
.nav-item.active:hover {
  background: rgba(64, 158, 255, .16);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--c-primary);
}
.nav-item.active .nav-ico { opacity: 1; }
.nav-ico { width: 18px; height: 18px; flex-basis: 18px; opacity: .72; }

/* 可折叠分组 */
.nav-sub { margin-bottom: 0; }
.nav-sub-sys {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.nav-parent { position: relative; color: #fff; font-weight: 500; }
.nav-parent.nav-parent-active { color: #fff; }
.nav-parent.nav-parent-active > .nav-ico { opacity: 1; }
.nav-arrow {
  margin-left: auto;
  width: 14px; height: 14px;
  display: grid; place-items: center;
  opacity: .6;
  transition: transform .18s ease;
}
.nav-arrow svg { width: 14px; height: 14px; display: block; }
.nav-parent.expanded > .nav-arrow { transform: rotate(90deg); }

.nav-children { display: none; }
.nav-children.open { display: block; }
.nav-leaf {
  height: 36px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, .78);
}
.nav-leaf .nav-ico { width: 15px; height: 15px; flex-basis: 15px; opacity: .72; }
.nav-leaf.active .nav-ico { opacity: 1; color: #fff; }
.nav-sub-l2 .nav-parent {
  height: 36px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, .82);
  font-weight: 400;
}

.layout.collapsed .nav-children { display: none !important; }
.layout.collapsed .nav-arrow { display: none; }
.layout.collapsed .nav-item { padding-left: 20px !important; }

/* ---------------- 顶栏 ---------------- */
.topbar { padding: 0 20px; border-bottom-color: #e4e7ed; }
.crumb { font-size: 14px; color: var(--c-text-3); gap: 6px; }
.crumb b { color: var(--c-text); font-weight: 500; }
.crumb-home { color: var(--c-text-2); }
.crumb-home:hover { color: var(--c-primary); }
.crumb-sep { font-style: normal; color: #c0c4cc; }

.user-chip { gap: 8px; font-size: 14px; }
.user-chip:hover { background: #f5f7fa; border-color: var(--c-line); }
.chip-caret {
  width: 0; height: 0; margin-left: 1px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--c-text-3);
}
.avatar {
  width: 32px; height: 32px;
  background: var(--c-primary);
  color: #fff;
  font-size: 13px;
}

/* ---------------- 通用组件对齐 el-card / el-button / el-input ---------------- */
.card {
  border: 1px solid #ebeef5;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}
.card-head { padding: 14px 18px; }
.stat { border-color: #ebeef5; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.04); }

.btn {
  height: 32px;
  border-radius: 4px;
  border-color: #dcdfe6;
  font-size: 14px;
}
.btn-primary { background: #409eff; border-color: #409eff; }
.btn-primary:hover { background: #66b1ff; border-color: #66b1ff; }
.input, .select, .textarea { border-color: #dcdfe6; border-radius: 4px; }
.input:focus, .select:focus, .textarea:focus {
  border-color: #409eff;
  box-shadow: 0 0 0 3px rgba(64, 158, 255, .12);
}
.tag { border-radius: 4px; height: 22px; }
.tag.info { background: var(--c-primary-soft); color: var(--c-primary-dark); }

/* ============================================================
   总览 / 仪表盘 —— 对齐 Trae 原版 Dashboard 页面布局
   独立 db- 前缀作用域，不影响主壳与其他视图
   ============================================================ */
.db-root {
  padding: 24px;
  min-height: 100%;
  background: #f4f6fa;
  color: #1d2129;
  font-size: 14px;
}
.db-root *, .db-root *::before, .db-root *::after { box-sizing: border-box; }

/* ---- 欢迎横幅 ---- */
.db-welcome {
  position: relative;
  display: flex;
  align-items: center;
  gap: 48px;
  padding: 28px 32px;
  margin-bottom: 24px;
  border-radius: 16px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, #667eea, #764ba2);
  box-shadow: 0 2px 12px rgba(102, 126, 234, .15);
}
.db-welcome::before {
  content: ""; position: absolute; top: -50%; right: -20%;
  width: 400px; height: 400px; border-radius: 50%; background: rgba(255, 255, 255, .10);
}
.db-welcome::after {
  content: ""; position: absolute; bottom: -30%; right: 10%;
  width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .05);
}
.db-welcome-left, .db-welcome-center, .db-welcome-right { position: relative; z-index: 1; }
.db-welcome-left h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; color: #fff; }
.db-welcome-left p { margin: 0; font-size: 14px; color: rgba(255, 255, 255, .9); }
.db-build-tag {
  display: inline-block; margin-left: 8px; padding: 1px 6px;
  font-size: 11px; font-weight: 500; letter-spacing: .5px; opacity: .55;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 4px; vertical-align: 2px;
}
.db-welcome-center { margin-left: auto; }
.db-time { display: flex; align-items: baseline; gap: 4px; }
.db-time #dbHour, .db-time #dbMin {
  font-size: 42px; font-weight: 300; color: #fff; font-variant-numeric: tabular-nums;
}
.db-time-sep { font-size: 36px; color: rgba(255, 255, 255, .8); animation: db-blink 1s infinite; }
.db-time #dbSec {
  margin-left: 8px; font-size: 18px; color: rgba(255, 255, 255, .7);
  font-variant-numeric: tabular-nums;
}
@keyframes db-blink { 50% { opacity: .3; } }
.db-welcome-right { margin-left: auto; }
.db-theme {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 14px; border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 20px; background: rgba(255, 255, 255, .15);
  color: #fff; font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: background .3s;
}
.db-theme:hover { background: rgba(255, 255, 255, .25); }
.db-theme > span:first-child { font-size: 16px; }

/* ---- 指标卡 ---- */
.db-stats { display: grid; gap: 16px; margin-bottom: 24px; }
.db-stat-card {
  display: flex; align-items: center; gap: 14px; min-width: 0;
  padding: 20px; border-radius: 12px; background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .03);
  transition: transform .2s, box-shadow .2s;
}
.db-stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, .06); }
.db-stat-icon {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px;
  display: grid; place-items: center;
}
.db-stat-icon svg { width: 22px; height: 22px; }
.db-stat-icon.blue { background: #e8f3ff; }
.db-stat-icon.green { background: #e8ffea; }
.db-stat-icon.purple { background: #f0e8ff; }
.db-stat-icon.orange { background: #fff3e8; }
.db-stat-icon.cyan { background: #e6fcff; }
.db-stat-content { flex: 1; min-width: 0; }
.db-stat-label { margin-bottom: 6px; font-size: 13px; color: #86909c; }
.db-stat-value { margin-bottom: 6px; font-size: 17px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.db-stat-sub { font-size: 12px; color: #86909c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-spark { width: 50px; height: 28px; flex: 0 0 50px; }
.db-no-module { padding: 24px; text-align: center; color: #86909c; }
.db-stats.db-stats-single { grid-template-columns: 1fr !important; }
.db-loading-line { padding: 18px; font-size: 13px; color: #86909c; grid-column: 1 / -1; }

/* ---- 通用卡片 ---- */
.db-card {
  padding: 24px; border-radius: 12px; background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .03); min-width: 0;
}
.db-card-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.db-card-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.db-main-grid { display: grid; gap: 16px; margin-bottom: 24px; align-items: stretch; }
.db-bottom-grid { display: grid; gap: 16px; margin-bottom: 24px; align-items: stretch; }

/* ---- 销售趋势 ---- */
.db-filters { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.db-tabs { display: flex; padding: 3px; border-radius: 8px; background: #f2f3f5; }
.db-tab {
  padding: 6px 14px; border: 0; border-radius: 6px; background: transparent;
  color: #4e5969; font-size: 13px; font-family: inherit; cursor: pointer; transition: all .2s;
}
.db-tab.active { background: #fff; color: #1d2129; box-shadow: 0 1px 4px rgba(0, 0, 0, .06); font-weight: 500; }
.db-select {
  padding: 6px 12px; border: 1px solid #e5e6eb; border-radius: 6px;
  background: #fff; color: #4e5969; font-size: 13px; font-family: inherit; cursor: pointer;
}
.db-chart { position: relative; min-height: 250px; }
.db-chart-svg { display: block; }
.db-chart-empty { display: grid; place-items: center; min-height: 120px; color: #9ca3af; font-size: 13px; }
.db-chart-tip {
  position: absolute; z-index: 5; pointer-events: none; padding: 6px 10px;
  border-radius: 6px; background: rgba(29, 33, 41, .9); color: #fff;
  font-size: 12px; line-height: 1.6; white-space: nowrap;
}

/* ---- 待办事项 ---- */
.db-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #f53f3f; color: #fff; font-size: 11px;
}
.db-todo-list { display: flex; flex-direction: column; gap: 4px; }
.db-todo-item { display: flex; align-items: center; gap: 12px; padding: 14px 12px; border-radius: 8px; transition: background .15s; }
.db-todo-item:hover { background: #f7f8fa; }
.db-todo-icon { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 8px; display: grid; place-items: center; }
.db-todo-icon.red { background: #fff1f0; color: #f53f3f; }
.db-todo-icon.orange { background: #fff7e8; color: #ff7d00; }
.db-todo-icon.blue { background: #e8f3ff; color: #4080ff; }
.db-todo-icon.gray { background: #f2f3f5; color: #86909c; }
.db-todo-info { flex: 1; min-width: 0; }
.db-todo-title { margin-bottom: 2px; font-size: 14px; }
.db-todo-desc { font-size: 12px; color: #86909c; }
.db-todo-status { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; font-size: 12px; }
.db-todo-status .red { color: #f53f3f; }
.db-todo-status .orange { color: #ff7d00; }
.db-todo-status .blue { color: #4080ff; }
.db-todo-status .gray { color: #86909c; }
.db-dot { display: inline-block; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; }

/* ---- 渠道转化漏斗 ---- */
.db-funnel-date { font-size: 12px; color: #86909c; }
.db-funnel-wrap { display: flex; align-items: center; gap: 24px; }
.db-funnel-chart { width: 200px; flex: 0 0 200px; }
.db-funnel-chart svg { display: block; width: 100%; height: auto; }
.db-funnel-data { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.db-funnel-row { display: flex; align-items: center; gap: 12px; }
.db-fn-label { width: 72px; flex: 0 0 72px; font-size: 13px; color: #4e5969; }
.db-fn-value { width: 70px; flex: 0 0 70px; font-size: 14px; font-weight: 500; }
.db-fn-rate { margin-left: auto; font-size: 12px; color: #00b42a; }

/* ---- 快捷入口 ---- */
.db-quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.db-quick-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px; border: 0; border-radius: 10px; background: transparent;
  cursor: pointer; font-family: inherit; transition: all .2s;
}
.db-quick-item:hover { background: #f7f8fa; transform: translateY(-2px); }
.db-q-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.db-q-icon svg { width: 20px; height: 20px; }
.db-q-icon.q-blue { background: #e8f3ff; color: #4080ff; }
.db-q-icon.q-green { background: #e8ffea; color: #00b42a; }
.db-q-icon.q-purple { background: #f0e8ff; color: #722ed1; }
.db-q-icon.q-orange { background: #fff3e8; color: #ff7d00; }
.db-q-icon.q-cyan { background: #e6fcff; color: #0fc6c2; }
.db-q-icon.q-rose { background: #fff0f5; color: #eb2f96; }
.db-q-icon.q-yellow { background: #fffbe6; color: #faad14; }
.db-q-icon.q-indigo { background: #e6e8ff; color: #2f54eb; }
.db-q-label { font-size: 12px; color: #4e5969; text-align: center; line-height: 1.4; }
.db-quick-empty { grid-column: 1 / -1; }

/* ---- 客户分布 ---- */
.db-region-wrap { display: flex; align-items: flex-start; gap: 16px; }
.db-bars { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding-top: 2px; }
.db-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.db-bar-name { width: 38px; flex: 0 0 38px; color: #4e5969; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-bar-track { flex: 1; height: 10px; border-radius: 5px; background: #f7f9fc; overflow: hidden; }
.db-bar-fill { display: block; height: 100%; border-radius: 5px; }
.db-bar-val { width: 36px; flex: 0 0 36px; text-align: right; font-weight: 500; }
.db-region-list { width: 128px; flex: 0 0 128px; display: flex; flex-direction: column; gap: 10px; }
.db-region-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.db-region-row .db-dot { width: 8px; height: 8px; }
.db-r-name { flex: 1; color: #4e5969; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-r-val { font-weight: 500; }
.db-region-total { margin-top: 12px; padding-top: 12px; border-top: 1px solid #f2f3f5; font-size: 13px; color: #86909c; }
.db-region-total strong { margin-left: 4px; font-size: 15px; color: #1d2129; }

/* ---- 最近动态 ---- */
.db-feed-card { margin-bottom: 8px; }
.db-feed-sub { font-size: 12px; color: #86909c; }
.db-feed-list { display: flex; gap: 28px; overflow-x: auto; padding-bottom: 4px; }
.db-feed-item { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; min-width: 300px; }
.db-feed-avatar {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 600;
  background: linear-gradient(135deg, #ff9a9e, #fad0c4);
}
.db-feed-avatar.t2 { background: linear-gradient(135deg, #a1c4fd, #c2e9fb); }
.db-feed-avatar.t3 { background: linear-gradient(135deg, #fbc2eb, #a6c1ee); }
.db-feed-avatar.t4 { background: linear-gradient(135deg, #84fab0, #8fd3f4); }
.db-feed-info { display: flex; flex-direction: column; min-width: 0; }
.db-feed-title { font-size: 13px; max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-feed-desc { font-size: 12px; color: #86909c; }
.db-feed-time { margin-left: 4px; font-size: 12px; color: #c9cdd4; white-space: nowrap; }

/* ---- 仪表盘跟随全站深色主题 ---- */
html[data-theme="dark"] .db-root { background: #0f1115; color: #e6e6e6; }
html[data-theme="dark"] .db-stat-card, html[data-theme="dark"] .db-card { background: #161b22; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
html[data-theme="dark"] .db-stat-icon.blue { background: rgba(64, 128, 255, .15); }
html[data-theme="dark"] .db-stat-icon.green { background: rgba(0, 180, 42, .15); }
html[data-theme="dark"] .db-stat-icon.purple { background: rgba(114, 46, 209, .15); }
html[data-theme="dark"] .db-stat-icon.orange { background: rgba(255, 125, 0, .15); }
html[data-theme="dark"] .db-stat-icon.cyan { background: rgba(15, 198, 194, .15); }
html[data-theme="dark"] .db-stat-value, html[data-theme="dark"] .db-card-title, html[data-theme="dark"] .db-fn-value,
html[data-theme="dark"] .db-bar-val, html[data-theme="dark"] .db-r-val, html[data-theme="dark"] .db-region-total strong,
html[data-theme="dark"] .db-todo-title, html[data-theme="dark"] .db-feed-title { color: #e6e6e6; }
html[data-theme="dark"] .db-stat-label, html[data-theme="dark"] .db-stat-sub, html[data-theme="dark"] .db-todo-desc,
html[data-theme="dark"] .db-funnel-date, html[data-theme="dark"] .db-fn-label, html[data-theme="dark"] .db-r-name,
html[data-theme="dark"] .db-q-label, html[data-theme="dark"] .db-feed-desc, html[data-theme="dark"] .db-feed-sub,
html[data-theme="dark"] .db-bar-name, html[data-theme="dark"] .db-region-row { color: #8b949e; }
html[data-theme="dark"] .db-tabs { background: #21262d; }
html[data-theme="dark"] .db-tab { color: #8b949e; }
html[data-theme="dark"] .db-tab.active { background: #30363d; color: #e6e6e6; }
html[data-theme="dark"] .db-select { background: #21262d; color: #e6e6e6; border-color: #30363d; }
html[data-theme="dark"] .db-todo-item:hover, html[data-theme="dark"] .db-quick-item:hover { background: #21262d; }
html[data-theme="dark"] .db-region-total { border-color: #30363d; }
html[data-theme="dark"] .db-bar-track { background: #21262d; }
html[data-theme="dark"] .db-chart-svg line { stroke-opacity: .18; }

/* ---- 响应式 ---- */
@media (max-width: 1280px) {
  .db-stats { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .db-main-grid { grid-template-columns: 1fr !important; }
  .db-bottom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 900px) {
  .db-root { padding: 16px; }
  .db-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .db-bottom-grid { grid-template-columns: 1fr !important; }
  .db-welcome { flex-direction: column; align-items: flex-start; gap: 16px; padding: 22px; }
  .db-welcome-center, .db-welcome-right { margin-left: 0; }
  .db-time #dbHour, .db-time #dbMin { font-size: 32px; }
  .db-time-sep { font-size: 28px; }
  .db-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-funnel-wrap { flex-direction: column; }
  .db-region-wrap { flex-direction: column; }
  .db-region-list { width: 100%; flex: 1; }
}

/* ============================================================
   V2 主壳：大气侧栏 + 全站深浅主题
   放在文件末尾覆盖上方的 Element Plus 对齐层，便于整体回滚。
   ============================================================ */
:root {
  --side-bg-a: #0e1d38;
  --side-bg-b: #081326;
  --side-fg: #e9effb;
  --side-muted: #8b9cbb;
  --side-line: rgba(255, 255, 255, .09);
  --side-hover: rgba(255, 255, 255, .07);
  --side-active: rgba(64, 158, 255, .2);
  --side-w: 252px;
  --top-h: 60px;
}

/* ---------------- 全站深色变量 ---------------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --c-bg: #0f1115;
  --c-panel: #161b22;
  --c-side: #0b0e14;
  --c-side-hover: rgba(255, 255, 255, .06);
  --c-side-active: rgba(64, 158, 255, .22);
  --c-line: #30363d;
  --c-text: #e6e6e6;
  --c-text-2: #a9b2c0;
  --c-text-3: #8b949e;
  --c-primary: #409eff;
  --c-primary-dark: #66b1ff;
  --c-primary-soft: rgba(64, 158, 255, .15);
  --c-success: #3fb950;
  --c-warn: #d29922;
  --c-danger: #f85149;
  --shadow: 0 1px 4px rgba(0, 0, 0, .4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .55);
  --side-bg-a: #131a26;
  --side-bg-b: #0a0e15;
  --side-fg: #e6e6e6;
  --side-muted: #8b949e;
  --side-line: rgba(255, 255, 255, .08);
  --side-hover: rgba(255, 255, 255, .06);
  --side-active: rgba(64, 158, 255, .18);
}

/* ---------------- 侧栏：宽体、渐变、品牌区、层级线 ---------------- */
.side {
  position: relative;
  background: linear-gradient(180deg, var(--side-bg-a) 0%, var(--side-bg-b) 100%);
  color: var(--side-fg);
  border-right: 1px solid var(--side-line);
  box-shadow: 2px 0 18px rgba(4, 12, 28, .12);
}
.side::before {
  content: "";
  position: absolute;
  top: -130px; left: -90px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(64, 158, 255, .2), transparent 68%);
  pointer-events: none;
}
.side::after {
  content: "";
  position: absolute;
  right: -120px; bottom: 80px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(109, 92, 255, .12), transparent 70%);
  pointer-events: none;
}
.side > * { position: relative; z-index: 1; }

.side-brand {
  height: 76px;
  flex: 0 0 76px;
  padding: 0 18px;
  gap: 13px;
  border-bottom: 1px solid var(--side-line);
}
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #409eff, #6d5cff);
  box-shadow: 0 6px 18px rgba(64, 158, 255, .38);
  font-size: 13px; font-weight: 700; letter-spacing: .5px;
  color: #fff;
}
.brand-txt { min-width: 0; }
.brand-name {
  font-size: 15.5px; font-weight: 600; color: #fff;
  letter-spacing: .4px; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub {
  display: block;
  font-size: 9.5px; letter-spacing: 1.5px; line-height: 1.5;
  color: var(--side-muted); text-transform: uppercase;
  white-space: nowrap;
}

.side-nav { padding: 12px 12px 24px; }
.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 3px; }

.nav-group-title {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 12px 9px;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 1.8px;
  color: var(--side-muted);
  text-transform: uppercase;
}
.nav-group-title::after { content: ""; flex: 1; height: 1px; background: var(--side-line); }

.nav-item {
  height: 42px;
  padding: 0 12px;
  margin-bottom: 4px;
  gap: 12px;
  border-radius: 9px;
  font-size: 14px; font-weight: 500;
  color: var(--side-fg);
  transition: background .16s, color .16s, transform .16s;
}
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item.active, .nav-item.active:hover {
  background: linear-gradient(90deg, rgba(64, 158, 255, .3), rgba(64, 158, 255, .07));
  color: #fff;
  box-shadow: inset 3px 0 0 #409eff;
}
.nav-item.active .nav-ico { opacity: 1; color: #8cc5ff; }
.nav-ico { width: 19px; height: 19px; flex: 0 0 19px; opacity: .82; }
.nav-text { font-size: inherit; }

.nav-parent { font-weight: 600; color: #fff; }
.nav-parent.nav-parent-active { color: #fff; }
.nav-arrow { opacity: .55; }

.nav-children { position: relative; padding-left: 12px; }
.nav-leaf {
  height: 36px; margin-bottom: 2px;
  border-radius: 8px;
  font-size: 13px; font-weight: 400;
  color: var(--side-muted);
}
.nav-leaf:hover { color: #fff; }
.nav-leaf .nav-ico { width: 15px; height: 15px; flex-basis: 15px; opacity: .72; }
.nav-leaf.active, .nav-leaf.active:hover {
  color: #fff;
  background: linear-gradient(90deg, rgba(64, 158, 255, .28), rgba(64, 158, 255, .06));
  box-shadow: inset 3px 0 0 #409eff;
}
.nav-leaf.active .nav-ico { opacity: 1; color: #8cc5ff; }
.nav-sub-l2 .nav-parent {
  height: 36px; font-size: 13px; font-weight: 500;
  color: var(--side-muted);
}
.nav-sub-sys {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--side-line);
}

/* 侧栏底部账号卡 */
.side-foot { padding: 14px 16px 13px; border-top: 1px solid var(--side-line); background: rgba(0, 0, 0, .12); }
.side-user { display: flex; align-items: center; gap: 11px; }
.side-user-avatar {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #409eff, #6d5cff);
  color: #fff; font-size: 14px; font-weight: 600;
  display: grid; place-items: center;
}
.side-user-txt { min-width: 0; display: flex; flex-direction: column; }
.side-user-txt b { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-txt small { font-size: 11px; color: var(--side-muted); display: flex; align-items: center; gap: 5px; }
.online { width: 6px; height: 6px; border-radius: 50%; background: #3fb950; box-shadow: 0 0 0 2px rgba(63, 185, 80, .18); }
.side-ver { margin-top: 10px; font-size: 10px; letter-spacing: .6px; color: var(--side-muted); opacity: .75; white-space: nowrap; }

/* 折叠态 */
.layout.collapsed .side { width: 72px; flex-basis: 72px; }
.layout.collapsed .side-brand { padding: 0 16px; }
.layout.collapsed .brand-txt,
.layout.collapsed .side-user-txt,
.layout.collapsed .side-ver,
.layout.collapsed .nav-arrow,
.layout.collapsed .nav-group-title::after { display: none; }
.layout.collapsed .side-foot { padding: 14px 18px; }
.layout.collapsed .nav-group-title { visibility: hidden; height: 14px; padding: 0; }
.layout.collapsed .nav-item { padding-left: 22px !important; }
.layout.collapsed .nav-children { display: none !important; }

/* ---------------- 顶栏 ---------------- */
.topbar { height: var(--top-h); flex-basis: var(--top-h); padding: 0 24px; border-bottom-color: var(--c-line); }
.topbar-right { gap: 10px; }
.theme-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--c-line);
  color: var(--c-text-2);
}
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
html[data-theme="dark"] .theme-btn:hover { background: rgba(64, 158, 255, .1); }
html[data-theme="dark"] .theme-btn { color: #e3b341; }
.dropdown { top: 68px; }
.crumb-sep { color: var(--c-text-3); }

/* ---------------- 全站深色：覆盖历史硬编码浅色 ---------------- */
html[data-theme="dark"] body { background: var(--c-bg); }
html[data-theme="dark"] .view-frame { background: #0f1115; }
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat { border-color: var(--c-line); }
html[data-theme="dark"] .card-head,
html[data-theme="dark"] .dd-head,
html[data-theme="dark"] .modal-head,
html[data-theme="dark"] .modal-foot { border-color: var(--c-line); }

html[data-theme="dark"] .icon-btn:hover,
html[data-theme="dark"] .user-chip:hover,
html[data-theme="dark"] .dd-item:hover,
html[data-theme="dark"] .btn-text:hover { background: #21262d; }
html[data-theme="dark"] .btn {
  background: #21262d; color: var(--c-text); border-color: var(--c-line);
}
html[data-theme="dark"] .btn:hover { background: #30363d; border-color: #484f58; }
html[data-theme="dark"] .btn-primary { background: #409eff; border-color: #409eff; color: #fff; }
html[data-theme="dark"] .btn-primary:hover { background: #66b1ff; border-color: #66b1ff; }
html[data-theme="dark"] .btn-danger { background: #b62324; border-color: #b62324; }
html[data-theme="dark"] .btn-text.danger:hover { background: rgba(248, 81, 73, .14); }
html[data-theme="dark"] .input,
html[data-theme="dark"] .select,
html[data-theme="dark"] .textarea {
  background: #0d1117; border-color: var(--c-line); color: var(--c-text);
}
html[data-theme="dark"] .input::placeholder,
html[data-theme="dark"] .textarea::placeholder { color: #6e7681; }
html[data-theme="dark"] .input:focus,
html[data-theme="dark"] .select:focus,
html[data-theme="dark"] .textarea:focus { box-shadow: 0 0 0 3px rgba(64, 158, 255, .22); }

html[data-theme="dark"] table.tb th,
html[data-theme="dark"] .table-wrap { background: #1c2128; }
html[data-theme="dark"] table.tb td { border-bottom-color: var(--c-line); }
html[data-theme="dark"] table.tb tbody tr:hover td { background: #21262d; }
html[data-theme="dark"] .empty-mark { background: #21262d; color: #6e7681; }
html[data-theme="dark"] .tag { background: #30363d; color: var(--c-text-2); }
html[data-theme="dark"] .tag.ok { background: rgba(63, 185, 80, .16); color: #56d364; }
html[data-theme="dark"] .tag.warn { background: rgba(210, 153, 34, .16); color: #e3b341; }
html[data-theme="dark"] .tag.err { background: rgba(248, 81, 73, .16); color: #ff9c95; }
html[data-theme="dark"] .tag.info { background: rgba(64, 158, 255, .16); color: #79c0ff; }

html[data-theme="dark"] .modal,
html[data-theme="dark"] .toast { background: #161b22; border-color: var(--c-line); }
html[data-theme="dark"] .modal-foot { background: #161b22; }
html[data-theme="dark"] .modal-mask { background: rgba(0, 0, 0, .65); }
html[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #21262d 25%, #30363d 37%, #21262d 63%);
  background-size: 400% 100%;
}
html[data-theme="dark"] .hero { background: #131a26; }
html[data-theme="dark"] .mod-card { background: var(--c-panel); border-color: var(--c-line); }
html[data-theme="dark"] .mod-ico { background: var(--c-primary-soft); }

/* 视图里遗留的内联色：深色下统一改成语义色 */
html[data-theme="dark"] [style*="color:#1f2430"],
html[data-theme="dark"] [style*="color:#303133"] { color: var(--c-text) !important; }
html[data-theme="dark"] [style*="color:#5b6478"],
html[data-theme="dark"] [style*="color:#606266"],
html[data-theme="dark"] [style*="color:#8a93a6"],
html[data-theme="dark"] [style*="color:#909399"],
html[data-theme="dark"] [style*="color:#97a0b3"] { color: var(--c-text-2) !important; }
html[data-theme="dark"] [style*="background:#f7f9fc"],
html[data-theme="dark"] [style*="background:#f8fafc"] { background: #21262d !important; }

/* 登录页 */
html[data-theme="dark"] .auth-wrap { background: #0f1115; }
html[data-theme="dark"] .auth-side { background: linear-gradient(160deg, #101f3c, #0a1424); }
html[data-theme="dark"] .auth-brand { background: linear-gradient(135deg, #409eff, #6d5cff); }
html[data-theme="dark"] .auth-err {
  background: rgba(248, 81, 73, .12); color: #ff9c95; border-color: rgba(248, 81, 73, .3);
}

html[data-theme="dark"] .db-bar-fill { filter: brightness(.72); }
html[data-theme="dark"] .db-fn-rate { color: #56d364; }
html[data-theme="dark"] .db-chart-svg text { fill: #8b949e; }
html[data-theme="dark"] .db-chart-svg line { stroke-opacity: .22; }

@media (max-width: 940px) {
  .layout.collapsed .side { width: 0; flex-basis: 0; overflow: hidden; }
}

/* ---------------- 非仪表盘：顶部 header 整条移除，仅 2 个工具按钮并入侧栏底部 ----------------
   由 app.js 的 applyTopbar() 按路由切换 .layout.no-topbar；仅 #/dashboard 保留原顶栏。
   侧栏只留「收起菜单」「切换主题」；刷新与账号留在已隐藏的顶栏里，不显示。 */
.side-tools { display: none; }

.layout.no-topbar .topbar { display: none; }

.layout.no-topbar .side-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  flex: 0 0 auto;
  overflow: hidden;
}

.layout.no-topbar .side-tools .icon-btn {
  color: #cdd5e6;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
}

.layout.no-topbar .side-tools .icon-btn:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.layout.no-topbar .side-tools #themeBtn { margin-left: auto; }

/* 顶栏隐藏后，侧栏原有的账号卡兼作用户菜单入口（个人中心 / 修改密码 / 退出登录） */
.layout.no-topbar .side-foot .side-user {
  cursor: pointer;
  border-radius: 8px;
}
.layout.no-topbar .side-foot .side-user:hover { background: rgba(255, 255, 255, .06); }

.layout.no-topbar .dropdown {
  right: auto;
  left: 10px;
  top: auto;
  bottom: 66px;
}

.layout.no-topbar.collapsed .side-tools { padding: 6px 4px; }

/* API Key 字段：默认隐藏，右侧眼睛切换明文 */
.key-field { position: relative; display: flex; align-items: center; }
.key-field .input { width: 100%; padding-right: 38px; }
.key-eye {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--c-text-3, #8a93a6);
  cursor: pointer;
  border-radius: 6px;
}
.key-eye:hover { color: var(--c-text, #1f2430); background: rgba(125, 125, 125, .12); }
.key-eye svg { display: block; }

/* 百度订单 RSA 密钥：多行 PEM 文本框 + 右上角眼睛 */
.pem-field { align-items: flex-start; }
.pem-field .textarea {
  width: 100%;
  padding-right: 38px;
  font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
}
.pem-eye { top: 6px; transform: none; }

/* ============================================================
   系统管理子页面视觉优化（仅 sys/ 路由带 .sys-scope 时生效）
   作用域隔离：不影响仪表盘、个人中心与 iframe 内的业务系统；
   统一覆盖第 1042 行起「对齐 el-*」的 4px 直角 / Element 蓝皮肤。
   ============================================================ */

/* ---- 页面与标题 ---- */
.sys-scope .page { padding: 24px 26px 48px; }
.sys-scope .page-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--c-line);
}
.sys-scope .page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.4px;
  line-height: 1.35;
}
.sys-scope .page-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 17px;
  margin-right: 10px;
  border-radius: 3px;
  background: var(--c-primary);
  vertical-align: -2px;
}
.sys-scope .page-desc {
  margin: 0 0 0 14px;
  font-size: 13px;
  color: var(--c-text-2);
}

/* ---- 分段 Tab ---- */
.sys-scope .db-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px !important;
  border: 1px solid var(--c-line);
  border-radius: 10px;
  background: #eef2f8;
}
.sys-scope .db-tab {
  height: 34px;
  padding: 0 18px;
  border-radius: 7px;
  font-size: 13.5px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.sys-scope .db-tab:hover:not(.active) {
  background: rgba(255, 255, 255, .65);
  color: var(--c-text);
}
.sys-scope .db-tab.active {
  background: var(--c-panel);
  color: var(--c-primary);
  font-weight: 600;
  box-shadow: 0 1px 5px rgba(16, 24, 40, .10);
}

/* ---- 卡片 ---- */
.sys-scope .card {
  border: 1px solid var(--c-line);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(16, 24, 40, .05);
  overflow: hidden;
}
.sys-scope .card-head {
  padding: 15px 20px;
  background: linear-gradient(180deg, rgba(43, 108, 246, .035), transparent);
}
.sys-scope .card-head h3 { font-size: 15px; font-weight: 600; }
.sys-scope .card-head h3::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--c-primary);
  vertical-align: 2px;
}
.sys-scope .card-body { padding: 20px; }

/* ---- 工具栏（搜索/操作区卡片化） ---- */
.sys-scope .toolbar {
  padding: 12px 16px;
  margin-bottom: 16px;
  gap: 10px;
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(16, 24, 40, .05);
}

/* ---- 按钮（只覆盖尺寸/圆角，保留 primary / danger / text 各自配色） ---- */
.sys-scope .btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.sys-scope .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(16, 24, 40, .09);
}
.sys-scope .btn:disabled { transform: none; box-shadow: none; }
.sys-scope .btn-sm { height: 30px; padding: 0 12px; }
.sys-scope .btn-primary {
  background: var(--c-primary);
  border-color: var(--c-primary);
  box-shadow: 0 2px 7px rgba(43, 108, 246, .22);
}
.sys-scope .btn-primary:hover {
  background: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
}
.sys-scope .btn-text { box-shadow: none; }
.sys-scope .btn-text:hover { transform: none; box-shadow: none; }

/* ---- 表单 ---- */
.sys-scope .field { margin-bottom: 18px; }
.sys-scope .field label {
  margin-bottom: 7px;
  font-weight: 500;
  color: var(--c-text);
}
.sys-scope .form-grid { gap: 0 20px; }
.sys-scope .input,
.sys-scope .select,
.sys-scope .textarea {
  height: 36px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.sys-scope .textarea { height: auto; min-height: 92px; padding: 9px 11px; }
.sys-scope .input:focus,
.sys-scope .select:focus,
.sys-scope .textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(43, 108, 246, .13);
}
.sys-scope .input-sm { height: 32px; }
.sys-scope .field-hint {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--c-text-3);
}
.sys-scope .pem-field .textarea { font-size: 12.5px; }

/* ---- 表格 ---- */
.sys-scope .table-wrap {
  border: 1px solid var(--c-line);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(16, 24, 40, .05);
}
.sys-scope table.tb th {
  padding: 12px 16px;
  background: #f7f9fc;
  color: var(--c-text-2);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .2px;
  border-bottom: 1px solid var(--c-line);
}
.sys-scope table.tb td {
  padding: 13px 16px;
  border-bottom-color: #f1f4f9;
}
.sys-scope table.tb tbody tr:hover td { background: #f5f8ff; }
.sys-scope .tb-actions { gap: 4px; }

/* ---- 标签 / 空态 / 分页 ---- */
.sys-scope .tag {
  height: 23px;
  padding: 0 10px;
  border-radius: 999px;
  font-weight: 500;
}
.sys-scope .empty { padding: 54px 20px; }
.sys-scope .empty-mark {
  width: 48px;
  height: 48px;
  background: var(--c-primary-soft);
  color: var(--c-primary);
}
.sys-scope .empty-mark svg { width: 22px; height: 22px; }
.sys-scope .pager { padding: 14px 2px 0; }

/* ---- 弹窗（全局，仅在门户主壳使用，不影响 iframe） ---- */
.modal-mask { backdrop-filter: blur(2px); }
.modal {
  border: 1px solid var(--c-line);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(16, 24, 40, .18);
}
.modal-head { padding: 16px 20px; }
.modal-head h3 { font-size: 15.5px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; }
.modal-foot .btn {
  height: 34px;
  padding: 0 16px;
  border-radius: 8px;
}

/* ---- 深色适配 ---- */
html[data-theme="dark"] .sys-scope .db-tabs { background: #1c2128; }
html[data-theme="dark"] .sys-scope .db-tab:hover:not(.active) {
  background: rgba(255, 255, 255, .06);
  color: var(--c-text);
}
html[data-theme="dark"] .sys-scope .db-tab.active {
  background: #30363d;
  color: var(--c-primary);
}
html[data-theme="dark"] .sys-scope .card-head { background: rgba(64, 158, 255, .04); }
html[data-theme="dark"] .sys-scope table.tb th { background: #1c2128; }
html[data-theme="dark"] .sys-scope table.tb td { border-bottom-color: #262c34; }
html[data-theme="dark"] .sys-scope table.tb tbody tr:hover td { background: rgba(64, 158, 255, .08); }
html[data-theme="dark"] .sys-scope .empty-mark { background: rgba(64, 158, 255, .14); color: var(--c-primary); }
html[data-theme="dark"] .modal { box-shadow: 0 18px 48px rgba(0, 0, 0, .6); }

/* ---- 窄屏 ---- */
@media (max-width: 900px) {
  .sys-scope .page { padding: 18px 16px 36px; }
  .sys-scope .form-grid { grid-template-columns: 1fr; }
  .sys-scope .db-tabs { display: flex; width: 100%; }
  .sys-scope .db-tab { flex: 1; padding: 0 10px; white-space: nowrap; }
  .sys-scope .toolbar { padding: 10px 12px; }
}
