/* ============================================================================
 * 星穹 StarVault · 设计系统
 * 主题：星辰（深空 / 星云 / 玻璃拟态 / 鎏金细线）
 * ==========================================================================*/

:root {
  /* — 深空底色 — */
  --void-0: #03050d;
  --void-1: #060a17;
  --void-2: #0a1024;
  --void-3: #0e1730;
  --panel: rgba(16, 24, 48, 0.55);
  --panel-solid: #0d1428;
  --panel-hi: rgba(255, 255, 255, 0.055);
  --line: rgba(158, 178, 255, 0.14);
  --line-strong: rgba(170, 190, 255, 0.28);

  /* — 星云色 — */
  --violet: #7367f0;
  --violet-deep: #3a2f8f;
  --indigo: #2b3a8f;
  --magenta: #c2479a;
  --cyan: #35d6d0;
  --azure: #4a8cff;

  /* — 鎏金（星辰高级感的点睛色） — */
  --gold: #e6c588;
  --gold-bright: #f7e3b0;
  --gold-deep: #9c7b3c;

  /* — 文本 — */
  --text: #eaf0ff;
  --text-2: rgba(234, 240, 255, 0.72);
  --text-3: rgba(234, 240, 255, 0.46);
  --text-4: rgba(234, 240, 255, 0.28);

  /* — 语义 — */
  --ok: #47d39c;
  --warn: #eab86a;
  --risk: #ff6b81;
  --rust: #c9724a;

  /* — 字体 — */
  --font-display: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  /* — 尺度 — */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow-deep: 0 30px 80px -28px rgba(0, 0, 0, 0.85);
  --shadow-glow: 0 0 40px -12px rgba(115, 103, 240, 0.55);
  --ease: cubic-bezier(0.22, 0.61, 0.24, 1);
  --maxw: 1680px;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--void-0);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  overflow-x: clip;   /* clip 不会创建滚动容器，sticky 顶栏保持有效 */
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
::selection { background: rgba(230, 197, 136, 0.3); color: #fff; }

/* 星野摄影底图（真实星云，压在 canvas 星点之下） */
.sky-photo {
  position: absolute;
  inset: -4%;
  z-index: 0;
  pointer-events: none;
  background: url('../img/nebula.jpg') center / cover no-repeat;
  opacity: 0.34;
  filter: saturate(125%) contrast(1.04) brightness(.92);
  animation: skyDrift 70s var(--ease) infinite alternate;
}
@keyframes skyDrift {
  from { transform: scale(1) translateY(0); opacity: .3; }
  to   { transform: scale(1.08) translateY(-2.5%); opacity: .4; }
}

/* 星野 canvas */
#starfield {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.nebula {
  position: absolute;
  inset: -20%;
  z-index: 1;
  pointer-events: none;
  filter: blur(60px) saturate(130%);
  opacity: 0.9;
  background:
    radial-gradient(38% 30% at 14% 18%, rgba(88, 71, 220, 0.42), transparent 70%),
    radial-gradient(30% 26% at 84% 12%, rgba(196, 72, 154, 0.26), transparent 72%),
    radial-gradient(46% 38% at 72% 82%, rgba(37, 108, 190, 0.30), transparent 70%),
    radial-gradient(26% 22% at 34% 92%, rgba(46, 190, 186, 0.16), transparent 70%);
  animation: nebulaDrift 46s var(--ease) infinite alternate;
}

@keyframes nebulaDrift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-2.5%, 1.5%, 0) scale(1.06); }
  100% { transform: translate3d(2%, -2%, 0) scale(1.03); }
}

.grain::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: radial-gradient(rgba(255,255,255,.9) 0.5px, transparent 0.6px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
}

/* 地平线光晕 */
.horizon {
  position: absolute;
  left: 0; right: 0; bottom: -32vh;
  height: 56vh;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(50% 100% at 50% 100%, rgba(112, 96, 255, 0.22), rgba(6, 10, 23, 0) 70%);
}

/* ============================ 排版 ============================ */
.display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.18;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-4);
}

.h1 { font-size: clamp(30px, 3.4vw, 52px); }
.h2 { font-size: clamp(22px, 2vw, 30px); }
.h3 { font-size: 18px; font-weight: 600; letter-spacing: 0.02em; }
.muted { color: var(--text-3); }
.dim { color: var(--text-4); }
.gold { color: var(--gold); }
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.02em; }

.gold-rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(230, 197, 136, 0.55), transparent);
}

