/* Air780E 运维控制台 —— 深空蓝暗色工作台主题（v2 重设计）
 *
 * 设计约束（与旧版一致，重设计不放宽）：
 *   · 无构建、无 CDN、无框架：只用原生 CSS，浏览器直接消费。
 *   · 暗色为唯一主题（运维长时间盯屏），状态色在面板底色上对比度 ≥ 3:1。
 *   · 状态色永远同时带文字标签，绝不"只靠颜色"传达语义。
 *   · 任何视口下页面级不得出现横向滚动；宽表格自己滚动或降级成卡片。
 *
 * 布局：桌面为左侧固定边栏（品牌 / 导航 / 链路状态 / 会话操作）+ 内容区；
 * 窄屏边栏折叠为顶部条，导航横向滚动，表格降级为卡片。
 */

:root {
  color-scheme: dark;

  /* ── 表面 ── */
  --bg: #070b12;
  --panel: #0e1520;
  --panel-soft: #131b2a;
  --panel-hover: #182233;
  --inset: #0a101a;

  --line: rgba(148, 166, 199, 0.13);
  --line-strong: rgba(148, 166, 199, 0.27);

  /* ── 文字 ── */
  --text: #e9eef7;
  --text-soft: #b7c3d8;
  --muted: #8291a9;

  /* ── 主色：青 → 蓝渐变体系 ── */
  --accent: #4cc7ea;
  --accent-strong: #6ad6f4;
  --accent-2: #2f8de4;
  --accent-soft: rgba(76, 199, 234, 0.13);
  --accent-ink: #04121b;

  /* ── 状态色（已按面板底色校验对比度 ≥ 3:1；文案永远同行出现）── */
  --ok: #3ecf8e;
  --warn: #f5b04d;
  --danger: #f87168;
  --info: #97a8ff;
  --ok-bg: rgba(62, 207, 142, 0.11);
  --warn-bg: rgba(245, 176, 77, 0.11);
  --danger-bg: rgba(248, 113, 104, 0.12);
  --info-bg: rgba(151, 168, 255, 0.12);

  --focus: #7fd6ea;

  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 8px;

  --shadow-panel: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 32px -20px rgba(0, 0, 0, 0.65);
  --shadow-pop: 0 28px 80px -20px rgba(2, 6, 14, 0.9), 0 0 0 1px rgba(148, 166, 199, 0.09);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; min-width: 0; }

html, body { max-width: 100%; overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 560px at 88% -12%, rgba(99, 118, 241, 0.075), transparent 62%),
    radial-gradient(900px 520px at -12% -4%, rgba(56, 189, 248, 0.07), transparent 58%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }
code, pre, .mono { font-family: var(--mono); }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.hint { display: block; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.5; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ── 滚动条：融入暗色主题 ─────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 166, 199, 0.32) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 166, 199, 0.26);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(148, 166, 199, 0.42); }

/* ── 焦点可见性：键盘用户必须始终看得见焦点 ────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute; top: 0; left: 0; z-index: 100;
  padding: 10px 16px; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; text-decoration: none; transform: translateY(-140%);
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { transform: translateY(0); }

/* ── 减少动效 ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── 品牌 ──────────────────────────────────────────────────────────────── */
.brand, .statusbar-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.mark {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(140deg, var(--accent-strong), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: 0 6px 20px -6px rgba(64, 170, 230, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.mark svg { width: 22px; height: 22px; }
.brand-text { display: grid; min-width: 0; }
.brand-text strong { font-size: 13.5px; letter-spacing: 0.01em; }
.brand-text span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 登录 ──────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: min(420px, 100%); display: grid; gap: 18px; padding: 32px 30px 30px;
  border: 1px solid var(--line-strong); border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 38%),
    var(--panel);
  box-shadow: var(--shadow-pop);
}
.login-title { display: grid; gap: 6px; }
.login-card h1 { font-size: 22px; font-weight: 750; letter-spacing: -0.015em; }
.login-card .muted { font-size: 12.5px; }
.login-card .button.primary { min-height: 40px; }

/* ── 应用外壳：边栏 + 内容 ─────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh; min-height: 100dvh;
}

.sidebar {
  position: sticky; top: 0; z-index: 20;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 20px;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0d1420 0%, #0a101a 100%);
  overflow-y: auto;
}
.sidebar .statusbar-brand { padding: 0 6px; }

/* ── 导航 ──────────────────────────────────────────────────────────────── */
.mainnav { display: grid; gap: 4px; }
.navlink {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px;
  color: var(--text-soft); text-decoration: none;
  font-size: 13.5px; white-space: nowrap;
  transition: background 130ms ease, color 130ms ease;
}
.navlink .navicon { width: 18px; height: 18px; flex: none; opacity: 0.72; transition: opacity 130ms ease; }
.navlink:hover { background: var(--panel-hover); color: var(--text); }
.navlink:hover .navicon { opacity: 1; }
.navlink[aria-current="page"] {
  background: linear-gradient(90deg, var(--accent-soft), rgba(76, 199, 234, 0.04));
  color: var(--accent-strong); font-weight: 650;
}
.navlink[aria-current="page"] .navicon { opacity: 1; }
.navlink[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent-2));
}

