/* =========================================================
   Covect UI · base
   ========================================================= */

:root {
  --bg: #08070f;
  --bg-soft: #0b0a15;
  --panel: linear-gradient(180deg, rgba(26, 22, 45, 0.93), rgba(15, 13, 27, 0.95));
  --panel-flat: #12101f;
  --panel-2: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #ece9f7;
  --text-2: #a6a1bb;
  --text-3: #726d88;
  --accent: #8b5cf6;
  --accent-2: #6d28d9;
  --accent-text: #c4b5fd;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --success: #3ddc97;
  --success-soft: rgba(61, 220, 151, 0.12);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --radius: 16px;
  --shadow-card: 0 30px 70px -50px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  --shadow-pop: 0 30px 70px -24px rgba(0, 0, 0, 0.75);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f1fb;
  --bg-soft: #efeaf9;
  --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82));
  --panel-flat: #ffffff;
  --panel-2: rgba(24, 18, 54, 0.03);
  --line: rgba(24, 18, 54, 0.09);
  --line-2: rgba(24, 18, 54, 0.16);
  --text: #171226;
  --text-2: #5c5673;
  --text-3: #6f6884;
  --accent: #6d3df5;
  --accent-2: #5b21b6;
  --accent-text: #6d3df5;
  --accent-soft: rgba(109, 61, 245, 0.09);
  --success: #0f9f6e;
  --success-soft: rgba(15, 159, 110, 0.1);
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.09);
  --shadow-card: 0 24px 60px -46px rgba(40, 28, 90, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --shadow-pop: 0 30px 70px -24px rgba(45, 30, 100, 0.25);
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.nav-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

input, textarea { font: inherit; }

h1, h2, h3, h4, p, dl, dd, dt, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

svg { display: block; }

::selection { background: rgba(139, 92, 246, 0.35); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(140, 130, 175, 0.28);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(140, 130, 175, 0.45); background-clip: content-box; }

:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.7);
  outline-offset: 2px;
}

.ico { width: 16px; height: 16px; flex: none; }

/* 首屏加载占位 */
.boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60vh;
  color: var(--text-3);
  font-size: 11px;
}
.boot-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(150deg, #8b5cf6, #4c1d95);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 16px 34px -18px rgba(124, 58, 237, 1);
}

/* ---------- background aura ---------- */
.bg-aura {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1000px 620px at 8% -10%, rgba(124, 58, 237, 0.3), transparent 66%),
    radial-gradient(820px 560px at 104% 2%, rgba(59, 130, 246, 0.12), transparent 70%),
    radial-gradient(1200px 760px at 52% 116%, rgba(109, 40, 217, 0.2), transparent 72%),
    radial-gradient(600px 500px at 50% 40%, rgba(76, 29, 149, 0.08), transparent 70%);
  transition: opacity 0.3s ease;
}
[data-theme="light"] .bg-aura { opacity: 0.5; }

/* ---------- layout ---------- */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  min-height: 100vh;
}

.main { min-width: 0; display: flex; flex-direction: column; }

