/* ============================================================
   WJAPI — Design System  (Light / Business)
   ------------------------------------------------------------
   视觉母题：仪表盘 / 精密仪器。
   依据：这个产品卖的是「每百万 token 的价格」和「可用率」，
        本质是一块测量仪。结构因此来自刻度、分栏与对齐，
        而不是圆角卡片堆叠。

   浅色商务风的三条准则：
     1. 背景后退，内容前进 —— 页面用冷灰，只让数据与操作占据视觉重量
     2. 一色到底 —— 全站只有一个主色（企业蓝），语义色只在表达状态时出现
     3. 阴影只在"浮起"时用 —— 面板靠 1px 描边区分，不靠投影堆叠

   层级编码（同一套规则贯穿全站）：
     · 数据面（表格/矩阵）  → 6px 圆角，无阴影
     · 容器面（面板）       → 10px 圆角，1px 描边 + 极轻投影
     · 浮层（弹窗）         → 14px 圆角 + 明显投影

   对比度实测（WCAG AA）：
     fg   #0F1729 on #FFFFFF  17.9:1
     fg-2 #475569 on #FFFFFF   7.4:1
     fg-3 #5B6B80 on #FFFFFF   5.5:1
     brand#2563EB on #FFFFFF   5.2:1
   ============================================================ */

:root {
  /* —— 表面层级 —— */
  --bg:         #f5f7fa;
  --surface:    #ffffff;
  --surface-2:  #f2f5f9;
  --surface-3:  #e9eff5;

  /* —— 描边 —— */
  --line:        #e4e9f0;
  --line-strong: #cfd8e3;

  /* —— 文字 —— */
  --fg:   #0f1729;
  --fg-2: #475569;
  --fg-3: #5b6b80;

  /* —— 品牌（企业蓝）—— */
  --brand:      #2563eb;
  --brand-deep: #1d4ed8;
  --brand-dim:  #1d4ed8;
  --brand-wash: rgba(37, 99, 235, 0.07);
  --brand-line: rgba(37, 99, 235, 0.22);
  --brand-glow: rgba(37, 99, 235, 0.25);
  --brand-ink:  #ffffff;

  /* —— 语义：文字色偏深保证可读，填充色更亮用于图形 —— */
  --ok:         #067647;
  --ok-bar:     #12b76a;
  --warn:       #b54708;
  --warn-bar:   #f79009;
  --danger:     #b42318;
  --danger-bar: #f04438;

  /* —— 字体 —— */
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;

  /* —— 圆角（层级编码）—— */
  --r-data: 6px;
  --r-panel: 10px;
  --r-modal: 14px;

  --maxw: 1200px;

  /* —— 阴影（浅色下才成立的三级）—— */
  --sh-panel: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.05);
  --sh-modal: 0 20px 48px rgba(16, 24, 40, 0.16), 0 4px 12px rgba(16, 24, 40, 0.08);
  --sh-raised: 0 1px 2px rgba(16, 24, 40, 0.06);

  /* —— 兼容别名：各页面局部样式仍引用旧名 —— */
  --bg-soft:   var(--surface);
  --panel:     var(--surface);
  --panel-2:   var(--surface-2);
  --line-2:    var(--line-strong);
  --r-sm:      var(--r-data);
  --r-md:      var(--r-panel);
  --r-lg:      var(--r-modal);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  font-feature-settings: "cv05" 1, "ss01" 1;
}

/* 极淡的刻度网格：只在页面上部渐显，给一点测量仪质地 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(37, 99, 235, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(37, 99, 235, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 0%, transparent 76%);
  -webkit-mask-image: radial-gradient(ellipse 90% 55% at 50% 0%, #000 0%, transparent 76%);
}

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

::selection { background: rgba(37, 99, 235, 0.16); color: var(--fg); }

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

/* ---------------- Header ---------------- */

.hd {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.hd-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 34px;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo .dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-wash);
}

/* 品牌标记：渐变 W。尺寸写死，避免 SVG 无内联尺寸时撑大 */
.logo-mark {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}

.nav {
  display: flex;
  gap: 2px;
  flex: 1;
}

.nav a {
  padding: 6px 13px;
  font-size: 13.5px;
  color: var(--fg-2);
  border-radius: var(--r-data);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  position: relative;
}

.nav a:hover { color: var(--fg); background: var(--surface-2); }

.nav a.on { color: var(--fg); font-weight: 600; }

.nav a.on::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: -19px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px 2px 0 0;
}

.hd-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--r-data);
  color: var(--fg-2);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover { background: var(--surface-2); color: var(--fg); }

/* ---------------- Layout ---------------- */

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
  z-index: 1;
}

.pg-head { padding: 44px 0 24px; }

.pg-head h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.022em;
  line-height: 1.2;
}

.pg-head p {
  margin: 0;
  color: var(--fg-2);
  font-size: 13.5px;
}

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--r-data);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--fg);
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  box-shadow: var(--sh-raised);
}

.btn:hover {
  border-color: #b8c5d6;
  background: #fbfcfe;
}

.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.24);
}

.btn-primary:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}

.btn-lg { height: 44px; padding: 0 24px; font-size: 14px; }
.btn-sm { height: 29px; padding: 0 11px; font-size: 12.5px; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fg-2);
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--fg);
}

/* ---------------- Panel ---------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  position: relative;
  overflow: hidden;
  box-shadow: var(--sh-panel);
}

.panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-hd h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* ---------------- Pills / segments ---------------- */

.pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.pill {
  height: 29px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.14s;
  white-space: nowrap;
}

.pill:hover { border-color: var(--line-strong); color: var(--fg); }

.pill.on {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r-data);
  overflow: hidden;
  background: var(--surface-2);
  padding: 2px;
  gap: 2px;
}