/* ── 边栏底部：链路状态 + 会话操作 ─────────────────────────────────────── */
.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }

.statusbar-health { display: grid; gap: 6px; }
.chip {
  display: flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 6px 11px;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 12px;
}
.chip .chip-label { color: var(--muted); flex: 1 1 auto; }
.chip strong { font-weight: 650; font-size: 12px; }
.chip .muted { font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chip.ok { border-color: rgba(62, 207, 142, 0.38); background: var(--ok-bg); }
.chip.warn { border-color: rgba(245, 176, 77, 0.38); background: var(--warn-bg); }
.chip.bad { border-color: rgba(248, 113, 104, 0.4); background: var(--danger-bg); }

.dot { flex: none; width: 8px; height: 8px; border-radius: 999px; background: var(--muted); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.16); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 176, 77, 0.16); }
.dot.bad, .dot.danger { background: var(--danger); box-shadow: 0 0 0 3px rgba(248, 113, 104, 0.16); }
.dot.info { background: var(--info); box-shadow: 0 0 0 3px rgba(151, 168, 255, 0.16); }

.statusbar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── 内容区 ────────────────────────────────────────────────────────────── */
main { padding: clamp(20px, 3vw, 34px) clamp(16px, 3.4vw, 42px) 72px; }
/* #main 是 skip-link / 路由切换的编程焦点容器，本身不可交互；
 * 给它画一整圈焦点轮廓只会框住整页内容，故显式关闭。 */
main:focus, main:focus-visible { outline: none; }

/* 路由渲染的页面根节点是一个裸 div，页面级纵向节奏统一在这里定义；
 * 嵌套的 .view（设备详情 / 工作台内嵌视图）沿用同一节奏。 */
.view, #view > div { display: grid; gap: 18px; align-content: start; }
#view { max-width: 1320px; }

/* ── 页头 ──────────────────────────────────────────────────────────────── */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.page-head h1 { font-size: 22px; font-weight: 750; letter-spacing: -0.015em; }
.page-head .spacer { flex: 1 1 auto; }
.page-sub { color: var(--muted); font-size: 12.5px; margin-top: 5px; }

/* ── 面板 ──────────────────────────────────────────────────────────────── */
.panel {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 46%),
    var(--panel);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.panel-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 13px 18px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}
.panel-head h2 { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; color: var(--text); }
.panel-head h2::before {
  content: ""; flex: none; width: 3px; height: 14px; border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent-2));
}
.panel-head .spacer { flex: 1 1 auto; }
.panel-body { padding: 18px; display: grid; gap: 14px; }
.section-title { font-size: 13px; color: var(--text-soft); font-weight: 650; }

