/* ============================================================
   设计 Token —— **与 nordveil-showroom/css/style.css 同一套**
   ------------------------------------------------------------
   为什么单独成文件：展示端与管理端要**视觉统一**，就必须共享同一份
   颜色/字体/圆角/阴影定义，而不是各写一套。
   本文件由 scripts/build.mjs 拷进两个产物的 public/ 里，两边引用同一份。

   ⚠️ 改这里 = 改两个端的观感。若将来旧工程 token 有变动，要同步过来。
   ============================================================ */

/* ---------- 深色（默认：原工程的"深色展柜"）---------- */
:root {
  --topbar-h: 72px;
  --rail-w: 296px;

  --bg: #0b0e13;
  --bg-2: #101319;
  --bg-3: #070910;

  --ink: #e8ecf4;
  --ink-2: #98a2b2;
  --ink-3: #6a7382;
  --ink-4: #49515f;

  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.14);
  --grid-line: rgba(255, 255, 255, 0.055);
  --grid-line-hover: rgba(122, 160, 255, 0.42);

  --accent: #6f95ff;
  --accent-soft: rgba(111, 149, 255, 0.14);
  --accent-ink: #c8d6ff;

  --glass: rgba(15, 19, 27, 0.82);
  --glass-solid: #12161e;
  --glass-rail: rgba(12, 15, 21, 0.72);
  --sunken: rgba(255, 255, 255, 0.045);
  --cell-scrim: rgba(7, 9, 14, 0.66);
  --cell-glow: rgba(110, 150, 255, 0.16);

  /* ---------- 表面层（卡片 / 面板）----------
     深色：卡片是"比底色稍亮的面"；浅色：卡片是"白面"（见下方 light 覆盖）。
     这两个值决定了"谁是底、谁是面"，是亮色模式不再发灰的关键。 */
  --surface: #141922;
  --surface-2: #1a212c;
  --surface-3: rgba(255, 255, 255, 0.07);
  --surface-4: rgba(255, 255, 255, 0.12);
  --stage-bg: radial-gradient(72% 84% at 50% 38%, rgba(111, 149, 255, 0.20), rgba(111, 149, 255, 0.04) 58%, transparent 100%);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.28);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.45), 0 18px 44px rgba(0, 0, 0, 0.42);
  --shadow-float: 0 8px 24px rgba(0, 0, 0, 0.5);

  --sh-2: 0 10px 30px rgba(0, 0, 0, 0.38);
  --sh-3: 0 28px 70px rgba(0, 0, 0, 0.55), 0 2px 0 rgba(255, 255, 255, 0.05) inset;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "Noto Sans SC",
    "PingFang SC", "Microsoft YaHei", "Noto Naskh Arabic", Roboto, Arial, sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Courier New", monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --ok: #4ec99a;
  --warn: #e0a35c;
  --danger: #ef7a72;
}

/* ---------- 浅色（原工程的浅色主题，值一一对应）---------- */
html[data-theme="light"] {
  --bg: #eef0f4;
  --bg-2: #f8f9fb;
  --bg-3: #e6e9ee;

  --ink: #14161a;
  --ink-2: #5b6472;
  --ink-3: #8b93a1;
  --ink-4: #aab1bd;

  --line: rgba(20, 22, 26, 0.10);
  --line-strong: rgba(20, 22, 26, 0.16);
  --grid-line: rgba(20, 22, 26, 0.075);
  --grid-line-hover: rgba(47, 111, 237, 0.45);

  --accent: #2f6fed;
  --accent-soft: rgba(47, 111, 237, 0.12);
  --accent-ink: #1c4fb8;

  --glass: rgba(255, 255, 255, 0.86);
  --glass-solid: #ffffff;
  --glass-rail: rgba(252, 253, 255, 0.80);
  --sunken: rgba(20, 22, 26, 0.045);
  --cell-scrim: rgba(240, 242, 246, 0.66);
  --cell-glow: rgba(47, 111, 237, 0.10);

  /* 浅色：**卡片是白的**，页面才是浅灰 —— 修掉"灰卡白底"的错位关系 */
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: rgba(20, 22, 26, 0.055);
  --surface-4: rgba(20, 22, 26, 0.1);
  --stage-bg: radial-gradient(72% 84% at 50% 38%, rgba(47, 111, 237, 0.13), rgba(47, 111, 237, 0.02) 60%, transparent 100%);
  --shadow-card: 0 1px 2px rgba(20, 22, 26, 0.05), 0 8px 22px rgba(20, 22, 26, 0.07);
  --shadow-hover: 0 2px 4px rgba(20, 22, 26, 0.07), 0 18px 40px rgba(20, 22, 26, 0.13);
  --shadow-float: 0 10px 30px rgba(20, 22, 26, 0.16);

  --sh-2: 0 8px 24px rgba(20, 22, 26, 0.10);
  --sh-3: 0 24px 60px rgba(20, 22, 26, 0.16);
}