.view {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 26px 30px 56px;
  outline: none;
}

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 13px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13, 11, 24, 0.92), rgba(9, 8, 16, 0.88));
  overflow-y: auto;
  overflow-x: hidden;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  z-index: 50;
}
[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 245, 255, 0.86));
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 7px 18px;
}
.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: radial-gradient(circle at 32% 26%, #bda6ff, #7c3aed 56%, #4c1d95 100%);
  box-shadow:
    0 0 0 1px rgba(196, 181, 253, 0.32),
    0 0 24px rgba(124, 58, 237, 0.55),
    inset 0 1px 2px rgba(255, 255, 255, 0.45);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(167, 139, 250, 0.22);
}
.brand-text strong {
  display: block;
  font-size: 17.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.brand-text small {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  letter-spacing: 0.09em;
  color: var(--text-3);
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  margin: 6px 11px 7px;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-2);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.nav-item .ico { width: 15px; height: 15px; color: var(--text-3); transition: color 0.18s ease; }
.nav-item:hover { background: rgba(255, 255, 255, 0.045); color: var(--text); }
[data-theme="light"] .nav-item:hover { background: rgba(24, 18, 54, 0.04); }
.nav-item:hover .ico { color: var(--text-2); }
.nav-arrow {
  margin-left: auto;
  width: 13px;
  height: 13px;
  opacity: 0;
  transform: translateX(-3px);
  transition: 0.18s ease;
}
.nav-item.is-active {
  color: #fff;
  background: linear-gradient(96deg, rgba(139, 92, 246, 0.96), rgba(101, 53, 207, 0.9));
  border-color: rgba(196, 181, 253, 0.2);
  box-shadow: 0 10px 26px -14px rgba(124, 58, 237, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.nav-item.is-active .ico { color: #fff; }
.nav-item.is-active .nav-arrow { opacity: 1; transform: none; }

.side-card {
  position: relative;
  margin-top: auto;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(139, 92, 246, 0.2), transparent 62%),
    linear-gradient(165deg, rgba(139, 92, 246, 0.09), rgba(18, 15, 33, 0.5));
}
[data-theme="light"] .side-card {
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(139, 92, 246, 0.16), transparent 62%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.9), rgba(245, 241, 255, 0.9));
}
.side-card::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -46px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.35), transparent 68%);
  pointer-events: none;
}
.side-card-ico {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-bottom: 9px;
  border-radius: 8px;
  color: #e9e2ff;
  background: linear-gradient(150deg, rgba(139, 92, 246, 0.95), rgba(76, 29, 149, 0.95));
  box-shadow: 0 6px 16px -8px rgba(124, 58, 237, 0.9);
}
.side-card-ico .ico { width: 13px; height: 13px; }
.side-card h4 { font-size: 11.5px; font-weight: 600; }
.side-card p { margin-top: 4px; font-size: 10px; line-height: 1.55; color: var(--text-3); }
.side-card .btn { width: 100%; margin-top: 10px; }
.side-card.plan { padding-bottom: 13px; }

.side-foot {
  margin-top: 12px;
  padding: 0 3px;
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  opacity: 0.8;
}

