/* ============================================================
   牛哥科技管理中心 · 赛博朋克主题
   霓虹 / 扫描线 / 网格 / 玻璃拟态 / HUD 角标
   ============================================================ */

:root {
  --bg-0: #05060d;
  --bg-1: #0a0d1a;
  --bg-2: #111527;
  --panel: rgba(16, 22, 42, 0.72);
  --panel-solid: #0e1326;
  --line: rgba(0, 240, 255, 0.18);
  --line-strong: rgba(0, 240, 255, 0.5);

  --cyan: #00f0ff;
  --magenta: #ff2bd6;
  --purple: #9d6bff;
  --amber: #ffb648;
  --green: #2bff88;
  --red: #ff4d6d;

  --text: #e8f4ff;
  --text-dim: #8aa0c4;
  --text-mute: #5d6f93;

  --glow-cyan: 0 0 8px rgba(0, 240, 255, 0.55), 0 0 22px rgba(0, 240, 255, 0.25);
  --glow-magenta: 0 0 8px rgba(255, 43, 214, 0.55), 0 0 22px rgba(255, 43, 214, 0.25);

  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace;
  --font-sans: "Rajdhani", "Orbitron", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;

  --radius: 4px;
  --radius-lg: 10px;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-0);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  letter-spacing: 0.02em;
}

/* Canvas 背景层由 background.js 注入 (z-index: -4) */

/* 柔和光晕叠加层 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(0, 240, 255, 0.07), transparent 60%),
    radial-gradient(800px 600px at 100% 0%, rgba(255, 43, 214, 0.07), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(157, 107, 255, 0.06), transparent 60%);
  z-index: -3;
  pointer-events: none;
}

/* 科技网格叠加 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 90%);
  z-index: -2;
  pointer-events: none;
  animation: gridShift 18s linear infinite;
}

@keyframes gridShift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 44px 44px, 44px 44px; }
}

/* 扫描线层 */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.12) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  opacity: 0.35;
  mix-blend-mode: overlay;
}

/* ---------- 排版 ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mono { font-family: var(--font-mono); }
.dim { color: var(--text-dim); }
.mute { color: var(--text-mute); }
.c-cyan { color: var(--cyan); }
.c-magenta { color: var(--magenta); }
.c-purple { color: var(--purple); }
.c-green { color: var(--green); }
.c-amber { color: var(--amber); }
.c-red { color: var(--red); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(8, 11, 22, 0.95), rgba(8, 11, 22, 0.7));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
}

.brand .logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cyan);
  border-radius: var(--radius);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  box-shadow: var(--glow-cyan);
  position: relative;
}

.brand .logo::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: var(--radius);
}

.brand .title {
  font-family: var(--font-mono);
  font-size: 17px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand .sub {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--text-dim);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 240, 255, 0.04);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

/* ---------- 布局 ---------- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.page-head {
  margin-bottom: 26px;
}

.page-head h1 {
  font-size: 22px;
  color: var(--text);
  text-shadow: var(--glow-cyan);
}

.page-head .crumb {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.2em;
  margin-top: 6px;
}

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

/* ---------- 面板（HUD 玻璃拟态 + 角标） ---------- */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), inset 0 0 30px rgba(0, 240, 255, 0.03);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--cyan);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}
.panel::before {
  top: -1px;
  left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
}
.panel::after {
  bottom: -1px;
  right: -1px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}

.panel-h h2 {
  font-size: 14px;
  color: var(--cyan);
  letter-spacing: 0.16em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-h h2::before {
  content: "▌";
  color: var(--magenta);
}

.panel-h .actions {
  display: flex;
  gap: 10px;
}

/* ---------- 统计卡 ---------- */
.stat {
  position: relative;
  background: linear-gradient(160deg, rgba(0, 240, 255, 0.06), rgba(157, 107, 255, 0.04));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  overflow: hidden;
}

.stat .label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.stat .value {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  margin-top: 8px;
  color: var(--text);
  text-shadow: var(--glow-cyan);
}

.stat .delta {
  font-size: 12px;
  margin-top: 6px;
  color: var(--green);
}

.stat .delta.down { color: var(--red); }

.stat::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.18), transparent 70%);
}

/* ---------- 按钮 ---------- */
.btn {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(0, 240, 255, 0.06);
  color: var(--cyan);
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.btn:hover {
  background: rgba(0, 240, 255, 0.16);
  box-shadow: var(--glow-cyan);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(120deg, rgba(0, 240, 255, 0.25), rgba(157, 107, 255, 0.25));
  color: #fff;
  border-color: var(--cyan);
}
.btn-primary:hover {
  box-shadow: var(--glow-cyan), 0 0 24px rgba(157, 107, 255, 0.3);
}

.btn-magenta {
  border-color: rgba(255, 43, 214, 0.6);
  color: var(--magenta);
  background: rgba(255, 43, 214, 0.06);
}
.btn-magenta:hover {
  background: rgba(255, 43, 214, 0.18);
  box-shadow: var(--glow-magenta);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); border-color: var(--line-strong); }