/* ============================ 玻璃面板 ============================ */
.glass {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012) 40%, rgba(255, 255, 255, 0)),
    var(--panel);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255,255,255,.22), rgba(255,255,255,0) 32%, rgba(230,197,136,.12) 78%, rgba(255,255,255,0));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  font-size: 13px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: all 0.28s var(--ease);
}
.btn:hover {
  color: var(--text);
  border-color: rgba(230, 197, 136, 0.5);
  background: rgba(230, 197, 136, 0.08);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }

.btn-primary {
  border-color: transparent;
  color: #0a0a12;
  font-weight: 600;
  background: linear-gradient(120deg, var(--gold-bright), var(--gold) 40%, var(--gold-deep));
  box-shadow: 0 10px 30px -12px rgba(230, 197, 136, 0.75);
}
.btn-primary:hover {
  color: #0a0a12;
  background: linear-gradient(120deg, #fff3d4, var(--gold-bright) 45%, var(--gold));
  box-shadow: 0 16px 40px -14px rgba(247, 227, 176, 0.9);
}

.btn-cosmic {
  border-color: rgba(115, 103, 240, 0.5);
  color: #dfe2ff;
  background: linear-gradient(120deg, rgba(115, 103, 240, 0.34), rgba(53, 214, 208, 0.2));
}
.btn-cosmic:hover { background: linear-gradient(120deg, rgba(115, 103, 240, 0.5), rgba(53, 214, 208, 0.3)); color: #fff; border-color: rgba(115, 103, 240, 0.8); }

.btn-sm { height: 28px; padding: 0 12px; font-size: 12px; }
.btn-lg { height: 48px; padding: 0 30px; font-size: 15px; letter-spacing: 0.08em; }
.btn-block { width: 100%; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger:hover { border-color: rgba(255, 107, 129, 0.55); background: rgba(255, 107, 129, 0.1); color: #ffc7cf; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text-3);
  transition: all 0.24s var(--ease);
}
.icon-btn:hover { color: var(--gold); border-color: var(--line); background: rgba(255,255,255,.05); }

/* ============================ 徽标 / 标签 ============================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px;
  border-radius: 999px;
  font-size: 11px; letter-spacing: 0.06em;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-2);
  white-space: nowrap;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.badge.gold   { color: var(--gold-bright); border-color: rgba(230,197,136,.42); background: rgba(230,197,136,.1); }
.badge.cyan   { color: #7ff0ea; border-color: rgba(53,214,208,.4); background: rgba(53,214,208,.1); }
.badge.violet { color: #b8b1ff; border-color: rgba(115,103,240,.45); background: rgba(115,103,240,.14); }
.badge.amber  { color: #f3cd85; border-color: rgba(234,184,106,.4); background: rgba(234,184,106,.1); }
.badge.rust   { color: #e5a184; border-color: rgba(201,114,74,.42); background: rgba(201,114,74,.12); }
.badge.muted  { color: var(--text-3); border-color: var(--line); }
.badge.risk   { color: #ffa6b4; border-color: rgba(255,107,129,.4); background: rgba(255,107,129,.1); }
.badge.ok     { color: #8eecc0; border-color: rgba(71,211,156,.4); background: rgba(71,211,156,.1); }

.chip {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 8px; margin: 2px 4px 2px 0;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-3);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.06);
}

.scope {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700;
  border: 1px solid var(--line);
  color: var(--text-4);
  background: rgba(255,255,255,.03);
}
.scope.on { color: #0c0c14; border-color: transparent; }
.scope.on.view    { background: linear-gradient(140deg, #8ce9ff, #45b7e8); }
.scope.on.edit    { background: linear-gradient(140deg, #c5bcff, #7b6ef2); }
.scope.on.publish { background: linear-gradient(140deg, #ffe6ad, #e0b768); }
.scope.on.admin   { background: linear-gradient(140deg, #ffb0c0, #e2547a); }

/* ============================ 表单 ============================ */
.field { display: block; margin-bottom: 16px; }
.field > label {
  display: block; margin-bottom: 7px;
  font-size: 12px; letter-spacing: 0.1em; color: var(--text-3);
}
.input, .select, .textarea {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--r-md);
  background: rgba(4, 7, 16, 0.55);
  border: 1px solid var(--line);
  color: var(--text);
  transition: all 0.24s var(--ease);
}
.textarea { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: rgba(230, 197, 136, 0.6);
  box-shadow: 0 0 0 3px rgba(230, 197, 136, 0.1), inset 0 0 24px rgba(115, 103, 240, 0.12);
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.select option { background: var(--panel-solid); }

.switch {
  position: relative;
  width: 40px; height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  border: 1px solid var(--line);
  transition: all .3s var(--ease);
  flex: none;
  cursor: pointer;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-3);
  transition: all .3s var(--ease);
}
.switch.on { background: linear-gradient(120deg, rgba(230,197,136,.9), rgba(115,103,240,.8)); border-color: transparent; }
.switch.on::after { left: 20px; background: #fff; box-shadow: 0 0 10px rgba(255,255,255,.6); }

/* ============================ 表格 ============================ */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-4);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-weight: 400;
}
.table td { padding: 13px 14px; border-bottom: 1px solid rgba(158,178,255,.07); color: var(--text-2); vertical-align: middle; }
.table tbody tr { transition: background .22s var(--ease); }
.table tbody tr:hover { background: rgba(115,103,240,.07); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ============================ 头像 ============================ */
.avatar {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  font-family: var(--font-display);
  font-size: 15px;
  color: #fff;
  background: linear-gradient(140deg, rgba(115,103,240,.85), rgba(53,214,208,.55));
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 6px 18px -8px rgba(0,0,0,.8);
}
.avatar.lg { width: 46px; height: 46px; border-radius: 15px; font-size: 20px; }
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }

/* ============================ 进度 ============================ */
.bar { height: 3px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar > i {
  display: block; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  box-shadow: 0 0 12px rgba(53,214,208,.7);
  transition: width .9s var(--ease);
}
.bar.gold > i { background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright)); box-shadow: 0 0 12px rgba(230,197,136,.6); }