.sidebar-close { display: none; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 8, 16, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
[data-theme="light"] .topbar { background: rgba(250, 248, 255, 0.72); }

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.crumb { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.crumb .sep { margin: 0 6px; opacity: 0.55; }
.crumb b { font-weight: 400; color: var(--text-2); }

.topbar-right { display: flex; align-items: center; gap: 9px; }

.menu-btn {
  display: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-2);
  background: var(--panel-2);
}

.search {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 252px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-3);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
[data-theme="light"] .search { background: rgba(24, 18, 54, 0.03); }
.search:focus-within {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.06);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
  color: var(--text-2);
}
.search .ico { width: 13px; height: 13px; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--text);
  font-size: 11.5px;
}
.search input::placeholder { color: var(--text-3); }
.search kbd {
  flex: none;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-3);
  font-family: var(--font);
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
}
[data-theme="light"] .search kbd { background: rgba(24, 18, 54, 0.04); }

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text-2);
  transition: 0.18s ease;
}
.icon-btn:hover { border-color: var(--line); background: rgba(255, 255, 255, 0.05); color: var(--text); }
.icon-btn .ico { width: 15px; height: 15px; }
.icon-btn .dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.ai-orb {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #f3ecff;
  background: radial-gradient(circle at 34% 28%, #a78bfa, #6d28d9 68%, #3b1580);
  box-shadow: 0 0 0 1px rgba(196, 181, 253, 0.3), 0 0 16px -2px rgba(124, 58, 237, 0.7);
}
.ai-orb .ico { width: 13px; height: 13px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 4px 2px 2px;
  border-radius: 999px;
  transition: background 0.18s ease;
}
.user-chip:hover { background: rgba(255, 255, 255, 0.05); }
.user-chip .name { font-size: 11.5px; color: var(--text-2); }
.user-chip .ico { width: 12px; height: 12px; color: var(--text-3); }

.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(140deg, #b39bff, #7c3aed 56%, #5b21b6);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 6px 14px -6px rgba(109, 40, 217, 0.9);
  flex: none;
}
.avatar.xl {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-size: 22px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 14px 30px -14px rgba(109, 40, 217, 1);
}

.pop-wrap { position: relative; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: 0.18s ease;
}
[data-theme="light"] .btn { background: rgba(255, 255, 255, 0.7); }
.btn:hover { color: var(--text); border-color: rgba(167, 139, 250, 0.45); background: rgba(139, 92, 246, 0.1); }
.btn .ico { width: 13px; height: 13px; }
.btn-accent {
  color: #fff;
  border-color: rgba(196, 181, 253, 0.3);
  background: linear-gradient(120deg, #8b5cf6, #6d28d9);
  box-shadow: 0 8px 22px -12px rgba(124, 58, 237, 1), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-accent:hover {
  color: #fff;
  border-color: rgba(221, 214, 254, 0.5);
  background: linear-gradient(120deg, #9a70ff, #7c3aed);
}
.btn-sm { height: 28px; padding: 0 10px; font-size: 10.5px; border-radius: 8px; }
.btn-sm .ico { width: 12px; height: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--text-3);
  transition: color 0.16s ease;
  white-space: nowrap;
}
.link-btn .ico { width: 11px; height: 11px; }
.link-btn:hover { color: var(--accent-text); }

.icon-btn-sm {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--text-3);
  transition: 0.16s ease;
}
.icon-btn-sm:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.icon-btn-sm .ico { width: 12px; height: 12px; }

/* ---------- page header ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.eyebrow {
  margin-bottom: 9px;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-3);
}
.page-title {
  font-size: 30px;
  font-weight: 650;
  line-height: 1.16;
  letter-spacing: -0.025em;
}
.page-desc {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-2);
}
.page-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font-size: 10.5px;
  white-space: nowrap;
}
.page-badge .ico { width: 12px; height: 12px; color: var(--text-3); }
.head-side { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- card ---------- */
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
}
.card-head h3 .ico { width: 14px; height: 14px; color: var(--accent-text); }
.card-head .muted { font-size: 10.5px; color: var(--text-3); font-weight: 400; }
.card-body { padding: 18px; }

/* ---------- pills / chips / tags ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-2);
  font-size: 9.5px;
  white-space: nowrap;
}
.pill .ico { width: 10px; height: 10px; }
.pill-success {
  border-color: rgba(61, 220, 151, 0.24);
  background: var(--success-soft);
  color: var(--success);
}
.pill-purple {
  border-color: rgba(167, 139, 250, 0.3);
  background: rgba(139, 92, 246, 0.16);
  color: var(--accent-text);
}
.pill-danger { border-color: rgba(251, 113, 133, 0.28); background: var(--danger-soft); color: var(--danger); }
.pill-muted { color: var(--text-3); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-3);
  font-size: 10px;
  white-space: nowrap;
}
.chip .ico { width: 10px; height: 10px; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border: 1px solid rgba(167, 139, 250, 0.24);
  border-radius: 5px;
  background: rgba(139, 92, 246, 0.14);
  color: #c9b8ff;
  font-size: 9px;
  white-space: nowrap;
}
[data-theme="light"] .tag { color: #6d3df5; }
.tag-green { border-color: rgba(61, 220, 151, 0.24); background: var(--success-soft); color: var(--success); }

/* ---------- stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.stat {
  padding: 15px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.stat:hover { border-color: rgba(139, 92, 246, 0.3); transform: translateY(-1px); }
.stat-head { display: flex; align-items: center; gap: 8px; }
.stat-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  flex: none;
}
.stat-icon .ico { width: 13px; height: 13px; }
.tint-purple { background: rgba(139, 92, 246, 0.16); color: #bda6ff; box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.18); }
.tint-green { background: rgba(61, 220, 151, 0.12); color: var(--success); box-shadow: inset 0 0 0 1px rgba(61, 220, 151, 0.16); }
.tint-red { background: rgba(251, 113, 133, 0.12); color: var(--danger); box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.16); }
.tint-indigo { background: rgba(129, 140, 248, 0.13); color: #a5b4fc; box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.18); }
.tint-teal { background: rgba(45, 212, 191, 0.12); color: #5eead4; box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.16); }
.tint-pink { background: rgba(244, 114, 182, 0.12); color: #f9a8d4; box-shadow: inset 0 0 0 1px rgba(244, 114, 182, 0.16); }
.tint-blue { background: rgba(96, 165, 250, 0.13); color: #93c5fd; box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.16); }
.stat-label { font-size: 11px; color: var(--text-2); letter-spacing: 0.01em; }
.stat-value {
  margin-top: 11px;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-foot { margin-top: 6px; font-size: 10px; color: var(--text-3); }

/* ---------- tabs ---------- */
.tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  flex-wrap: wrap;
}
.tabs { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; min-width: 0; max-width: 100%; }
.tab {
  height: 26px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-3);
  font-size: 11px;
  transition: 0.16s ease;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tab.is-active {
  color: #fff;
  background: linear-gradient(120deg, #8b5cf6, #6d28d9);
  box-shadow: 0 6px 16px -10px rgba(124, 58, 237, 1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
[data-theme="light"] .tab.is-active { color: #fff; }

.view-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.view-toggle button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 21px;
  border-radius: 5px;
  color: var(--text-3);
  transition: 0.16s ease;
}
.view-toggle button .ico { width: 11px; height: 11px; }
.view-toggle button.is-active { background: rgba(139, 92, 246, 0.22); color: #d5c8ff; }

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  gap: 2px;
}
.segmented button {
  height: 26px;
  padding: 0 11px;
  border-radius: 6px;
  color: var(--text-3);
  font-size: 10.5px;
  transition: 0.16s ease;
  white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active {
  color: #fff;
  background: linear-gradient(120deg, #8b5cf6, #6d28d9);
  box-shadow: 0 5px 14px -9px rgba(124, 58, 237, 1);
}

/* ---------- toolbar / filters ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 18px;
  flex-wrap: wrap;
}
.toolbar-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font-size: 11px;
  transition: 0.16s ease;
  white-space: nowrap;
}
.filter-btn:hover { border-color: rgba(167, 139, 250, 0.4); color: var(--text); }
.filter-btn .ico { width: 11px; height: 11px; color: var(--text-3); }
.filter-btn.is-on { border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.1); color: var(--text); }

.search-sm {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  width: 212px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-3);
  transition: 0.18s ease;
}
.search-sm:focus-within { border-color: rgba(139, 92, 246, 0.5); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1); }
.search-sm .ico { width: 11px; height: 11px; }
.search-sm input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--text); font-size: 10.5px; }
.search-sm input::placeholder { color: var(--text-3); }

/* ---------- table ---------- */
.table-wrap { padding: 0 18px; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 660px; }
.table thead th {
  padding: 9px 12px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-3);
  text-align: left;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.028);
  border-bottom: 1px solid var(--line);
}
[data-theme="light"] .table thead th { background: rgba(24, 18, 54, 0.025); }
.table thead th:first-child { border-radius: 7px 0 0 7px; }
.table thead th:last-child { border-radius: 0 7px 7px 0; }
.table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.018); }
.table .t-strong { color: var(--text); }
.table .t-mono { font-family: var(--mono); font-size: 11px; letter-spacing: -0.01em; }
.table .t-num { font-variant-numeric: tabular-nums; }
.table .t-actions { text-align: right; }

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--text-3);
}
.table-foot .pager { display: flex; align-items: center; gap: 6px; }
.table-foot button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-3);
}
.table-foot button:hover { color: var(--text); border-color: var(--line-2); }

