/* ============================================================
   个人工作台 · 设计令牌与布局骨架（深色科技感）
   ============================================================ */

:root {
  /* 背景层次：数字越大越"高" */
  --bg-0: #07090d;
  --bg-1: #0b0f15;
  --bg-2: #111823;
  --bg-3: #17202d;
  --bg-4: #1e2a3a;

  /* 文字层次 */
  --txt-1: #e6eef8;
  --txt-2: #93a4b8;
  --txt-3: #5d6f84;

  /* 边框 */
  --line: #1b2634;
  --line-2: #26374a;
  --line-glow: rgba(34, 211, 238, .35);

  /* 霓虹强调 */
  --neon-cyan: #22d3ee;
  --neon-violet: #8b5cf6;
  --neon-lime: #a3e635;
  --neon-amber: #fbbf24;
  --neon-rose: #fb7185;

  /* 语义色 */
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;

  /* 热力图 5 级 */
  --hm-0: #131a24;
  --hm-1: #0d3b46;
  --hm-2: #0f6172;
  --hm-3: #1596ad;
  --hm-4: #22d3ee;

  /* 阴影与光晕 */
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px -18px #000;
  --shadow-pop: 0 24px 60px -24px #000, 0 0 0 1px var(--line-2);
  --glow-cyan: 0 0 20px -4px rgba(34, 211, 238, .55);
  --glow-violet: 0 0 20px -4px rgba(139, 92, 246, .55);

  /* 尺寸 */
  --sidebar-w: 232px;
  --top-h: 56px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;
  --r-pill: 999px;

  /* 字号 */
  --fs-h1: 1.375rem;
  --fs-h2: 1.0625rem;
  --fs-body: .875rem;
  --fs-sm: .8125rem;
  --fs-xs: .75rem;

  --dur: 160ms;
  --ease: cubic-bezier(.2, .7, .3, 1);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

/* 关键：display 规则会覆盖 UA 的 [hidden]{display:none}，必须显式兜底 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.7;
  color: var(--txt-1);
  background:
    radial-gradient(880px 520px at 12% -8%, rgba(34, 211, 238, .07), transparent 60%),
    radial-gradient(720px 480px at 96% 4%, rgba(139, 92, 246, .07), transparent 60%),
    var(--bg-0);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 极淡网格底纹，制造"控制台"质感 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 35%, transparent 78%);
  mask-image: radial-gradient(ellipse at 50% 0%, #000 35%, transparent 78%);
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: .01em; }
p { margin: 0; }
a { color: var(--neon-cyan); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

.muted { color: var(--txt-2); }
.dim { color: var(--txt-3); }
.hidden { display: none !important; }

:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
}

/* ---------------- 滚动条 ---------------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #33475e; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   登录
   ============================================================ */
.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 32px 28px 26px;
  background: linear-gradient(180deg, var(--bg-2), #0e141d);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  box-shadow: var(--shadow-pop);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-violet));
}

.login-mark {
  font-size: 30px;
  line-height: 1;
  color: var(--neon-cyan);
  text-shadow: 0 0 22px rgba(34, 211, 238, .7);
  margin-bottom: 14px;
}

.login-card h1 { font-size: 1.125rem; margin-bottom: 4px; }
.login-sub { color: var(--txt-3); font-size: var(--fs-xs); letter-spacing: .12em; margin-bottom: 24px; }

.login-input {
  width: 100%;
  height: 42px;
  margin-bottom: 12px;
  text-align: center;
  letter-spacing: .28em;
  font-size: var(--fs-body);
}

.login-status { min-height: 18px; margin-top: 12px; font-size: var(--fs-xs); color: var(--danger); }

/* ============================================================
   应用骨架
   ============================================================ */
.shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  height: 100dvh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 12px;
  background: linear-gradient(180deg, rgba(11, 15, 21, .96), rgba(7, 9, 13, .96));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index: 30;
}

.sidebar-head { padding: 4px 8px 12px; }
.brand {
  font-size: var(--fs-body);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--txt-1);
}
.brand::first-letter { color: var(--neon-cyan); }

.nav { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }

.nav-label {
  padding: 0 10px 4px;
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--txt-3);
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--txt-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  border: 1px solid transparent;
  background: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
  white-space: nowrap;
}
.nav-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item:hover { background: var(--bg-3); color: var(--txt-1); }

.nav-item.active {
  color: var(--neon-cyan);
  background: rgba(34, 211, 238, .09);
  border-color: rgba(34, 211, 238, .22);
}
.nav-item.active svg { filter: drop-shadow(0 0 6px rgba(34, 211, 238, .55)); }

.nav-item.as-btn { width: 100%; text-align: left; font-family: inherit; }

.sidebar-foot { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }

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

.topbar {
  height: var(--top-h);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: rgba(7, 9, 13, .72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar-title { font-size: var(--fs-h2); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: var(--fs-xs); color: var(--txt-3); }

.icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-3);
  color: var(--txt-1);
}
.icon-btn svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 72px;
}

.sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 8, .6);
  backdrop-filter: blur(2px);
  z-index: 25;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 200ms var(--ease);
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask.show { display: block; }
  .icon-btn { display: inline-flex; }
  .app-main { padding: 16px 14px 80px; }
  .topbar { padding: 0 14px; }
  .topbar-date { display: none; }
}

/* 页面标题栏（各视图复用） */
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h2 { font-size: var(--fs-h1); }
.page-head .spacer { flex: 1; }
.page-sub { color: var(--txt-3); font-size: var(--fs-xs); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