/* ============================ KPI 卡（共享：权限控制台总览） ============================ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; margin: 18px 0; }
.kpi {
  position: relative; overflow: hidden;
  padding: 16px 18px; border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255,255,255,.055), rgba(255,255,255,.015));
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--gold); opacity: .8; }
.kpi.cyan::before { background: var(--cyan) } .kpi.violet::before { background: var(--violet) } .kpi.risk::before { background: var(--risk) }
.kpi .n { font-family: var(--font-display); font-size: 29px; font-weight: 600; letter-spacing: .02em; line-height: 1.15; }
.kpi .l { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.kpi .d { font-family: var(--font-mono); font-size: 10px; color: var(--text-4); margin-top: 9px; display: flex; align-items: center; gap: 5px; }
.kpi.gold .n { color: var(--gold-bright) } .kpi.cyan .n { color: #86ecec } .kpi.violet .n { color: #bcb4ff } .kpi.risk .n { color: #ff9fae }

/* ============================ 弹层 / 提示 ============================ */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(3, 5, 13, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn .26s var(--ease);
}
.modal {
  width: min(600px, 100%);
  max-height: 86vh; overflow: auto;
  padding: 30px;
  animation: rise .38s var(--ease);
}
@keyframes fadeIn { from { opacity: 0 } }
@keyframes rise { from { opacity: 0; transform: translateY(22px) scale(.98) } }

#toasts {
  position: fixed; right: 26px; bottom: 26px; z-index: 120;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  max-width: 400px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: rgba(10, 16, 36, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-deep);
  font-size: 13px;
  animation: toastIn .4s var(--ease);
}
.toast .star { color: var(--gold); flex: none; }
.toast.risk { border-color: rgba(255,107,129,.45); }
.toast.risk .star { color: var(--risk); }
.toast.ok .star { color: var(--ok); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) } }

/* ============================ 工具类 ============================ */
.ico { flex: none; vertical-align: -2px; }
.input-icon { position: relative; display: block; }
.input-icon > span:first-child {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-4); pointer-events: none; display: grid;
}
.input-icon .input { padding-left: 40px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.center { display: grid; place-items: center; }
.gap-4 { gap: 4px } .gap-6 { gap: 6px } .gap-8 { gap: 8px } .gap-12 { gap: 12px } .gap-16 { gap: 16px } .gap-24 { gap: 24px }
.mt-4{margin-top:4px}.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}.mt-32{margin-top:32px}
.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}.mb-24{margin-bottom:24px}
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide { display: none !important; }
.pointer { cursor: pointer; }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,.02); }
::-webkit-scrollbar-thumb { background: rgba(158,178,255,.16); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(230,197,136,.35); background-clip: content-box; }

.env-toggle { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0,0,0,.3); flex: none; }
.env-toggle button { padding: 4px 12px; border-radius: 999px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; color: var(--text-3); transition: all .24s var(--ease); }
.env-toggle button.on { background: linear-gradient(120deg, rgba(115,103,240,.9), rgba(53,214,208,.7)); color: #fff; }

@media (max-width: 860px) {
  .nebula { filter: blur(40px); }
  #toasts { right: 12px; left: 12px; bottom: 12px; align-items: stretch; }
}