/* ============================================================
   共用基础件（与原工程同一套视觉语言）
   ============================================================ */

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ============================================================
   ★ 铁律：靠 `hidden` 控显隐的元素，作者样式一旦声明 display，
     就会**盖掉**浏览器默认的 `[hidden] { display: none }`，
     结果是"本该藏起来的东西一直显示"。
   （旧工程踩过同一个坑，见 ADR-0004；本轮又踩了一次 —— 详情层空壳盖住整个宫格。）
   这里统一兜底，两个端都受保护。
   ============================================================ */
[hidden] { display: none !important; }

/* ---------- 顶栏：玻璃 + 发丝分隔（原 .topbar）----------
   ★ 安全区：手机用 viewport-fit=cover 时页面会延伸到刘海/状态栏下面，
     必须补 env(safe-area-inset-top)，否则顶栏的"返回"会被状态栏盖住、
     还滑不到（真机实测过）。 */
.nv-topbar {
  position: sticky; inset-block-start: 0; z-index: 6;
  display: flex; align-items: center; gap: 22px;
  block-size: auto; min-block-size: var(--topbar-h);
  padding-block-start: env(safe-area-inset-top);
  padding-inline: 26px;
  border-block-end: 1px solid var(--line);
  background: var(--glass-rail);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
.nv-topbar__mid { flex: 1 1 auto; min-inline-size: 0; }
.nv-topbar__end { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; margin-inline-start: auto; }
.nv-rule { inline-size: 1px; block-size: 20px; background: var(--line); }

/* ---------- 品牌（原 .brand）---------- */
.nv-brand { display: flex; align-items: center; gap: 10px; }
.nv-brand__mark {
  inline-size: 30px; block-size: 30px; display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--sunken); color: var(--accent);
}
.nv-brand__name { font-size: 12.5px; font-weight: 650; letter-spacing: 0.26em; }
.nv-brand__sub { font-size: 10px; color: var(--ink-3); letter-spacing: 0.1em; }

/* ---------- 等宽小标签（原工程的 .cell__idx / .lang__label 风格）---------- */
.nv-mono {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-4);
}
.nv-idx { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--ink-3); }

/* ---------- 分段控件（原 .seg / .lang）---------- */
.nv-seg { display: flex; gap: 2px; }
.nv-seg button, .nv-seg a {
  font: inherit; font-size: 12.5px; color: var(--ink-3); background: transparent; border: 0;
  padding: 6px 11px; border-radius: 9px; cursor: pointer; text-decoration: none;
  transition: color .22s var(--ease), background .22s var(--ease);
}
.nv-seg button:hover { color: var(--ink); }
.nv-seg button[aria-pressed="true"] { color: var(--ink); background: var(--surface-3); font-weight: 600; }

/* ---------- 按钮 ----------
   与展示端统一：圆角 12px、无描边、悬停只变底；主按钮带一层同色柔光。 */
.nv-btn {
  font: inherit; font-size: 13px; min-block-size: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 12px; cursor: pointer;
  color: var(--ink); background: var(--surface-3); border: 0;
  text-decoration: none; white-space: nowrap;
  transition: background .22s var(--ease), color .22s var(--ease), box-shadow .22s var(--ease);
}
.nv-btn:hover { background: var(--surface-4); }
.nv-btn--primary {
  background: var(--accent); color: #fff; font-weight: 600;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent);
}
.nv-btn--primary:hover { background: var(--accent); filter: brightness(1.07); }
.nv-btn--ghost { background: transparent; color: var(--ink-2); }
.nv-btn--ghost:hover { background: var(--surface-3); color: var(--ink); }
.nv-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

/* ---------- 输入 ---------- */
.nv-input {
  font: inherit; font-size: 14px; color: var(--ink); inline-size: 100%;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 11px;
  padding: 11px 13px; min-block-size: 46px;
  transition: border-color .22s var(--ease), background .22s var(--ease);
}
.nv-input::placeholder { color: var(--ink-4); }
.nv-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