/* ---------- empty state ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 46px 20px 50px;
  text-align: center;
}
.empty-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(155deg, rgba(167, 139, 250, 0.95), rgba(91, 33, 182, 0.85));
  box-shadow:
    0 0 0 1px rgba(196, 181, 253, 0.24),
    0 18px 40px -16px rgba(124, 58, 237, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.empty-icon .ico { width: 26px; height: 26px; stroke-width: 1.5; opacity: 0.95; }
.empty-icon::before {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3), transparent 66%);
  z-index: -1;
}
.empty h4 { font-size: 12.5px; font-weight: 600; }
.empty p { margin-top: 6px; max-width: 300px; font-size: 10.5px; line-height: 1.7; color: var(--text-3); }

/* ---------- info banner ---------- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.06);
  font-size: 11px;
  line-height: 1.65;
  color: var(--text-3);
}
.notice .ico { width: 13px; height: 13px; margin-top: 1px; color: var(--accent-text); }
.notice strong { color: var(--text-2); font-weight: 500; }

/* ---------- popover ---------- */
.popover {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: 264px;
  padding: 13px;
  border: 1px solid var(--line-2);
  border-radius: 13px;
  background: var(--panel-flat);
  box-shadow: var(--shadow-pop);
  z-index: 90;
  animation: popIn 0.16s ease;
}
@keyframes popIn {
  from { transform: translateY(-4px) scale(0.985); }
  to { transform: none; }
}
.popover h5 { margin: 0 0 3px; font-size: 11px; font-weight: 600; }
.popover .pop-sub { font-size: 9.5px; color: var(--text-3); }
.pop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.pop-row:last-of-type { border-bottom: 0; }
.pop-row .pop-label { font-size: 10.5px; color: var(--text-2); }
.pop-note {
  margin-top: 8px;
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.08);
  font-size: 9px;
  line-height: 1.6;
  color: var(--text-3);
}
.pop-menu { width: 196px; padding: 7px; }
.pop-menu a,
.pop-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 11px;
  color: var(--text-2);
  text-align: left;
}
.pop-menu a:hover,
.pop-menu button:hover { background: rgba(139, 92, 246, 0.1); color: var(--text); }
.pop-menu .ico { width: 13px; height: 13px; color: var(--text-3); }
.pop-menu .divider { height: 1px; margin: 5px 4px; background: var(--line); }