.seg button {
  height: 25px;
  padding: 0 11px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--fg-3);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.14s;
}

.seg button.on {
  background: var(--surface);
  color: var(--fg);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.1);
}

.seg button:hover:not(.on) { color: var(--fg); }

/* ---------------- Inputs ---------------- */

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 12.5px;
  color: var(--fg-2);
  font-weight: 500;
}

.input {
  height: 38px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-data);
  color: var(--fg);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
  width: 100%;
}

.input::placeholder { color: #93a1b3; }

.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input-row { display: flex; gap: 10px; }

/* ---------------- Table：仪表盘式数据面 ---------------- */

.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  table-layout: fixed;
}

.tbl thead th {
  text-align: left;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: #fafbfd;
  letter-spacing: 0.01em;
}

/* 数字列右对齐 —— 小数位必须能对齐，这是数据表的基本功 */
.tbl .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 数字簇之间的竖分栏 */
.tbl th.col-num + th.col-num,
.tbl td.col-num + td.col-num {
  border-left: 1px solid var(--line);
}

.tbl tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
}

.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: #f8fafd; }
.tbl tbody tr:last-child td { border-bottom: none; }

/* 数字：等宽 + 表格数字，保证跨行对齐 */
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}

.num-lg {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sub {
  display: block;
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 2px;
  font-family: var(--mono);
  letter-spacing: -0.005em;
}

.strike {
  text-decoration: line-through;
  text-decoration-color: #c3cddb;
  text-decoration-thickness: 1px;
}

/* ---------------- Tags ---------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.tag-save {
  background: var(--brand-wash);
  color: var(--brand-deep);
  border: 1px solid var(--brand-line);
}

.tag-ok { background: #ecfdf3; color: var(--ok); }
.tag-warn { background: #fffaeb; color: var(--warn); }
.tag-danger { background: #fef3f2; color: var(--danger); }
.tag-mute { background: var(--surface-2); color: var(--fg-2); }

/* 厂商角标：2 字符的识别块，固定宽度保证纵向对齐 */
.vendor {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  font-family: var(--mono);
  background: var(--surface-3);
  color: var(--fg-2);
  margin-right: 9px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* ---------------- 节省幅度计（比例条） ---------------- */

.save-meter {
  width: 100%;
  max-width: 62px;
  height: 4px;
  border-radius: 2px;
  background: #e5eaf1;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

.save-meter i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #3b82f6, var(--brand));
}

/* ---------------- Heatmap ---------------- */

.heat { display: flex; gap: 2px; align-items: center; }

.heat i {
  display: block;
  width: 4px;
  height: 18px;
  border-radius: 1px;
  background: #34d399;
}

.heat i.bad { background: var(--danger-bar); opacity: 0.95; }
.heat i.warn { background: var(--warn-bar); opacity: 0.95; }
.heat i.mute { background: #e5eaf1; }

/* ---------------- Utility ---------------- */

.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-2); }
.dim { color: var(--fg-3); }

/* ---------------- Footer ---------------- */

.foot {
  border-top: 1px solid var(--line);
  margin-top: 68px;
  padding: 26px 0 32px;
  background: var(--surface);
}

.foot-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  text-align: center;
}

/* 第一行：品牌 + 公司主体 + 平台定位 + 权利声明 */
.foot-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 6px;
  font-size: 12.5px;
  color: var(--fg-3);
  line-height: 1.7;
}

.foot-logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand);
  margin-right: 2px;
}

/* 用极细分隔符代替空格，让多个条目读起来是一组而不是一句话 */
.foot-sep {
  color: var(--line-strong);
  user-select: none;
  margin: 0 1px;
}

/* 第二行：备案与资质 */
.foot-legal {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 0;
  font-size: 12px;
  color: var(--fg-3);
  line-height: 1.75;
}

.foot-legal a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--fg-3);
  padding: 1px 6px;
  border-radius: 4px;
  transition: color 0.14s, background 0.14s;
}

.foot-license {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--fg-3);
  padding: 1px 6px;
}

.foot-legal a:hover {
  color: var(--brand-deep);
  background: var(--brand-wash);
}

.foot-legal svg {
  flex-shrink: 0;
  opacity: 0.7;
}

/* 竖线分隔 */
.foot-div {
  color: var(--line-strong);
  user-select: none;
  padding: 0 3px;
}

/* 演示数据提示 */
.foot-note {
  font-size: 11.5px;
  color: var(--fg-3);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  margin-top: 2px;
}

@media (max-width: 1040px) {
  .foot-in { padding: 0 18px; }
  .foot-brand, .foot-legal { font-size: 11.5px; }
}

.hint {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--fg-2);
  line-height: 1.65;
}

.hint svg { flex-shrink: 0; margin-top: 2px; color: var(--fg-3); }

/* ---------------- Modal ---------------- */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.34);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.modal {
  width: 100%;
  max-width: 720px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-modal);
  box-shadow: var(--sh-modal);
}

.modal-hd {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.modal-bd {
  padding: 20px 22px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.85;
}

.modal-bd h4 { color: var(--fg); font-size: 13.5px; margin: 20px 0 8px; }
.modal-bd h4:first-child { margin-top: 0; }

.modal-ft {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------------- Scrollbar ---------------- */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 6px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover { background: #a8b6c8; }

/* ---------------- 动效克制 ---------------- */

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

/* ---------------- Responsive ---------------- */

@media (max-width: 1040px) {
  .hd-in { gap: 16px; padding: 0 18px; }
  .nav { overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .wrap { padding: 0 18px; }
  .foot-in { padding: 0 18px; flex-direction: column; gap: 8px; text-align: center; }
}
