/* ============================================================
   墩墩集团全域总控中台 DunHub Control Center
   集团 UI 强制规范 100% 落地样式
   - 纯黑 / 纯白双底色，默认深色模式
   - 品牌金 #C9A84C / #E0C878 用于大标题与核心指标
   - 金色细描边卡片
   - 桌面优先，平板/移动端自适应
   ============================================================ */

:root {
  --gold-strong: #C9A84C;
  --gold-soft: #E0C878;
  --gold-line: rgba(201, 168, 76, 0.45);
  --gold-line-strong: rgba(201, 168, 76, 0.75);
  --radius: 12px;
  --sidebar-w: 240px;
  --topbar-h: 60px;
}

/* ---------- 深色模式（默认） ---------- */
[data-theme="dark"] {
  --bg: #000000;
  --bg-panel: #0a0a0a;
  --bg-card: #0d0d0d;
  --bg-hover: #141414;
  --text-main: #ffffff;
  --text-sub: rgba(255, 255, 255, 0.96);
  --text-dim: rgba(255, 255, 255, 0.85);
  --border: rgba(255, 255, 255, 0.10);
  --shadow: rgba(0, 0, 0, 0.55);
  --danger: #e5484d;
  --warning: #E0A84C;
  --ok: #4cd07d;
}

/* ---------- 浅色模式 ---------- */
[data-theme="light"] {
  --bg: #ffffff;
  --bg-panel: #fafaf7;
  --bg-card: #ffffff;
  --bg-hover: #f4f1e6;
  --text-main: #000000;
  --text-sub: rgba(0, 0, 0, 0.92);
  --text-dim: rgba(0, 0, 0, 0.72);
  --border: rgba(0, 0, 0, 0.12);
  --shadow: rgba(0, 0, 0, 0.08);
  --danger: #d33;
  --warning: #b07d1a;
  --ok: #1f9d55;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  font-size: 14px;
  transition: background .3s ease, color .3s ease;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-strong); text-decoration: none; }
a:hover { color: var(--gold-soft); }

/* ---------- 品牌标题 ---------- */
.brand-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(90deg, var(--gold-strong), var(--gold-soft));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-subtitle {
  color: var(--text-sub);
  font-size: 14px;
  letter-spacing: 2px;
}

/* ---------- 金色细描边卡片 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  box-shadow: 0 4px 18px var(--shadow);
  padding: 18px 20px;
  transition: border-color .25s, transform .25s;
}
.card:hover { border-color: var(--gold-line-strong); }
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gold-strong);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  letter-spacing: .5px;
}
.card-title::before {
  content: "";
  width: 4px; height: 16px;
  background: linear-gradient(180deg, var(--gold-strong), var(--gold-soft));
  border-radius: 2px;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--gold-line);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo {
  width: 38px; height: 38px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--gold-line-strong);
  flex-shrink: 0;
}
.topbar-logo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }

/* 月亮/太阳 明暗切换 */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--gold-line);
  background: var(--bg-card);
  color: var(--gold-strong);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  transition: all .25s;
}
.theme-toggle:hover {
  border-color: var(--gold-strong);
  transform: rotate(18deg);
}

/* ---------- 布局框架 ---------- */
.layout { display: flex; height: calc(100vh - var(--topbar-h)); }
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-panel);
  border-right: 1px solid var(--gold-line);
  padding: 16px 12px;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-group {
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin: 16px 8px 8px;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--text-sub);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .2s;
  margin-bottom: 4px;
  font-size: 14px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-main); }
.nav-item.active {
  background: var(--bg-hover);
  color: var(--gold-strong);
  border-color: var(--gold-line);
  font-weight: 600;
}
.nav-item .nav-ico { width: 18px; text-align: center; font-size: 15px; }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 10px;
  color: var(--gold-soft);
  border: 1px solid var(--gold-line);
  border-radius: 10px;
  padding: 1px 7px;
  background: var(--bg-card);
}

.main {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px 30px;
  background: var(--bg);
}
.content-wrap { max-width: 1500px; margin: 0 auto; }