/* ── 按钮 ──────────────────────────────────────────────────────────────── */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: rgba(151, 168, 199, 0.08); color: var(--text);
  cursor: pointer; white-space: nowrap; font-size: 13px;
  transition: background 130ms ease, border-color 130ms ease, box-shadow 130ms ease, filter 130ms ease;
}
.button:hover:not(:disabled) { background: rgba(151, 168, 199, 0.15); border-color: rgba(76, 199, 234, 0.55); }
.button.primary {
  border-color: rgba(106, 214, 244, 0.45);
  background: linear-gradient(135deg, #5fd4f2, var(--accent-2));
  color: var(--accent-ink); font-weight: 700;
  box-shadow: 0 8px 22px -10px rgba(64, 170, 230, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.button.primary:hover:not(:disabled) { filter: brightness(1.08); }
.button.danger { border-color: rgba(248, 113, 104, 0.5); background: var(--danger-bg); color: var(--danger); }
.button.danger:hover:not(:disabled) { background: rgba(248, 113, 104, 0.22); border-color: rgba(248, 113, 104, 0.7); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.button.mini { min-height: 27px; padding: 0 10px; font-size: 12px; border-radius: 7px; }

/* ── 表单 ──────────────────────────────────────────────────────────────── */
/* align-content: start：form-row 里两个 .field 高度被拉平时，多余空间收在底部，
 * 避免行数少的字段（无 hint）标签行被撑高、控件被推下去，与邻列错位。 */
.field { display: grid; gap: 6px; align-content: start; color: var(--text-soft); font-size: 12.5px; font-weight: 600; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--inset); color: var(--text); font-weight: 400;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}
input, select { height: 38px; padding: 0 12px; }
textarea { min-height: 112px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px rgba(76, 199, 234, 0.18);
}
input:disabled, textarea:disabled, select:disabled { opacity: 0.55; cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] {
  width: 15px; height: 15px; margin: 3px 0 0; accent-color: var(--accent); flex: none;
}
input[type="checkbox"]:focus, input[type="radio"]:focus { box-shadow: none; }
input[type="file"] { height: auto; padding: 8px 12px; }
input::placeholder, textarea::placeholder { color: rgba(130, 145, 169, 0.65); }

.form-grid { display: grid; gap: 13px; }
.form-row { display: grid; gap: 13px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; font-weight: 400; }
.check-row > span { display: grid; gap: 2px; }
.choice {
  display: grid; gap: 12px; margin: 0; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, 0.015);
}
.choice legend { padding: 0 6px; color: var(--text-soft); font-size: 12.5px; font-weight: 650; }

.counter { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11.5px; }
.counter.over { color: var(--danger); font-weight: 650; }

/* ── 指标块（机队总览 KPI 行）──────────────────────────────────────────── */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric {
  padding: 14px 16px 15px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 55%),
    var(--panel);
  box-shadow: var(--shadow-panel);
}
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 7px; font-size: 27px; line-height: 1.05; font-weight: 700; letter-spacing: -0.02em; }
.metric.bad strong { color: var(--danger); }
.metric.warn strong { color: var(--warn); }
.metric.ok strong { color: var(--ok); }

/* ── 过滤条 ────────────────────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filters .search { flex: 1 1 230px; max-width: 380px; }
.chipbar { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbar button {
  min-height: 30px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--text-soft); cursor: pointer; font-size: 12.5px;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
}
.chipbar button:hover { background: var(--panel-hover); color: var(--text); }
.chipbar button[aria-pressed="true"] {
  border-color: rgba(76, 199, 234, 0.6); background: var(--accent-soft);
  color: var(--accent-strong); font-weight: 650;
}
/* 设备详情分区（chipbar 里的 mini 链接按钮） */
.chipbar .button.mini[aria-current="page"] {
  border-color: rgba(76, 199, 234, 0.6); background: var(--accent-soft);
  color: var(--accent-strong); font-weight: 650;
}
.chipbar a.button { text-decoration: none; }

/* ── 表格 ──────────────────────────────────────────────────────────────── */
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 12.8px; }
th {
  position: sticky; top: 0; z-index: 1;
  background: var(--panel-soft); color: var(--muted);
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.04em; white-space: nowrap;
}
tbody tr { transition: background 100ms ease; }
tbody tr:hover { background: rgba(76, 199, 234, 0.05); }
tbody tr[data-clickable] { cursor: pointer; }
tbody tr:last-child td { border-bottom: 0; }
td.content { max-width: 340px; overflow-wrap: anywhere; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.actions { white-space: nowrap; }
td.actions .button + .button { margin-left: 6px; }
.empty-row td { color: var(--muted); text-align: center; padding: 26px 14px; }

.linkish {
  border: 0; padding: 0; background: none; color: var(--accent);
  cursor: pointer; font: inherit; font-weight: 550; text-align: left;
  text-decoration: none; overflow-wrap: anywhere;
}
.linkish:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }

