/* ============================================================
 * PVE 管理网关 — 自定义样式
 * 基于 Element Plus 浅色主题
 * ============================================================ */
:root {
  --pve-primary: #1d4ed8;
  --pve-primary-light: #eff6ff;
  --pve-sidebar: #0f172a;
  --pve-sidebar-light: #1e293b;
  --pve-bg: #f1f5f9;
  --pve-border: #e2e8f0;
  --pve-text: #0f172a;
  --pve-muted: #64748b;
  --el-color-primary: #1d4ed8;
  --el-color-primary-light-3: #4e77e2;
  --el-color-primary-light-5: #81a0ea;
  --el-color-primary-light-7: #b3c7f3;
  --el-color-primary-light-8: #cbd9f7;
  --el-color-primary-light-9: #e5ecfb;
  --el-color-primary-dark-2: #173eb0;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; padding: 0; }
body {
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  background: var(--pve-bg);
  color: var(--pve-text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 启动屏 ---------- */
.boot-screen { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--pve-muted); gap: 16px; }
.boot-spinner { width: 36px; height: 36px; border: 3px solid #dbe3ee; border-top-color: var(--pve-primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(29,78,216,.13), transparent 45%),
    radial-gradient(ellipse at 85% 85%, rgba(14,165,233,.12), transparent 40%),
    linear-gradient(135deg, #f8fafc 0%, #eef2f9 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 440px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(15,23,42,.10), 0 2px 8px rgba(15,23,42,.05);
  padding: 40px 40px 32px;
  border: 1px solid #e8edf5;
}
.login-logo {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(29,78,216,.28);
  margin-bottom: 20px;
}
.login-title { font-size: 24px; font-weight: 700; letter-spacing: -.5px; margin: 0 0 6px; }
.login-subtitle { color: var(--pve-muted); font-size: 13px; margin: 0 0 6px; }
.login-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--pve-primary-light); color: var(--pve-primary);
  padding: 5px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
  margin-bottom: 26px;
}
.login-tabs { margin-bottom: 22px; }
.login-footer {
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--pve-border);
  text-align: center; font-size: 12px; color: #94a3b8; line-height: 1.8;
}
.login-hint { margin-top: 16px; padding: 10px 12px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 6px; font-size: 12px; color: #64748b; }
.login-hint code { color: var(--pve-primary); font-weight: 600; }

/* ---------- 主布局 ---------- */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--pve-sidebar);
  display: flex; flex-direction: column;
  transition: width .25s;
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }
.sidebar-brand {
  height: 60px; display: flex; align-items: center; gap: 11px;
  padding: 0 18px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07);
  white-space: nowrap; flex-shrink: 0;
}
.sidebar-brand .brand-icon {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}
.sidebar-brand .brand-text { font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.sidebar.collapsed .brand-text { display: none; }
.sidebar-menu { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 0; }
.sidebar-menu::-webkit-scrollbar { width: 0; }
.sidebar-group-title {
  padding: 16px 20px 6px; font-size: 11px; font-weight: 600;
  color: #64748b; text-transform: uppercase; letter-spacing: .8px; white-space: nowrap;
}
.sidebar.collapsed .sidebar-group-title { text-align: center; padding: 14px 0 4px; font-size: 0; }
.sidebar.collapsed .sidebar-group-title::after { content: '·'; font-size: 18px; }
.menu-item {
  display: flex; align-items: center; gap: 11px;
  height: 40px; margin: 2px 10px; padding: 0 12px;
  border-radius: 7px; color: #cbd5e1; cursor: pointer;
  font-size: 13.5px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.menu-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu-item.active { background: var(--pve-primary); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(29,78,216,.35); }
.menu-item .el-icon { font-size: 16px; flex-shrink: 0; }
.sidebar.collapsed .menu-item { justify-content: center; padding: 0; margin: 2px 8px; }
.sidebar.collapsed .menu-item span { display: none; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.07); padding: 12px 10px; flex-shrink: 0; }
.sidebar-status { display: flex; align-items: center; gap: 8px; padding: 8px 10px; color: #94a3b8; font-size: 12px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.ok { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.dot.warn { background: #f59e0b; }
.dot.err { background: #ef4444; }
.sidebar.collapsed .sidebar-status span { display: none; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; flex-shrink: 0; background: #fff;
  border-bottom: 1px solid var(--pve-border);
  display: flex; align-items: center; padding: 0 22px; gap: 16px;
}
.topbar-toggle { font-size: 19px; cursor: pointer; color: #475569; }
.crumb { color: #94a3b8; font-size: 13px; }
.crumb strong { color: var(--pve-text); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-icon { font-size: 18px; color: #64748b; cursor: pointer; padding: 6px; border-radius: 6px; }
.topbar-icon:hover { background: #f1f5f9; }
.user-chip { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #1d4ed8, #60a5fa);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.user-name { font-size: 13px; font-weight: 600; }
.content { flex: 1; overflow-y: auto; padding: 22px 24px 40px; }

/* ---------- 页面通用 ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.page-title { font-size: 21px; font-weight: 700; margin: 0 0 5px; letter-spacing: -.3px; }
.page-desc { color: var(--pve-muted); font-size: 13px; margin: 0; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border: 1px solid var(--pve-border); border-radius: 10px;
  padding: 18px 20px; display: flex; align-items: center; gap: 16px;
  box-shadow: 0 1px 3px rgba(15,23,42,.03);
}
.stat-icon { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: #ecfdf5; color: #059669; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon.red { background: #fef2f2; color: #dc2626; }
.stat-label { color: var(--pve-muted); font-size: 12.5px; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -.5px; }
.stat-trend { font-size: 11.5px; color: #94a3b8; margin-top: 4px; }

.card {
  background: #fff; border: 1px solid var(--pve-border);
  border-radius: 10px; box-shadow: 0 1px 3px rgba(15,23,42,.03);
  margin-bottom: 18px;
}
.card-head {
  padding: 15px 20px; border-bottom: 1px solid var(--pve-border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: 15px; font-weight: 650; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px 20px; }
.card-body.flush { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

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

/* ---------- 表格增强 ---------- */
.el-table { font-size: 13px; }
.el-table th.el-table__cell { background: #f8fafc !important; color: #475569; font-weight: 600; }
.el-table .cell { padding-left: 12px; padding-right: 12px; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px; }
.link { color: var(--pve-primary); cursor: pointer; font-weight: 600; }
.link:hover { text-decoration: underline; }
.muted { color: #94a3b8; }
.tag-ip { font-family: monospace; font-size: 12px; background: #f1f5f9; padding: 2px 7px; border-radius: 4px; color: #334155; }

/* ---------- 详情描述列表 ---------- */
.desc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0; }
.desc-item { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; }
.desc-item .k { color: #94a3b8; font-size: 12px; margin-bottom: 5px; }
.desc-item .v { font-size: 13.5px; font-weight: 550; word-break: break-all; }

/* ---------- 图表 (纯 CSS/SVG) ---------- */
.chart-bars { display: flex; align-items: flex-end; height: 190px; gap: 6px; padding-top: 10px; }
.chart-bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.chart-bar { width: 100%; max-width: 26px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #3b82f6, #1d4ed8); min-height: 2px; transition: height .4s; position: relative; }
.chart-bar:hover { filter: brightness(1.1); }
.chart-bar-label { font-size: 10px; color: #94a3b8; white-space: nowrap; }
.gauge-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; }
.gauge-track { flex: 1; height: 9px; background: #eef2f7; border-radius: 5px; overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #3b82f6, #1d4ed8); }
.gauge-label { font-size: 12.5px; color: #475569; width: 80px; flex-shrink: 0; }
.gauge-val { font-size: 12.5px; font-weight: 650; width: 52px; text-align: right; }

/* 时间线 */
.timeline-item { display: flex; gap: 12px; padding: 0 0 18px; }
.timeline-dot { width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; margin-top: 5px; flex-shrink: 0; box-shadow: 0 0 0 3px #f1f5f9; }
.timeline-dot.ok { background: #22c55e; }
.timeline-dot.err { background: #ef4444; }
.timeline-dot.warn { background: #f59e0b; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-title { font-size: 13px; font-weight: 550; }
.timeline-sub { font-size: 11.5px; color: #94a3b8; margin-top: 3px; }

/* VNC 控制台模拟 */
.vnc-screen { background: #0b1120; border-radius: 8px; padding: 14px; font-family: monospace; color: #a5f3fc; font-size: 12.5px; line-height: 1.9; min-height: 320px; overflow: auto; }
.vnc-screen .prompt { color: #4ade80; }
.vnc-screen .dim { color: #64748b; }
.vnc-bar { display: flex; align-items: center; gap: 8px; background: #1e293b; color: #cbd5e1; padding: 8px 14px; border-radius: 8px 8px 0 0; font-size: 12px; }

/* API 文档 */
.api-group { margin-bottom: 18px; }
.api-ep { border: 1px solid var(--pve-border); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.api-ep-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; background: #fff; }
.api-ep-head:hover { background: #f8fafc; }
.method { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 4px; min-width: 52px; text-align: center; }
.method.GET { background: #dbeafe; color: #1d4ed8; }
.method.POST { background: #dcfce7; color: #15803d; }
.method.PUT { background: #fef3c7; color: #b45309; }
.method.DELETE { background: #fee2e2; color: #b91c1c; }
.method.PATCH { background: #f3e8ff; color: #7e22ce; }
.api-path { font-family: monospace; font-size: 13px; font-weight: 600; }
.api-summary { color: #64748b; font-size: 12.5px; margin-left: auto; }
.api-ep-body { padding: 14px 16px; border-top: 1px solid var(--pve-border); background: #fafbfc; font-size: 13px; }
.api-ep-body pre { background: #0f172a; color: #a5f3fc; padding: 12px; border-radius: 6px; overflow: auto; font-size: 11.5px; margin: 8px 0 0; }

/* 空状态 / 小组件 */
.empty-hint { text-align: center; color: #94a3b8; padding: 30px; font-size: 13px; }
.kv-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.code-block { background: #f8fafc; border: 1px solid var(--pve-border); border-radius: 6px; padding: 12px 14px; font-family: monospace; font-size: 12px; color: #334155; word-break: break-all; }

/* 登录页响应式 */
@media (max-width: 600px) {
  .login-card { padding: 28px 22px; }
  .sidebar { width: 64px; }
  .sidebar .brand-text, .sidebar .menu-item span, .sidebar .sidebar-group-title, .sidebar .sidebar-status span { display: none; }
  .content { padding: 16px; }
}

/* ---------- 双因子认证 ---------- */
.otp-step { padding-top: 4px; }
.otp-back { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #64748b; cursor: pointer; margin-bottom: 16px; }
.otp-back:hover { color: var(--pve-primary); }
.otp-shield {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 14px;
  background: var(--pve-primary-light); color: var(--pve-primary);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.otp-title { text-align: center; font-size: 19px; margin: 0 0 8px; font-weight: 700; }
.otp-desc { text-align: center; color: #64748b; font-size: 12.5px; line-height: 1.7; margin: 0 0 20px; }
.otp-timer { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: #64748b; }

.sec-hero { display: flex; align-items: center; gap: 18px; }
.sec-icon { width: 60px; height: 60px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 28px; flex: 0 0 auto; }
.sec-icon.on { background: #ecfdf5; color: #059669; }
.sec-icon.off { background: #f1f5f9; color: #94a3b8; }
.sec-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.sec-sub { font-size: 12.5px; color: #64748b; margin: 0; line-height: 1.7; }
.sec-stat { display: flex; flex-direction: column; gap: 14px; }
.sec-stat-item { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding-bottom: 12px; border-bottom: 1px solid var(--pve-border); }
.sec-stat-item:last-child { border-bottom: 0; padding-bottom: 0; }
.sec-stat-item .k { color: #64748b; }
.sec-stat-item .v { font-weight: 600; }
.qr-wrap { display: flex; align-items: flex-start; justify-content: center; gap: 24px; padding: 8px 0 4px; }
.qr-box { padding: 12px; background: #fff; border: 1px solid var(--pve-border); border-radius: 10px; line-height: 0; flex: 0 0 auto; }
.qr-side { flex: 1; min-width: 0; }
.qr-side h4 { font-size: 13px; margin: 0 0 8px; }
.qr-side ol { margin: 0; padding-left: 18px; color: #475569; font-size: 12.5px; line-height: 1.9; }
.secret-box { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.secret-key { flex: 1; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 6px; padding: 9px 10px; font-family: monospace; font-size: 12px; letter-spacing: 1px; word-break: break-all; color: #0f172a; }
.backup-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.backup-code { background: #f8fafc; border: 1px solid var(--pve-border); border-radius: 6px; padding: 9px 12px; font-family: monospace; font-size: 13px; letter-spacing: 1.5px; text-align: center; color: #0f172a; }
.sec-warn { font-size: 12px; color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 10px 12px; line-height: 1.7; }
@media (max-width: 1100px) { .qr-wrap { flex-direction: column; align-items: center; } .qr-side { width: 100%; } }