/* ---------- 面包屑 / 返回按钮 ---------- */
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 16px;
}
.crumbs a { color: var(--text-sub); }
.crumbs a:hover { color: var(--gold-strong); }
.crumbs .sep { color: var(--text-dim); }
.crumbs .current { color: var(--gold-strong); font-weight: 600; }
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--gold-line);
  border-radius: 8px;
  padding: 7px 14px;
  color: var(--gold-strong);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 13px;
  transition: all .2s;
}
.back-btn:hover { border-color: var(--gold-strong); background: var(--bg-hover); }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: 1px; }

/* ---------- 核心指标卡片 ---------- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.metric-card { position: relative; overflow: hidden; }
.metric-card .m-label {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.metric-card .m-value {
  font-size: 34px;
  font-weight: 700;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--gold-soft);
  line-height: 1.1;
  letter-spacing: 1px;
}
.metric-card .m-extra { font-size: 14px; color: var(--text-dim); margin-top: 8px; }
.metric-card .m-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warning); }
.dot-danger { background: var(--danger); }
.metric-card::after {
  content: "";
  position: absolute;
  right: -20px; top: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 1px solid var(--gold-line);
  opacity: .35;
}

/* ---------- 面板布局 ---------- */
.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}
.panel-grid.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 1200px) {
  .panel-grid, .panel-grid.three { grid-template-columns: 1fr; }
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  color: var(--text-sub);
  font-weight: 600;
  padding: 10px 10px;
  border-bottom: 1px solid var(--gold-line);
  letter-spacing: .5px;
  white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--bg-hover); }
.t-num { font-family: Consolas, monospace; }
.t-strong { color: var(--gold-soft); font-weight: 600; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  white-space: nowrap;
}
.badge-danger { background: rgba(229, 72, 77, .14); color: var(--danger); border: 1px solid rgba(229,72,77,.4); }
.badge-warn { background: rgba(224, 168, 76, .14); color: var(--warning); border: 1px solid rgba(224,168,76,.4); }
.badge-ok { background: rgba(76, 208, 125, .12); color: var(--ok); border: 1px solid rgba(76,208,125,.4); }
.badge-gold { background: rgba(201, 168, 76, .12); color: var(--gold-strong); border: 1px solid var(--gold-line-strong); }
.badge-dim { background: var(--bg-hover); color: var(--text-sub); border: 1px solid var(--border); }

/* ---------- 告警条 ---------- */
.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  background: var(--bg-card);
}
.alert-item.level-danger { border-color: rgba(229,72,77,.5); }
.alert-item.level-warn { border-color: rgba(224,168,76,.5); }
.alert-item .a-time { margin-left: auto; color: var(--text-dim); font-size: 13px; white-space: nowrap; }
.alert-item .a-title { font-weight: 600; }
.alert-item .a-desc { color: var(--text-sub); font-size: 14px; margin-top: 2px; }

/* ---------- 快捷调度按钮 ---------- */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border-radius: 10px;
  border: 1px solid var(--gold-line);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: all .22s;
  font-size: 13px;
}
.action-btn .a-ico { font-size: 22px; color: var(--gold-strong); }
.action-btn:hover {
  border-color: var(--gold-strong);
  background: var(--bg-hover);
  transform: translateY(-2px);
}
.action-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- 登录页 ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 30%, #101010 0%, #000 75%);
  padding: 20px;
}
[data-theme="light"] .login-body {
  background: radial-gradient(ellipse at 50% 30%, #ffffff 0%, #f0ede2 75%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
}
.login-logo {
  width: 72px; height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold-strong);
  margin: 0 auto 18px;
}
.login-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-title { text-align: center; margin-bottom: 6px; }
.login-sub { text-align: center; margin-bottom: 30px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 14px; color: var(--text-sub); margin-bottom: 6px; letter-spacing: 1px; }
.form-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--gold-line);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.form-input:focus { border-color: var(--gold-strong); }
select.form-input { appearance: auto; cursor: pointer; }
.btn-primary {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--gold-strong);
  background: linear-gradient(135deg, var(--gold-strong), var(--gold-soft));
  color: #000;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all .2s;
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 18px rgba(201,168,76,.3); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.login-foot { text-align: center; color: var(--text-dim); font-size: 14px; margin-top: 22px; }
.role-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.role-opt {
  text-align: center;
  padding: 10px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-sub);
  background: var(--bg-card);
  transition: all .2s;
}
.role-opt:hover { border-color: var(--gold-line-strong); }
.role-opt.sel { border-color: var(--gold-strong); color: var(--gold-strong); background: var(--bg-hover); font-weight: 600; }
@media (max-width: 480px) { .role-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 工具按钮 ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.btn-ghost {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--gold-line);
  background: var(--bg-card);
  color: var(--gold-strong);
  cursor: pointer;
  font-size: 13px;
  transition: all .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-ghost:hover { border-color: var(--gold-strong); background: var(--bg-hover); }
.btn-ghost:disabled { opacity: .5; cursor: wait; }
.refresh-hint { color: var(--text-dim); font-size: 14px; display: flex; align-items: center; gap: 8px; }

/* ---------- 占位页 ---------- */
.placeholder-box {
  border: 1px dashed var(--gold-line-strong);
  border-radius: var(--radius);
  padding: 60px 30px;
  text-align: center;
  background: var(--bg-card);
}
.placeholder-box .p-ico { font-size: 52px; margin-bottom: 16px; }
.placeholder-box h2 { font-size: 22px; margin-bottom: 10px; }
.placeholder-box p { color: var(--text-sub); max-width: 620px; margin: 0 auto 8px; }
.func-list { text-align: left; max-width: 720px; margin: 24px auto 0; }
.func-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); color: var(--text-sub); display: flex; gap: 8px; }
.func-list li b { color: var(--gold-strong); font-weight: 600; min-width: 110px; }
.beta-tag {
  display: inline-block;
  padding: 3px 14px;
  border-radius: 14px;
  border: 1px solid var(--gold-line-strong);
  color: var(--gold-strong);
  font-size: 14px;
  letter-spacing: 2px;
  margin-top: 18px;
}