/* ── 标签 ──────────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 22px; padding: 0 9px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: rgba(151, 168, 199, 0.07); color: var(--text-soft);
  font-size: 11.5px; font-weight: 550; white-space: nowrap;
}
/* 状态类标签带一颗小圆点：色点 + 文字双通道，且不依赖 JS 结构 */
.tag.ok, .tag.warn, .tag.bad, .tag.info { padding-left: 8px; }
.tag.ok::before, .tag.warn::before, .tag.bad::before, .tag.info::before {
  content: ""; flex: none; width: 6px; height: 6px; border-radius: 999px; background: currentColor;
}
.tag.ok { border-color: rgba(62, 207, 142, 0.45); background: var(--ok-bg); color: var(--ok); }
.tag.warn { border-color: rgba(245, 176, 77, 0.45); background: var(--warn-bg); color: var(--warn); }
.tag.bad { border-color: rgba(248, 113, 104, 0.48); background: var(--danger-bg); color: var(--danger); }
.tag.info { border-color: rgba(151, 168, 255, 0.45); background: var(--info-bg); color: var(--info); }
.tag.mono { font-family: var(--mono); font-size: 11px; }
.taglist { display: flex; flex-wrap: wrap; gap: 5px; }

/* ── 键值卡片 ──────────────────────────────────────────────────────────── */
.kv {
  display: grid; gap: 8px; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, 0.015);
}
.kv-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 14px; font-size: 12.5px; }
.kv-row > span { color: var(--muted); }
.kv-row > strong { font-weight: 650; text-align: right; overflow-wrap: anywhere; }
/* 计数器不为零时加重量，文案里同时写明「需关注」——颜色只是补充，不是唯一信号。 */
.kv-row.warn > strong { color: var(--warn); }
.kv-row.bad > strong { color: var(--danger); }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px; }
.card-item {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
}
.card-item > span { display: block; color: var(--muted); font-size: 11px; }
.card-item > strong { display: block; margin-top: 5px; font-size: 13.5px; font-weight: 650; overflow-wrap: anywhere; }
/* 说明文字与数值同框：原始码、单位、哨兵值语义必须和读数一起被看见，
 * 否则「隐藏了 0」「GB 与字节不合并」这类有意的取舍会被当成缺陷。 */
