/* ============================================================
 * 公共样式：设计变量 / 毛玻璃 / 按钮 / 表单 / 弹窗 / Toast
 * 字体：系统默认栈，零外部字体请求（离线约束）
 * ============================================================ */
:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.55);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: #f1f5f9;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }


/* 移动端顶栏：横向滚动 + 不换行，避免中文字被压成竖排 */
@media (max-width: 720px) {
  .topbar {
    padding: 8px 10px; gap: 8px; flex-wrap: nowrap;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none;
  }
  .topbar::-webkit-scrollbar { display: none; }
  .topbar .brand { flex: none; font-size: 16px; }
  .topbar .brand-text { display: none; }
  .topbar nav { flex-wrap: nowrap; gap: 2px; min-width: 0; }
  .topbar .nav-link {
    flex: none; white-space: nowrap;
    font-size: 12.5px; padding: 6px 7px;
  }
}

/* ---------- 毛玻璃 ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.topbar .brand {
  font-size: 19px; font-weight: 700; color: var(--text); text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.topbar .brand:hover { text-decoration: none; }
.topbar .spacer { flex: 1; }
.topbar nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  padding: 7px 14px; border-radius: 8px; color: var(--text-light);
  font-size: 14px; transition: all 0.2s ease;
}
.nav-link:hover { background: rgba(37, 99, 235, 0.08); color: var(--primary); text-decoration: none; }
.nav-link.active { background: rgba(37, 99, 235, 0.12); color: var(--primary); font-weight: 600; }

/* ---------- 图标（内嵌 SVG，无图标库） ---------- */
.icon {
  width: 18px; height: 18px; flex: none; vertical-align: -3px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border: 1px solid transparent; border-radius: 8px;
  font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: all 0.18s ease; background: #fff; color: var(--text);
  border-color: var(--border);
}
.btn:hover { background: #f8fafc; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-light); }
.btn-ghost:hover { background: rgba(0, 0, 0, 0.06); }

/* ---------- 表单 ---------- */
.input, .select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  background: #fff; color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 5px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.checkline input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------- FOUC 防闪：Vue 挂载前隐藏整个应用根 ----------
   原理：Vue 官方 v-cloak 指令——编译后 v-cloak 属性被移除，元素恢复显示。
   若 JS 失败（v-cloak 永不消失），noscript 兜底提示用户。 */
[v-cloak] { display: none !important; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.18s ease;
}
.modal {
  width: 100%; max-width: 520px; max-height: 88vh; overflow: auto;
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  animation: popIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-size: 16px; font-weight: 600;
}
.modal-body { padding: 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}
.x-btn { background: none; border: none; cursor: pointer; color: var(--text-light); padding: 4px; border-radius: 6px; }
.x-btn:hover { background: rgba(0, 0, 0, 0.06); color: var(--text); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px);
  z-index: 200; padding: 10px 22px; border-radius: 10px;
  background: #1f2937; color: #fff; font-size: 14px;
  opacity: 0; transition: all 0.3s ease; pointer-events: none;
  box-shadow: var(--shadow-lg); max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
/* 带操作按钮的 Toast（如删除后的「撤销」）：允许点击，横向排列 */
.toast.has-action {
  display: flex; align-items: center; gap: 14px;
  pointer-events: auto;
}
.toast-action {
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.14);
  color: #fff; font: inherit; font-size: 13px;
  padding: 4px 12px; border-radius: 999px; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex: none;
}
.toast-action:hover { background: rgba(255, 255, 255, 0.26); border-color: rgba(255, 255, 255, 0.55); }
.toast-action:active { transform: translateY(1px); }

/* ---------- 通用块 ---------- */
.card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 7px; }
.muted { color: var(--text-light); font-size: 13px; }
.empty {
  text-align: center; color: var(--text-light); padding: 60px 0; font-size: 14px;
}
.empty .icon { width: 44px; height: 44px; opacity: 0.35; }

/* ---------- 通用图标块（favicon 组件渲染容器，无底色方块） ---------- */
.bm-icon {
  display: inline-block; overflow: hidden; border-radius: 22%;
  background: transparent; flex: none; position: relative;
}
.bm-icon img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 22%; }
.bm-icon.neutral img { opacity: 0.75; }
/* 文字图标（txt:阿里|#ff6a00）：完全离线，适合没有 favicon 的内网应用 */
.bm-icon.txt {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; line-height: 1; letter-spacing: 0.5px;
  text-align: center; user-select: none;
}

/* ---------- 动画 ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.94) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }


/* 深色顶栏：与深色首页统一，内页内容区保持浅色，减少页面切换的割裂感 */
.topbar {
  background: rgba(15, 23, 42, 0.86);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.12);
}
.topbar .brand { color: #ffffff; }
.topbar .nav-link { color: rgba(255, 255, 255, 0.7); }
.topbar .nav-link:hover { background: rgba(255, 255, 255, 0.1); color: #ffffff; }
.topbar .nav-link.active { background: rgba(255, 255, 255, 0.16); color: #ffffff; }
