/* yybots 管理控制台样式：原生 CSS，无组件库。
 *
 * 一套骨架（顶栏 + 左侧导航 + 内容区），两套皮肤：
 *   light —— 极简中性（纯白、细线、留白分层，强调色近黑）
 *   dark  —— 深色运维台（深底、等宽标识、状态点发光，强调色绿）
 * 主题由 <html data-theme> 切换（index.html 首帧脚本写入，main.ts 负责切换与持久化）。
 * 状态始终「颜色 + 文字」并用，颜色不作为唯一含义。
 *
 * 信息层级（自上而下）：
 *   统计条（一眼看结论）→ 表格/卡片（看细节）→ 脚注（看约束）
 * 正文 13px、辅助 11.5px；表格行高由「主值 + 最多两行辅助」控制，避免行被撑高。
 */

/* 全局隐藏语义：组件级 display（如 .side-nav a 的 flex）不得覆盖
 * hidden 属性——失权/未登录时管理入口必须真正收起（议题 04）。 */
[hidden] {
  display: none !important;
}

:root {
  color-scheme: light;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Consolas,
    "Liberation Mono", monospace;

  /* 版面 */
  --topbar-h: 56px;
  --gap: 16px;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --sidebar-bg: #fbfbfc;
  --line: #e4e7ec;
  --line-soft: #eef0f3;
  --mark-bg: #101318;
  --mark-ink: #ffffff;
  --mark-border: transparent;

  /* 文字 */
  --ink: #0d1117;
  --ink-2: #47505d;
  --ink-3: #69707d;

  /* 交互 */
  --link: #2563eb;
  --focus: #2563eb;
  --row-hover: #f8f9fb;
  --side-hover: #f2f4f7;
  --side-active-bg: #eceff3;
  --side-active-ink: #0d1117;
  --side-active-bar: #0d1117;

  /* 主按钮：明亮模式走近黑 */
  --btn-bg: #101318;
  --btn-bg-hover: #262b33;
  --btn-ink: #ffffff;
  --btn-border: #101318;

  /* 状态色 */
  --ok: #12805c;
  --ok-dot: #16a34a;
  --warn: #8a5a12;
  --warn-dot: #d97706;
  --bad: #a4262c;
  --bad-dot: #dc2626;
  --idle: #69707d;
  --idle-dot: #c3c9d1;

  /* 表格 */
  --th-bg: #fbfbfc;
  --th-ls: 0.04em;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b0e13;
  --surface: #11161e;
  --surface-2: #0d1218;
  --sidebar-bg: #090c11;
  --line: #263040;
  --line-soft: #1c232e;
  --mark-bg: rgba(63, 185, 80, 0.14);
  --mark-ink: #7ee787;
  --mark-border: rgba(63, 185, 80, 0.34);

  --ink: #e6edf3;
  --ink-2: #a7b1bd;
  --ink-3: #8b95a3;

  --link: #6cb6ff;
  --focus: #3fb950;
  --row-hover: #151b24;
  --side-hover: #12181f;
  --side-active-bg: #151d26;
  --side-active-ink: #7ee787;
  --side-active-bar: #3fb950;

  --btn-bg: rgba(63, 185, 80, 0.14);
  --btn-bg-hover: rgba(63, 185, 80, 0.22);
  --btn-ink: #7ee787;
  --btn-border: rgba(63, 185, 80, 0.42);

  --ok: #7ee787;
  --ok-dot: #3fb950;
  --warn: #e3b341;
  --warn-dot: #d29922;
  --bad: #ff7b72;
  --bad-dot: #f85149;
  --idle: #8b95a3;
  --idle-dot: #4a5462;

  --th-bg: #0e131a;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--topbar-h) + 12px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  transition: color 0.12s ease, background-color 0.12s ease;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 仅供屏幕阅读器 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-size: 12.5px;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* ===== 顶栏：品牌 + 只读标识 + 身份 + 刷新 + 主题切换 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--mark-bg);
  border: 1px solid var(--mark-border);
  color: var(--mark-ink);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.brand-name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-name span {
  font-weight: 400;
  color: var(--ink-3);
  margin-left: 2px;
}

.ro-chip {
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

html[data-theme="dark"] .ro-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ok);
  border-color: rgba(63, 185, 80, 0.32);
  background: rgba(63, 185, 80, 0.08);
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-right: 4px;
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.identity b {
  color: var(--ink);
  font-weight: 550;
}

.identity .role {
  padding: 1px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11px;
  color: var(--ink-3);
}

.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  flex: none;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.icon-btn .icon-moon {
  display: none;
}

html[data-theme="dark"] .icon-btn .icon-sun {
  display: none;
}

html[data-theme="dark"] .icon-btn .icon-moon {
  display: block;
}

/* 顶部取数进度条：只提示「正在取数」，不阻塞阅读 */
.progress {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  height: 2px;
  overflow: hidden;
  z-index: 40;
  pointer-events: none;
}

.progress[hidden] {
  display: none;
}

.progress::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 38%;
  background: linear-gradient(90deg, transparent, var(--focus), transparent);
  animation: progress-slide 1.1s ease-in-out infinite;
}