/* ---------- 空状态 / 加载 ---------- */
.empty-tip { color: var(--text-dim); text-align: center; padding: 18px 0; font-size: 13px; }
.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  height: 14px;
  margin: 6px 0;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: var(--topbar-h);
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .3s;
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 16px 14px 24px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .hamburger { display: inline-flex !important; }
}
.hamburger {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--gold-line);
  background: var(--bg-card);
  color: var(--gold-strong);
  cursor: pointer;
  font-size: 18px;
}
@media (max-width: 560px) {
  .metric-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 21px; }
}
.sidebar-mask {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 85;
}
.sidebar-mask.show { display: block; }

/* ---------- 浅色模式强制白底覆盖（修复卡片残留黑底） ---------- */
[data-theme= light\] .card,
[data-theme=\light\] .metric-card,
[data-theme=\light\] .panel-box,
[data-theme=\light\] .alert-item,
[data-theme=\light\] .action-btn,
[data-theme=\light\] .btn-ghost,
[data-theme=\light\] .form-input,
[data-theme=\light\] .theme-toggle,
[data-theme=\light\] .role-opt,
[data-theme=\light\] .nav-item,
[data-theme=\light\] .nav-item.active {
 background: #ffffff !important;
 color: #000000 !important;
}
[data-theme=\light\] .card-title,
[data-theme=\light\] .action-btn .a-ico,
[data-theme=\light\] .theme-toggle {
 color: #C9A84C !important;
}
[data-theme=\light\] .nav-item.active {
 background: #f4f1e6 !important;
 color: #C9A84C !important;
}
[data-theme=\light\] .badge-dim {
 background: #f4f1e6 !important;
 color: #333 !important;
}

/* 浅色模式侧边栏/顶部栏/主区域强制白底黑字 */
[data-theme= light\] .sidebar,
[data-theme=\light\] .topbar,
[data-theme=\light\] .main {
 background: #ffffff !important;
 color: #000000 !important;
}
[data-theme=\light\] .sidebar-group,
[data-theme=\light\] .nav-item,
[data-theme=\light\] .crumbs,
[data-theme=\light\] .brand-subtitle,
[data-theme=\light\] #userInfo,
[data-theme=\light\] .refresh-hint,
[data-theme=\light\] .m-label,
[data-theme=\light\] .m-extra,
[data-theme=\light\] th,
[data-theme=\light\] td {
 color: #000000 !important;
}
[data-theme=\light\] .nav-item {
 background: #ffffff !important;
}
[data-theme=\light\] .nav-item:hover {
 background: #f4f1e6 !important;
}
[data-theme=\light\] .nav-item.active {
 background: #f4f1e6 !important;
 color: #C9A84C !important;
}