.card-item > .card-note { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.card-item.ok { border-color: rgba(62, 207, 142, 0.4); background: var(--ok-bg); }
.card-item.ok > strong { color: var(--ok); }
.card-item.bad { border-color: rgba(248, 113, 104, 0.42); background: var(--danger-bg); }
.card-item.bad > strong { color: var(--danger); }
.card-item.warn { border-color: rgba(245, 176, 77, 0.4); background: var(--warn-bg); }
.card-item.warn > strong { color: var(--warn); }
.card-empty { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; padding: 6px 2px; }

.health-details { display: grid; gap: 9px; }
.health-details > summary {
  width: fit-content; cursor: pointer; color: var(--text-soft); font-size: 12.5px; font-weight: 650;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px;
  transition: background 130ms ease, border-color 130ms ease;
}
.health-details > summary:hover { background: var(--panel-hover); border-color: var(--line-strong); }
.health-details[open] > summary { margin-bottom: 2px; }
.health-details > .kv { margin-top: 0; }

/* ── 横幅 ──────────────────────────────────────────────────────────────── */
.banner {
  padding: 12px 14px; border: 1px solid var(--line-strong); border-left-width: 3px;
  border-radius: var(--radius); background: rgba(255, 255, 255, 0.02);
  font-size: 13px; line-height: 1.6;
}
.banner.warn { border-color: rgba(245, 176, 77, 0.4); border-left-color: var(--warn); background: var(--warn-bg); color: #f2d6a4; }
.banner.danger { border-color: rgba(248, 113, 104, 0.42); border-left-color: var(--danger); background: var(--danger-bg); color: #fbb7b1; }
.banner.info { border-color: rgba(151, 168, 255, 0.4); border-left-color: var(--info); background: var(--info-bg); color: #c3cdfa; }
.banner strong { color: var(--text); }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.evidence {
  display: grid; gap: 7px; margin: 0; padding: 13px 14px; list-style: none;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--inset);
}
.evidence li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 14px; font-size: 12.5px; }
.evidence li > span { color: var(--muted); }
.evidence li > strong { font-family: var(--mono); font-size: 11.5px; font-weight: 600; overflow-wrap: anywhere; text-align: right; }

/* ── OTA 阶段进度 ──────────────────────────────────────────────────────── */
.stages { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.stage {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255, 255, 255, 0.015); color: var(--muted); font-size: 11px; white-space: nowrap;
}
/* 完成 / 失败给出形状记号，进行中给出实心点：不靠颜色单独传达。 */
.stage.done { border-color: rgba(62, 207, 142, 0.4); color: var(--ok); background: rgba(62, 207, 142, 0.07); }
.stage.done::before { content: "✓"; font-size: 10px; font-weight: 700; }
.stage.current {
  border-color: rgba(76, 199, 234, 0.65); background: var(--accent-soft);
  color: var(--accent-strong); font-weight: 650;
}
.stage.current::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.stage.failed { border-color: rgba(248, 113, 104, 0.5); background: var(--danger-bg); color: var(--danger); font-weight: 650; }
.stage.failed::before { content: "✕"; font-size: 10px; font-weight: 700; }

/* ── 代码块 ────────────────────────────────────────────────────────────── */
.snippet {
  margin: 0; padding: 13px 14px; max-height: 280px; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--inset); color: #cfe0f2; font-size: 11.8px; line-height: 1.65;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* ── 对话框 ────────────────────────────────────────────────────────────── */
dialog {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
  overflow: auto; overscroll-behavior: contain;
  padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 40%),
    var(--panel);
  color: var(--text); box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: rgba(3, 6, 12, 0.68); backdrop-filter: blur(5px); }
.dialog-body { display: grid; gap: 15px; padding: 22px; }
.dialog-body h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  max-width: min(440px, calc(100vw - 36px));
  padding: 12px 15px; border: 1px solid var(--line-strong); border-left: 3px solid var(--accent);
  border-radius: var(--radius); background: #101827; box-shadow: var(--shadow-pop);
  font-size: 13px;
  opacity: 0; transform: translateY(14px); transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.bad, .dialog-toast.bad { border-left-color: var(--danger); }
.dialog-toast {
  padding: 10px 13px; border: 1px solid var(--line-strong); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); background: #101827; font-size: 12.5px;
}

/* ── 窄屏：边栏折叠为顶部条；宽表格降级成卡片，杜绝页面级横向滚动 ──────── */
@media (max-width: 960px) {
  .shell { display: block; }
  .sidebar {
    position: static; height: auto;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 14px 14px 12px; gap: 12px; overflow: visible;
  }
  .mainnav { display: flex; overflow-x: auto; padding-bottom: 2px; }
  .navlink { padding: 8px 12px; flex: none; }
  .navlink[aria-current="page"]::before { display: none; }
  .sidebar-foot { margin-top: 0; }
  .statusbar-health { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .metrics { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
  .statusbar-health { grid-template-columns: 1fr; }

  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive thead { display: none; }
  table.responsive tr { padding: 11px 14px; border-bottom: 1px solid var(--line); }
  table.responsive tr:last-child { border-bottom: 0; }
  table.responsive td { border: 0; padding: 3px 0; display: flex; gap: 12px; justify-content: space-between; }
  table.responsive td::before {
    content: attr(data-label); flex: none; color: var(--muted); font-size: 11.5px; font-weight: 600;
  }
  table.responsive td.content { max-width: none; }
  table.responsive tr.empty-row td { justify-content: center; }
  table.responsive tr.empty-row td::before { content: ""; }
}