@keyframes progress-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(320%);
  }
}

/* ===== 骨架 ===== */
.shell {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  align-content: start;
  flex: 1;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 10px 14px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  overflow-y: auto;
}

.side-label {
  margin: 0 0 4px;
  padding: 0 10px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13px;
  text-decoration: none;
}

.side-nav a svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--ink-3);
}

.side-nav a:hover {
  background: var(--side-hover);
  color: var(--ink);
}

.side-nav a:hover svg {
  color: var(--ink-2);
}

.side-nav a.active {
  background: var(--side-active-bg);
  color: var(--side-active-ink);
  font-weight: 550;
}

.side-nav a.active svg {
  color: var(--side-active-ink);
}

/* 激活指示条贴在导航项内部左缘，避免看起来像浮在栏外的碎片 */
.side-nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 2px;
  background: var(--side-active-bar);
}

.side-foot {
  margin: auto 0 0;
  padding: 12px 10px 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
}

/* ===== 内容区 ===== */
.view {
  width: 100%;
  max-width: 1440px;
  padding: 24px 28px 56px;
  min-width: 0;
}

.view:focus {
  outline: none;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--gap);
}

.page-title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.012em;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.page-title .mono {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
}

.page-sub {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
}

.page-sub .sep {
  margin: 0 6px;
  color: var(--line);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* 返回链接：小号描边胶囊 */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  text-decoration: none;
  white-space: nowrap;
}

.back-link:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* 次要按钮（重置 / 重试）：与主按钮同高、低权重 */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 12.5px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* 主按钮（登录等关键动作）：与次按钮同高、高权重 */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 16px;
  border: 1px solid var(--accent, #2f6fed);
  border-radius: var(--radius-sm);
  background: var(--accent, #2f6fed);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

/* 小尺寸按钮（顶栏身份区的登录/退出） */
.btn-small {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}

/* ===== 统计条：详情页与列表页顶部的「一眼结论」 ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 1px;
  margin: 0 0 var(--gap);
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stat {
  background: var(--surface);
  padding: 12px 14px 13px;
  min-width: 0;
}

.stat-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.stat-value .state {
  font-size: 13.5px;
  font-weight: 550;
}

.stat-hint {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value .mono {
  font-size: 12.5px;
  font-weight: 500;
}

/* ===== 筛选工具行 ===== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
}

.toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* 第二组筛选（时间区间 + 提交）：整组固定换到第二行，时间在左、按钮靠右，
 * 避免按钮被挤到行尾单独成行，也让「状态筛选 / 时间筛选」两段结构稳定 */
.filter-group {
  display: flex;
  flex: 1 0 100%;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* 提交动作紧跟时间区间，避免单独悬在行尾显得脱节 */
.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 4px;
}

input,
select,
button {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
}

.toolbar input,
.toolbar select,
.toolbar button,
.search-box input,
.search-box button {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 10px;
}

.toolbar input[type="search"],
.search-box input[type="search"] {
  min-width: 210px;
}

.toolbar input[type="date"] {
  width: 122px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--ink-2);
}

/* 日期控件原生图标在深色下几乎不可见，统一反色 */
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.75);
  cursor: pointer;
}