/* ---------- 加载指示器（卡片与详情共用）----------
   业务方反馈：模型加载时是"空白后突然冒出来"，用户会以为卡住或出 bug。
   所以加载期间必须**居中**给出明确的"正在加载"信号（转圈 + 百分比）。

   ⚠️ 关键：指示器**必须有磨砂玻璃底**。
      第一版只放了灰色细环 + 灰字，压在亮色模型上（比如白色药瓶）
      肉眼几乎看不见（实测截图确认），等于没做。
      加一层 glass 底之后，无论模型明暗都清晰可读。 */
.nv-spinner {
  inline-size: 30px; block-size: 30px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--ink) 22%, transparent);
  border-block-start-color: var(--accent);
  animation: nvSpin 0.85s linear infinite;
}
@keyframes nvSpin { to { transform: rotate(360deg); } }
/* 尊重"减少动态效果"偏好：慢下来而不是完全不动（仍能看出在加载） */
@media (prefers-reduced-motion: reduce) {
  .nv-spinner { animation-duration: 2.6s; }
}

/* 磨砂玻璃底：保证指示器在任意模型上都可见 */
.nv-loadBox {
  display: flex; flex-direction: column; align-items: center; gap: 11px;
  padding: 17px 21px; border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 58%, transparent);
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  box-shadow: var(--shadow-float), inset 0 0 0 1px var(--line);
}
.nv-loadText { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em; color: var(--ink); }

/* 卡片上的加载层：铺满卡片、内容居中 */
.cell__load {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.32s var(--ease);
}
.cell__load.is-done { opacity: 0; }
.cell__load.is-error .nv-spinner { display: none; }
.cell__loadText { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--ink); }

/* 详情页的加载层：同上，字略大 */
.stage-load {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.stage-loadText { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; color: var(--ink); }

/* ---------- 卡片 ----------
   简约高级的做法：**不用描边**，靠"面"与"底"的明度差 + 极轻阴影分层。
   描边是"条条框框"的主要来源，去掉后整页会干净很多。

   ⚠️ 这里**不能写 `isolation: isolate`**：它会创建层叠上下文，
   导致卡片内部的"信息层"（z-index:3）无法越过 3D 画布（z-index:1），
   于是模型会画在文字上面把标题压住（实测过）。 */
.nv-cell {
  position: relative; overflow: hidden;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.34s var(--ease);
}
/* ⚠️ 悬停**只能改 box-shadow，绝对不能加 transform**。
   transform / filter / opacity<1 / isolation 都会**创建层叠上下文**，
   一旦卡片成了层叠上下文，卡内那块磨砂浮窗（z-index:3）就被**封在卡片里**，
   而卡片整体在 3D 画布（z-index:1）之下 ——
   表现就是"鼠标一移上去，模型浮到了文字上面"（业务方反馈的裸眼 3D 凸显）。
   同理 :active 也不能用 transform。 */
.nv-cell:hover { box-shadow: var(--shadow-hover); }
.nv-cell__glow {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(58% 58% at 50% 42%, var(--cell-glow), transparent 72%);
  opacity: 0; transition: opacity 0.36s var(--ease);
}
.nv-cell:hover .nv-cell__glow { opacity: 1; }
.nv-cell > * { position: relative; z-index: 1; }

/* 3D 舞台：无描边，只有一层极淡的渐变，产品像是"悬"在空气里 */
.nv-stage {
  position: relative; overflow: hidden; border-radius: 13px;
  background: var(--stage-bg);
}

/* ---------- 玻璃面板 ----------
   与展示端**同一套语言**：不用硬描边，靠"面"的明度 + 极淡发丝线 + 柔和投影分层。
   半径 16px、内边距放宽，让整页有呼吸感（原先是 12px + 1px 实描边，偏"后台表格感"）。 */
.nv-panel {
  position: relative;
  background: color-mix(in srgb, var(--surface) 58%, transparent);
  border: 0; border-radius: 16px;
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: var(--shadow-card), inset 0 0 0 1px var(--line);
  animation: nvRise 0.5s var(--ease-out) both;
}
/* 入场：与展示端的浮窗同一个"从下方浮现"的手感。
   切换页签时面板从 display:none 变回来，动画会重放 —— 正好当作切换反馈。 */
@keyframes nvRise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .nv-panel { animation: none; } }

.nv-panel__head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px; border-block-end: 1px solid var(--line);
}
.nv-panel__head h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: 0.01em; }
.nv-panel__body { padding: 20px 22px; }

/* ---------- 小标签：**无描边**，只有一层极淡的底 ---------- */
.nv-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2);
}
.nv-chip--ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.nv-chip--warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.nv-chip--off { color: var(--ink-4); }
.nv-chip--accent { color: var(--accent-ink); background: var(--accent-soft); }