.switch {
  position: relative;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: rgba(140, 130, 175, 0.3);
  transition: background 0.2s ease;
  flex: none;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}
.switch.on { background: linear-gradient(120deg, #8b5cf6, #6d28d9); }
.switch.on::after { transform: translateX(15px); }

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 10px;
  background: rgba(22, 18, 40, 0.96);
  color: #e9e4fa;
  font-size: 11.5px;
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.9);
  animation: toastIn 0.22s cubic-bezier(0.22, 0.61, 0.36, 1);
}
[data-theme="light"] .toast { background: #1a152b; }
.toast .ico { width: 13px; height: 13px; color: #6ee7b7; }
.toast.out { animation: toastOut 0.2s ease both; }
@keyframes toastIn { from { transform: translateY(8px) scale(0.98); } to { transform: none; } }
@keyframes toastOut { to { transform: translateY(4px); } }

/* ---------- scrim ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(4, 3, 9, 0.6);
  backdrop-filter: blur(3px);
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .view { padding: 22px 22px 48px; }
  .topbar { padding: 0 22px; }
  .search { width: 200px; }
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 246px;
    height: 100vh;
    transform: translateX(-102%);
    transition: transform 0.26s cubic-bezier(0.22, 0.61, 0.36, 1);
    box-shadow: 30px 0 80px -30px rgba(0, 0, 0, 0.9);
  }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: grid; }
  .sidebar-close {
    display: grid;
    place-items: center;
    position: absolute;
    top: 16px;
    right: 12px;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    color: var(--text-3);
  }
  .sidebar-close:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
  .brand { padding-right: 34px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { width: 172px; }
  .user-chip .name { display: none; }
  .view { padding: 20px 16px 44px; }
  .topbar { padding: 0 16px; height: 56px; }
  .page-title { font-size: 26px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .head-side { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .search { width: 34px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .search input, .search kbd { display: none; }
  .search:focus-within { width: 34px; }
  .crumb .sep, .crumb span:first-child { display: none; }
  .btn-label { display: none; }
  .btn.palette-btn { width: 32px; padding: 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 21px; }
  .page-title { font-size: 23px; }
  .view { padding: 18px 13px 40px; }
  .topbar { padding: 0 13px; }
  .toast-wrap { left: 13px; right: 13px; align-items: stretch; }
  .toast { justify-content: flex-start; }
  .table-wrap { padding: 0 12px; }
  .card-head { padding: 13px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- home ambient landscape ---------- */
.home-scene {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34vh;
  min-height: 240px;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}
body.is-home .home-scene { opacity: 1; }
.home-scene svg { width: 100%; height: 100%; }
[data-theme="light"] .home-scene { display: none; }

/* =========================================================
   后端接口对齐新增组件
   ========================================================= */

/* ---------- 下拉选择 ---------- */
.select-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  max-width: 300px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  font-size: 11.5px;
}
[data-theme="light"] .select-shell { background: rgba(255, 255, 255, 0.75); }
.select-shell > .ico:first-child { width: 12px; height: 12px; color: var(--text-3); }
.select-shell select {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  min-width: 0;
  max-width: 236px;
  padding-right: 14px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-overflow: ellipsis;
  cursor: pointer;
}
.select-shell select:focus { outline: none; }
.select-shell > .ico:last-child {
  position: absolute;
  right: 6px;
  width: 12px;
  height: 12px;
  color: var(--text-3);
  pointer-events: none;
}
.select-shell.sm { height: 28px; font-size: 11px; }
.select-shell.sm select { max-width: 140px; }
.select-shell:focus-within { border-color: rgba(167, 139, 250, 0.5); }
/* 原生下拉列表跟随主题，避免暗色页面弹出白底列表 */
.select-shell select option {
  background: var(--panel-flat);
  color: var(--text);
}

/* ---------- Key 自定义下拉（与卡片/主题统一） ---------- */
.key-select { display: inline-flex; }
.select-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  max-width: 300px;
  padding: 0 9px 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  font-size: 11.5px;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
[data-theme="light"] .select-trigger { background: rgba(255, 255, 255, 0.75); }
.select-trigger:hover { border-color: rgba(167, 139, 250, 0.45); color: var(--text); }
.select-trigger[aria-expanded="true"] {
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(139, 92, 246, 0.12);
  color: var(--text);
}
.select-trigger .ico { flex: none; width: 12px; height: 12px; color: var(--text-3); }
.select-trigger .ico:last-child { transition: transform 0.18s ease; }
.select-trigger[aria-expanded="true"] .ico:last-child { transform: rotate(180deg); }
.select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
}