.toolbar input::placeholder,
.search-box input::placeholder {
  color: var(--ink-3);
}

.toolbar select,
.search-box select {
  appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M1 3.2 5 7l4-3.8' fill='none' stroke='%238b939e' stroke-width='1.4' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}

.toolbar input:hover,
.toolbar select:hover,
.search-box input:hover,
.search-box select:hover {
  border-color: var(--ink-3);
}

/* 筛选按钮走次级样式：只读控制台里「取数动作」不该比数据更抢眼 */
.toolbar button,
.search-box button {
  cursor: pointer;
  font-weight: 500;
  padding: 0 14px;
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.toolbar button:hover,
.search-box button:hover {
  background: var(--side-hover);
  border-color: var(--ink-3);
}

.toolbar button:active,
.search-box button:active {
  background: var(--side-active-bg);
}

/* 有筛选条件时出现的「重置」与计数 */
.filter-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.search-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ===== 表格 ===== */
/* overflow: clip 只裁剪圆角，不建立滚动容器，因此表头可相对视口吸顶 */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: clip;
  box-shadow: var(--shadow);
}

table.grid {
  width: 100%;
  border-collapse: collapse;
}

table.grid th {
  position: sticky;
  top: var(--topbar-h);
  z-index: 2;
  padding: 8px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: var(--th-ls);
  color: var(--ink-3);
  background: var(--th-bg);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.grid td {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

table.grid tbody tr:last-child td {
  border-bottom: none;
}

table.grid tbody tr:hover td {
  background: var(--row-hover);
}

table.grid tbody tr td {
  transition: background-color 0.12s ease;
}

/* 末列（时间 / 核对）贴合内容宽度，把剩余空间让给主列，避免右侧大片空白 */
table.grid th:last-child,
table.grid td:last-child {
  width: 1%;
  white-space: nowrap;
}

/* 行内可点击的主标识 */
.id-cell {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}

.cell-link {
  font-size: 13px;
  font-weight: 550;
  color: var(--ink);
  text-decoration: none;
}

.cell-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cell-sub {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-3);
}

.cell-sub .state {
  font-size: 11.5px;
}

.cell-time {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 行内数据异常提示：只借 cell-sub 的小字与颜色，不加胶囊形状，避免与
   左侧状态标记抢眼；统一用 warn 色（红留给状态徽标，异常提示降一档）。 */
.cell-flag {
  color: var(--warn);
  font-weight: 500;
  white-space: nowrap;
}

/* 复制按钮：默认隐形，hover 行或聚焦时出现，避免干扰扫读 */
.copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.copy svg {
  width: 12px;
  height: 12px;
}

.id-cell:hover .copy,
tr:hover .copy,
.copy:focus-visible {
  opacity: 1;
}

.copy:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
  opacity: 1;
}

.copy.copied {
  opacity: 1;
  color: var(--ok);
}

@media (hover: none) {
  .copy {
    opacity: 1;
  }
}

.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* ===== 状态：点 + 文字（颜色不单独承载含义） ===== */
.state {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.45;
  vertical-align: baseline;
}

.state::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  margin-top: 6px;
  border-radius: 50%;
  background: currentColor;
}

html[data-theme="dark"] .state::before {
  box-shadow: 0 0 6px currentColor;
}

.state-ok,
.state-warn,
.state-bad,
.state-unknown {
  color: var(--idle);
}

.state-ok {
  color: var(--ok);
}

.state-warn {
  color: var(--warn);
}

.state-bad {
  color: var(--bad);
}

.state-unknown {
  color: var(--idle);
}

.hint {
  color: var(--ink-3);
  font-size: 11.5px;
}

.note {
  margin: 14px 0 0;
  max-width: 92ch;
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--ink-3);
}

/* ===== 分页 ===== */
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-3);
}

.pager .spacer {
  margin-left: auto;
}

.pager .stamp {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ===== 状态块：加载中 / 空数据 / 未授权 / 失败 ===== */
.state-block {
  padding: 40px 20px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.state-icon {
  width: 26px;
  height: 26px;
  margin: 0 auto 10px;
  display: block;
  color: var(--ink-3);
}

.state-block.error .state-icon {
  color: var(--bad);
}

.state-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink);
}