.btn-danger {
  border-color: rgba(255, 77, 109, 0.6);
  color: var(--red);
  background: rgba(255, 77, 109, 0.06);
}
.btn-danger:hover { background: rgba(255, 77, 109, 0.18); box-shadow: 0 0 18px rgba(255, 77, 109, 0.3); }

.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.input, .textarea, .select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: rgba(5, 8, 18, 0.8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 14px;
  outline: none;
  transition: all 0.16s ease;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan), 0 0 14px rgba(0, 240, 255, 0.2);
  background: rgba(5, 8, 18, 0.95);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--text-mute); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}
.switch {
  position: relative;
  width: 46px;
  height: 24px;
  background: rgba(5, 8, 18, 0.9);
  border: 1px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.switch.on {
  background: rgba(0, 240, 255, 0.25);
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all 0.2s;
}
.switch.on::after { left: 24px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.tbl th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.08);
  color: var(--text);
  vertical-align: middle;
}
table.tbl tr:hover td { background: rgba(0, 240, 255, 0.04); }

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  text-transform: uppercase;
}
.tag-green { color: var(--green); border-color: rgba(43, 255, 136, 0.4); background: rgba(43, 255, 136, 0.06); }
.tag-amber { color: var(--amber); border-color: rgba(255, 182, 72, 0.4); background: rgba(255, 182, 72, 0.06); }
.tag-red { color: var(--red); border-color: rgba(255, 77, 109, 0.4); background: rgba(255, 77, 109, 0.06); }
.tag-cyan { color: var(--cyan); border-color: rgba(0, 240, 255, 0.4); background: rgba(0, 240, 255, 0.06); }

/* ---------- 模块入口卡 ---------- */
.module-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: 34px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(8px);
  overflow: hidden;
  transition: all 0.25s ease;
  min-height: 200px;
}
.module-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--g1, rgba(0, 240, 255, 0.08)), transparent 60%);
  opacity: 0.6;
  transition: opacity 0.25s;
}
.module-card:hover {
  transform: translateY(-4px);
  border-color: var(--c, var(--cyan));
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.2), inset 0 0 30px rgba(0, 240, 255, 0.05);
}
.module-card:hover::before { opacity: 1; }

.module-card .ico {
  font-family: var(--font-mono);
  font-size: 30px;
  margin-bottom: 16px;
  display: inline-block;
  color: var(--c, var(--cyan));
  text-shadow: 0 0 14px var(--c, var(--cyan));
}
.module-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}
.module-card p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}
.module-card .arrow {
  position: absolute;
  right: 22px;
  bottom: 20px;
  font-family: var(--font-mono);
  color: var(--c, var(--cyan));
  font-size: 18px;
  opacity: 0.6;
  transition: all 0.25s;
}
.module-card:hover .arrow { opacity: 1; transform: translateX(4px); }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  min-width: 240px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius);
  background: rgba(10, 13, 26, 0.95);
  backdrop-filter: blur(8px);
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.25s ease;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  position: relative;
}
.login-card .glitch-title {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 26px;
  letter-spacing: 0.14em;
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
  margin-bottom: 6px;
  position: relative;
}
.login-card .glitch-title span {
  position: relative;
}
.login-card .sub-title {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.4em;
  margin-bottom: 28px;
}

/* ---------- 杂项 ---------- */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 26px; }
.mb { margin-bottom: 16px; }
.center { text-align: center; }
.right { text-align: right; }
.flex-1 { flex: 1; }
hr.sep { border: none; border-top: 1px dashed var(--line); margin: 18px 0; }
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
}
.loading-bar {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  background-size: 200% 100%;
  animation: bar 1.2s linear infinite;
  border-radius: 2px;
}
@keyframes bar {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; font-size: 13px; }
.kv .k { color: var(--text-mute); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; padding-top: 2px; }
.kv .v { color: var(--text); word-break: break-all; }

pre.code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* 简易迷你柱状条 */
.minibars { display: flex; align-items: flex-end; gap: 4px; height: 48px; }
.minibars .bar { flex: 1; background: linear-gradient(180deg, var(--cyan), rgba(0, 240, 255, 0.15)); border-radius: 2px 2px 0 0; min-height: 3px; transition: height 0.4s ease; }