.key-menu {
  left: auto;
  right: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: 300px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
}
.key-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "main state" "remark remark";
  gap: 2px 8px;
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  text-align: left;
  color: var(--text-2);
  transition: background 0.15s ease;
}
.key-option-main { grid-area: main; display: flex; align-items: center; gap: 6px; min-width: 0; }
.key-option-main b {
  flex: none;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}
.key-hint {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
}
.key-remark {
  grid-area: remark;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: var(--text-3);
}
.key-option .key-state {
  grid-area: state;
  align-self: center;
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 9.5px;
  color: var(--text-3);
}
.key-option .key-state.ok {
  color: var(--success);
  border-color: rgba(61, 220, 151, 0.28);
  background: var(--success-soft);
}
.key-option:hover { background: rgba(139, 92, 246, 0.1); }
.key-option.is-active { background: rgba(139, 92, 246, 0.16); }
.key-option.is-active .key-hint { color: var(--accent-text); }
[data-theme="light"] .key-option.is-active .key-hint { color: var(--accent-2); }

@media (max-width: 720px) {
  .key-menu { left: 0; right: auto; }
}

/* ---------- 按钮补充 ---------- */
.btn.danger {
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.26);
  background: var(--danger-soft);
}
.btn.danger:hover { color: #fecdd3; border-color: rgba(251, 113, 133, 0.5); background: rgba(251, 113, 133, 0.16); }
[data-theme="light"] .btn.danger:hover { color: #be123c; }
.btn.danger-solid {
  color: #fff;
  border-color: rgba(254, 205, 211, 0.3);
  background: linear-gradient(120deg, #f43f5e, #be123c);
  box-shadow: 0 8px 22px -12px rgba(244, 63, 94, 0.9);
}
.btn.danger-solid:hover { color: #fff; background: linear-gradient(120deg, #fb7185, #e11d48); }

/* ---------- 状态胶囊补充 ---------- */
.tone-green { border-color: rgba(61, 220, 151, 0.24); background: var(--success-soft); color: var(--success); }
.tone-red { border-color: rgba(251, 113, 133, 0.24); background: var(--danger-soft); color: var(--danger); }
.tone-amber { border-color: rgba(251, 191, 36, 0.24); background: var(--warn-soft); color: #fbbf24; }
.tone-muted { border-color: var(--line); background: rgba(255, 255, 255, 0.04); color: var(--text-3); }
[data-theme="light"] .tone-amber { color: #b45309; }

/* ---------- 骨架屏（不依赖动画，避免预览环境停帧） ---------- */
.sk {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.045));
}
[data-theme="light"] .sk {
  background: linear-gradient(90deg, rgba(24, 18, 54, 0.045), rgba(24, 18, 54, 0.085), rgba(24, 18, 54, 0.045));
}
.sk-stat { display: flex; flex-direction: column; gap: 9px; }
.sk-line { height: 9px; }
.sk-value { height: 24px; width: 58%; }
.sk-row { width: 100%; border-radius: 8px; }
.sk-row + .sk-row { margin-top: 8px; }

/* ---------- 错误态 ---------- */
.state-error {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 12px 0;
  padding: 16px;
  border: 1px dashed rgba(251, 113, 133, 0.34);
  border-radius: 12px;
  background: rgba(251, 113, 133, 0.06);
}
.state-error-ico {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
}
.state-error-ico .ico { width: 15px; height: 15px; }
.state-error-body { flex: 1; min-width: 0; }
.state-error-body h4 { font-size: 12px; font-weight: 600; }
.state-error-body p { margin-top: 4px; font-size: 10.5px; line-height: 1.7; color: var(--text-3); }
.state-error .btn { flex: none; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 4, 12, 0.62);
  backdrop-filter: blur(6px);
}
[data-theme="light"] .modal-mask { background: rgba(24, 18, 54, 0.28); }
.modal-card {
  width: min(460px, 100%);
  padding: 20px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: var(--panel-flat);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.8);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h3 { font-size: 14px; font-weight: 600; }
.modal-desc { margin-top: 8px; font-size: 11px; line-height: 1.7; color: var(--text-3); }
.modal-card .field { margin-top: 14px; }
.modal-card textarea {
  height: auto;
  padding: 9px 10px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
}
.modal-hint {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 10px;
  line-height: 1.65;
  color: var(--text-3);
}
.modal-error { min-height: 14px; margin-top: 8px; font-size: 10.5px; color: var(--danger); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---------- 表单字段 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 10px; color: var(--text-2); }
.field input,
.field select,
.field textarea {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 11.5px;
  font-family: inherit;
  transition: border-color 0.16s ease;
}
[data-theme="light"] .field input,
[data-theme="light"] .field select,
[data-theme="light"] .field textarea { background: rgba(255, 255, 255, 0.8); }
.field input:focus,
.field select:focus,
.field textarea:focus { outline: none; border-color: rgba(167, 139, 250, 0.55); }
.field input::placeholder,
.field textarea::placeholder { color: var(--text-3); }
.modal-card .field textarea { height: auto; min-height: 58px; }

/* 浅色主题下强调按钮保持品牌渐变（覆盖 .btn 的浅底规则） */
[data-theme="light"] .btn-accent {
  color: #fff;
  border-color: rgba(196, 181, 253, 0.42);
  background: linear-gradient(120deg, #8b5cf6, #6d28d9);
  box-shadow: 0 10px 24px -14px rgba(109, 40, 217, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
[data-theme="light"] .btn-accent:hover {
  color: #fff;
  background: linear-gradient(120deg, #9a70ff, #7c3aed);
}

@media (max-width: 960px) {
  /* 抽屉必须在遮罩之上，否则会被 backdrop-filter 模糊 */
  .sidebar { z-index: 50; }
}

@media (max-width: 960px) {
  /* 打开抽屉时解除 .app 的层叠上下文，让固定侧栏压过遮罩 */
  body.nav-open .app { z-index: auto; }
}