.state-detail {
  display: block;
  margin: 6px auto 0;
  max-width: 60ch;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-3);
}

.state-block.error .state-title {
  color: var(--bad);
}

.state-block.loading .state-title {
  color: var(--ink-3);
  font-weight: 400;
}

.state-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.state-actions .btn-ghost {
  height: 30px;
}

/* 兼容：仅用于初始占位与个别内联提示 */
.state-loading,
.state-empty,
.state-error {
  margin: 0;
  padding: 40px 20px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-3);
  font-size: 13px;
}

.state-error {
  color: var(--bad);
}

/* ===== 骨架屏：首屏与切页占位，避免整页跳动 ===== */
.skeleton {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.sk {
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--line-soft) 25%,
    var(--line) 37%,
    var(--line-soft) 63%
  );
  background-size: 400% 100%;
  animation: sk-shimmer 1.5s ease-in-out infinite;
}

.sk-title {
  width: 180px;
  height: 18px;
  margin-bottom: 20px;
}

.sk-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.sk-row:last-child {
  border-bottom: none;
}

.sk-row .sk {
  height: 11px;
}

@keyframes sk-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* ===== 详情卡片 ===== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--gap);
  align-items: start;
}

.detail-grid > .card {
  align-self: start;
}

.detail-grid .card,
.detail-grid > .stats {
  margin-bottom: 0;
}

.detail-grid .card.wide {
  grid-column: 1 / -1;
}

.detail-stack {
  max-width: 1080px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: var(--gap);
  box-shadow: var(--shadow);
  min-width: 0;
}

.card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}

/* 卡片内的键值对：宽屏两列、窄屏一列；每个字段「标签在上、值在下」，
 * 比传统 dt/dd 左右两列更省纵向空间，也更适合长标识换行。 */
.card dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px 20px;
  margin: 0;
}

.card .kv {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.card .kv.wide {
  grid-column: 1 / -1;
}

.card dt {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}

.card dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.card dd .state {
  font-size: 12.5px;
}

a.row-link {
  color: var(--link);
  text-decoration: none;
}

a.row-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ===== 调用时间线 ===== */
.timeline {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 0 0 14px;
  border-left: 1px solid var(--line);
}

.timeline li {
  position: relative;
  padding: 2px 0 2px 12px;
  font-size: 12.5px;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--ink-3);
}

/* 已发生里程碑用实心点，未发生的保持空心 */
.timeline li.done::before {
  background: var(--ink-3);
  border-color: var(--ink-3);
}

.tl-label {
  display: inline-block;
  min-width: 68px;
  color: var(--ink-3);
  margin-right: 10px;
}

.tl-time {
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* ===== 提示条 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  transform: translate(-50%, 8px);
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  margin: 24px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--bad);
  font-size: 13px;
}

/* ===== 窄屏：左侧导航转为横向条 ===== */
@media (max-width: 900px) {
  .topbar {
    position: static;
    height: auto;
    min-height: var(--topbar-h);
    padding: 8px 14px;
    flex-wrap: wrap;
    backdrop-filter: none;
  }

  .progress {
    top: 0;
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }

  .side-label,
  .side-foot {
    display: none;
  }

  .side-nav {
    flex-direction: row;
    gap: 4px;
  }

  .side-nav a {
    white-space: nowrap;
  }

  .side-nav a.active::before {
    display: none;
  }

  .view {
    padding: 18px 14px 40px;
  }

  table.grid th {
    top: 0;
  }

  .table-wrap {
    overflow-x: auto;
  }

  table.grid {
    min-width: 960px;
  }

  .stats {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }
}

@media (max-width: 560px) {
  .brand-name span,
  .ro-chip {
    display: none;
  }

  .identity > span:first-child {
    display: none;
  }

  .toolbar input[type="search"],
  .search-box input[type="search"] {
    min-width: 0;
    flex: 1 1 160px;
  }
}

/* 尊重「减少动效」偏好：骨架与进度条退化为静态提示 */
@media (prefers-reduced-motion: reduce) {
  .sk,
  .progress::after {
    animation: none;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}
