/* ============================================================
   飞投总后台 · 基础样式（设计令牌 / 布局 / 登录 / 侧栏 / 顶栏）
   浅色主题：侧栏 #111827 · 内容 #F5F7FB · 主色 #4F46E5
   ============================================================ */
:root {
  --sidebar-bg: #111827;
  --sidebar-bg2: #0F172A;
  --sidebar-text: #9CA3AF;
  --sidebar-text-active: #FFFFFF;
  --sidebar-w: 232px;
  --sidebar-w-mini: 68px;
  --topbar-h: 56px;

  --bg: #F5F7FB;
  --card: #FFFFFF;
  --line: #E5E7EB;
  --line-2: #EEF0F4;
  --text: #111827;
  --text-2: #4B5563;
  --text-3: #6B7280;
  --muted: #9CA3AF;

  --primary: #4F46E5;
  --primary-2: #6366F1;
  --primary-700: #4338CA;
  --primary-soft: #EEF2FF;
  --primary-ring: rgba(79, 70, 229, .22);

  --success: #16A34A; --success-soft: #DCFCE7;
  --warn: #D97706;    --warn-soft: #FEF3C7;
  --danger: #DC2626;  --danger-soft: #FEE2E2;
  --info: #0284C7;    --info-soft: #E0F2FE;
  --purple: #7C3AED;  --purple-soft: #EDE9FE;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 4px 16px rgba(17, 24, 39, .06);
  --shadow-lg: 0 10px 40px rgba(17, 24, 39, .16);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
::selection { background: var(--primary-soft); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.pos { color: var(--success); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }
.zero { color: var(--text-3); }
.flex { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1 1 auto; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.w100 { width: 100%; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }
.sidebar ::-webkit-scrollbar-thumb { background: #374151; background-clip: padding-box; border: 2px solid transparent; }

/* ---------- 顶部加载条 ---------- */
.loading-bar { position: fixed; left: 0; top: 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--primary), #A78BFA); z-index: 9999; opacity: 0; transition: width .3s var(--ease), opacity .3s; }
.loading-bar.on { opacity: 1; }

/* ============================================================
   登录页
   ============================================================ */
.login-view { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #EEF2FF 0%, #F5F7FB 50%, #ECFEFF 100%); overflow: hidden; }
.login-bg i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: float 14s ease-in-out infinite; }
.login-bg i:nth-child(1) { width: 420px; height: 420px; background: #C7D2FE; left: -120px; top: -120px; }
.login-bg i:nth-child(2) { width: 360px; height: 360px; background: #A5F3FC; right: -100px; bottom: -120px; animation-delay: -5s; }
.login-bg i:nth-child(3) { width: 260px; height: 260px; background: #DDD6FE; right: 20%; top: 10%; animation-delay: -9s; }
@keyframes float { 0%, 100% { transform: translate(0, 0) } 50% { transform: translate(24px, -30px) } }
.login-card { position: relative; width: 400px; padding: 36px 36px 28px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop-in .45s var(--ease) both; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-logo b { display: block; font-size: 20px; }
.login-logo span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.login-card .field { display: block; margin-bottom: 14px; }
.login-card .field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.captcha-row { display: flex; gap: 10px; }
.captcha-row input { flex: 1; }
.captcha-box { width: 130px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #F9FAFB; padding: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; transition: box-shadow .2s; }
.captcha-box:hover { box-shadow: 0 0 0 3px var(--primary-ring); }
.captcha-box svg { width: 100%; height: 100%; }
.login-err { min-height: 20px; font-size: 13px; color: var(--danger); margin: 2px 0 8px; }
.login-foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted); }

/* ============================================================
   应用壳：侧栏 + 主区
   ============================================================ */
.app { display: flex; height: 100vh; width: 100vw; }
.sidebar { width: var(--sidebar-w); flex: 0 0 auto; background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%); color: var(--sidebar-text); display: flex; flex-direction: column; transition: width .25s var(--ease); overflow: hidden; }
.brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 16px; border-bottom: 1px solid rgba(255,255,255,.06); white-space: nowrap; }
.brand-text b { display: block; color: #fff; font-size: 15px; line-height: 1.2; }
.brand-text span { display: block; font-size: 11px; color: #6B7280; margin-top: 2px; }
.menu { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.menu-group { margin-bottom: 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--sidebar-text); white-space: nowrap; cursor: pointer; user-select: none; transition: background .15s, color .15s, transform .15s; position: relative; }
.menu-item:hover { background: rgba(255,255,255,.06); color: #E5E7EB; }
.menu-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.35); }
.menu-item svg { width: 18px; height: 18px; flex: 0 0 18px; }
.menu-item .arrow { margin-left: auto; transition: transform .2s; opacity: .6; }
.menu-group.open > .menu-item .arrow { transform: rotate(180deg); }
.menu-sub { overflow: hidden; max-height: 0; transition: max-height .25s var(--ease); }
.menu-group.open > .menu-sub { max-height: 400px; }
.menu-sub .menu-item { padding-left: 40px; font-size: 13px; border-radius: 8px; }
.menu-sub .menu-item.active { background: rgba(79,70,229,.25); color: #fff; box-shadow: none; }
.menu-sub .menu-item.active::before { content: ""; position: absolute; left: 24px; top: 50%; width: 6px; height: 6px; border-radius: 50%; background: #A5B4FC; transform: translateY(-50%); }
.sidebar-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.06); }
.engine-pill { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #9CA3AF; white-space: nowrap; }
.engine-pill i { width: 8px; height: 8px; border-radius: 50%; background: #6B7280; flex: 0 0 8px; }
.engine-pill.ok i { background: #22C55E; box-shadow: 0 0 0 4px rgba(34,197,94,.2); animation: pulse 2s infinite; }
.engine-pill.bad i { background: #EF4444; box-shadow: 0 0 0 4px rgba(239,68,68,.2); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,.15) } 50% { box-shadow: 0 0 0 6px rgba(34,197,94,.05) } }

/* 收起态 */
.app.mini .sidebar { width: var(--sidebar-w-mini); }
.app.mini .brand-text, .app.mini .menu-item span, .app.mini .menu-item .arrow, .app.mini .engine-pill span { display: none; }
.app.mini .menu-item { justify-content: center; padding: 11px 0; }
.app.mini .menu-sub { display: none; }
.app.mini .brand { justify-content: center; padding: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 0 20px 0 12px; background: #fff; border-bottom: 1px solid var(--line); }
.icon-btn { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); transition: background .15s, transform .15s; }
.icon-btn:hover { background: var(--bg); }
.icon-btn:active { transform: scale(.92); }
.crumb { font-weight: 600; font-size: 15px; }
.crumb small { color: var(--muted); font-weight: 400; margin-left: 8px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.clock { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); }
.user-chip { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer; transition: background .15s; }
.user-chip:hover { background: var(--bg); }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #A78BFA); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.user-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 140px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transition: all .18s var(--ease); z-index: 50; }
.user-chip.open .user-menu { opacity: 1; visibility: visible; transform: none; }
.user-menu a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--text); font-size: 13px; }
.user-menu a:hover { background: var(--bg); color: var(--primary); }

.content { flex: 1; overflow: auto; padding: 20px 24px 40px; min-width: 0; }
.page { animation: page-in .3s var(--ease) both; min-width: 0; }
button svg { flex: 0 0 auto; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.98) } to { opacity: 1; transform: none } }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