/* ---------- 极简列表：只用极淡的分隔，不用"格子"---------- */
.nv-list { margin: 0; padding: 0; list-style: none; }
.nv-list li {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 11px 2px; font-size: 13px; color: var(--ink-2);
  border-block-end: 1px solid var(--line);
}
.nv-list li:last-child { border-block-end: 0; }

/* ---------- 表格 ----------
   SaaS 观感的关键：**表头要看得清、主列要跳出来、次列要退下去**。
   早先表头是 10px 全大写 + `--ink-4`（几乎和背景同色），主列又是普通字重，
   结果整张表"一片灰"，分不出主次（业务方反馈）。 */
.nv-table { inline-size: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.nv-table th, .nv-table td {
  text-align: start; padding: 14px; vertical-align: middle;
  border-block-end: 1px solid color-mix(in srgb, var(--line) 68%, transparent);
}
.nv-table th {
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.04em;
  text-transform: none; color: var(--ink-2);
  border-block-end-color: var(--line);
  white-space: nowrap;
}
.nv-table td { color: var(--ink-2); }
.nv-table tr:last-child td { border-block-end: 0; }
.nv-table tbody tr { transition: background .2s var(--ease); }
.nv-table tbody tr:hover { background: color-mix(in srgb, var(--surface-3) 62%, transparent); }

/* 表格里的三级文字层级 —— 用它们，不要靠"细/黑/粗"硬凑 */
.nv-table .t-main { font-size: 15px; font-weight: 650; color: var(--ink); line-height: 1.35; }
.nv-table .t-sub { font-size: 12px; color: var(--ink-3); font-family: var(--mono); margin-block-start: 3px; }
.nv-table .t-num { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.nv-table .t-dim { color: var(--ink-4); }

/* ---------- 状态徽章：**用颜色承担语义**，而不是一句灰字 ---------- */
.nv-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 650; line-height: 1;
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.nv-badge--ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.nv-badge--warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.nv-badge--off { color: var(--ink-3); background: var(--surface-3); }
.nv-badge--accent { color: var(--accent-ink); background: var(--accent-soft); }
.nv-badge__dot { inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 页头：SaaS 每个模块都该有的"标题 + 说明 + 操作"---------- */
.nv-pagehead { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.nv-pagehead__text { min-inline-size: 0; }
.nv-pagehead h1 { margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -0.012em; color: var(--ink); }
.nv-pagehead p { margin: 7px 0 0; font-size: 13px; color: var(--ink-3); line-height: 1.85; }
.nv-pagehead p b { color: var(--ink-2); font-weight: 650; }
.nv-pagehead__acts { margin-inline-start: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- 指标卡：把"一眼要看到的数"抬出来 ---------- */
.nv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; }
.nv-stat {
  padding: 16px 18px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface-3) 52%, transparent);
}
.nv-stat__num { font-size: 27px; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; color: var(--ink); }
.nv-stat__num--ok { color: var(--ok); }
.nv-stat__num--warn { color: var(--warn); }
.nv-stat__num--accent { color: var(--accent); }
.nv-stat__num--muted { color: var(--ink-3); }
.nv-stat__label { font-size: 12px; color: var(--ink-3); margin-block-start: 7px; }

.nv-muted { color: var(--ink-3); font-size: 12.5px; }
.nv-mono-text { font-family: var(--mono); font-size: 12px; }

/* ============================================================
   窄屏（≤720px）—— 与原工程手机档同一策略：
   品牌只留 logo、标签收紧、内边距减小。
   ⚠️ 不加这段，顶栏的"版本号 + 四语切换 + 主题"会把布局撑破
      （实测 390px 视口被撑到 473px）。
   ============================================================ */
@media (max-width: 720px) {
  .nv-topbar { padding-inline: 14px; gap: 10px; }
  .nv-brand { gap: 8px; }
  .nv-brand__text { display: none; }
  .nv-brand__mark { inline-size: 28px; block-size: 28px; }
  .nv-topbar__end { gap: 8px; }
  .nv-seg { padding: 2px; }
  .nv-seg button { padding: 5px 7px; font-size: 11.5px; }
  .nv-btn { min-block-size: 36px; padding: 7px 11px; font-size: 12.5px; }
  .nv-panel__body { padding: 14px; }
  .nv-panel__head { padding: 11px 14px; }
  .nv-table th, .nv-table td { padding: 9px 8px; }
  .nv-table th { font-size: 10px; letter-spacing: 0.1em; }
}
