/* 鲸鱼娘 · 夜航台 —— 深海控制台视觉系统
   只改视觉与骨架，接口与路由沿用 src/web/routes.py */

:root {
  --bg-0: #040a14;
  --bg-1: #071222;
  --bg-2: #0b1a2c;
  --surface: rgba(14, 26, 44, 0.72);
  --surface-solid: #111b2c;
  --line: rgba(150, 170, 205, 0.14);
  --line-strong: rgba(150, 170, 205, 0.26);

  --text: #e7edf8;
  --text-dim: #a3b2cc;
  --text-mute: #7d8ca8;

  --lilac: #6fa8ff;
  --lilac-dim: rgba(111, 168, 255, 0.16);
  --cyan: #6ee7f9;
  --ok: #7fe3e8;
  --warn: #f2a0b0;
  --bad: #e5545b;
  --deep: #2b3a8f;
  --whale: #6fa8ff;
  --bubble: #7fe3e8;
  --blush: #f2a0b0;

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow: 0 18px 48px -24px rgba(0, 0, 0, 0.9);

  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }

html { background: #04080f; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  background-color: #04080f;
  background-image:
    radial-gradient(1200px 620px at 8% -12%, rgba(43, 58, 143, 0.42), transparent 64%),
    radial-gradient(900px 520px at 96% 0%, rgba(42, 120, 160, 0.20), transparent 58%),
    radial-gradient(1400px 460px at 50% 118%, rgba(127, 227, 232, 0.10), transparent 66%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 62%, #02060d 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

/* 底部极淡的海面光带，只在页脚出现，不干扰正文 */
body::after {
  content: "";
  position: fixed;
  inset: auto 0 0 0;
  height: 220px;
  background: linear-gradient(180deg, transparent, rgba(110, 231, 249, 0.045));
  pointer-events: none;
  z-index: 0;
}

a { color: var(--cyan); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── 外壳 ───────────────────────────────────────────── */

.shell {
  position: relative;
  z-index: 1;
  max-width: 1580px;
  margin: 0 auto;
  padding: 22px 28px 72px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(24, 36, 58, 0.9), rgba(13, 21, 35, 0.86));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 14px;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(111, 168, 255, 0.32);
  background:
    radial-gradient(circle at 50% 20%, rgba(111, 168, 255, 0.36), transparent 72%),
    #121d31;
  display: grid; place-items: center;
  overflow: hidden;
  flex: none;
}
.brand-mark img {
  width: 126%;
  height: 126%;
  object-fit: contain;
  object-position: 50% 18%;
  opacity: 0.95;
}


.brand-copy { min-width: 0; }
.brand-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-title em { font-style: normal; color: var(--lilac); }
.brand-sub {
  margin: 1px 0 0;
  font-size: 10.5px;
  color: #5f7395;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* 平台切换 */
.tabs { display: flex; gap: 2px; margin-left: 6px; position: relative; }
.tab {
  appearance: none;
  border: 0;
  background: none;
  color: var(--text-mute);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13.5px;
  display: flex; align-items: center; gap: 7px;
  transition: color 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}
.tab:hover { color: var(--text-dim); background: rgba(255, 255, 255, 0.03); }
.tab[aria-selected="true"] {
  color: var(--text);
  background: var(--lilac-dim);
  box-shadow: inset 0 0 0 1px rgba(111, 168, 255, 0.28);
}
.tab .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: 0.6;
}
.tab[aria-selected="true"] .dot { background: var(--lilac); opacity: 1; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}
.pill .led {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-mute);
  flex: none;
}
.pill[data-state="ok"] { color: #c8f4f6; border-color: rgba(127, 227, 232, 0.34); background: rgba(127, 227, 232, 0.08); }
.pill[data-state="ok"] .led { background: var(--ok); box-shadow: 0 0 0 3px rgba(127, 227, 232, 0.16); animation: breathe 3.4s ease-in-out infinite; }
.pill[data-state="warn"] { color: #ffd0da; border-color: rgba(242, 160, 176, 0.34); background: rgba(242, 160, 176, 0.08); }
.pill[data-state="warn"] .led { background: var(--warn); }
.pill[data-state="bad"] { color: #ffc5c8; border-color: rgba(229, 84, 91, 0.34); background: rgba(229, 84, 91, 0.08); }
.pill[data-state="bad"] .led { background: var(--bad); box-shadow: 0 0 0 3px rgba(229, 84, 91, 0.14); }

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(111, 168, 255, 0.34); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #8cc0ff, #6fa8ff);
  border-color: transparent;
  color: #06131f;
  font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(180deg, #a2cdff, #82b6ff); }
.btn-ghost { border-color: transparent; background: none; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.btn-danger { color: #ffc5c8; border-color: rgba(229, 84, 91, 0.36); background: rgba(229, 84, 91, 0.08); }
.btn-danger:hover { background: rgba(229, 84, 91, 0.14); }

.page { display: none; padding-top: 26px; }
.page.active { display: block; }

.kpi-value {
  margin-top: 7px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 8px;
}
.kpi-value[data-state="ok"] { color: #d8f8fa; }
.kpi-value[data-state="warn"] { color: #ffd0da; }
.kpi-value[data-state="bad"] { color: #ffc9cc; }

/* ── 主体两栏 ───────────────────────────────────────── */

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.panel + .panel { margin-top: 16px; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.panel-head .sub {
  font-size: 12px;
  color: var(--text-mute);
  margin-left: 2px;
}
.panel-head .spacer { margin-left: auto; }
.panel-body { padding: 16px 18px; }
.panel-body.flush { padding: 0; }

/* 消息流 */
.stream { max-height: 420px; overflow-y: auto; }
@media (min-width: 861px) {
  #stream:not(:has(.stream-empty)) { min-height: 268px; }
}
.stream-row {
  display: grid;
  grid-template-columns: 62px 96px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid rgba(150, 170, 205, 0.07);
  font-size: 13px;
  animation: rise 0.24s ease both;
}
.stream-row:last-child { border-bottom: 0; }
.stream-time { color: var(--text-mute); font-family: var(--mono); font-size: 11.5px; padding-top: 2px; }
.stream-who { color: var(--lilac); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream-text { color: var(--text-dim); word-break: break-word; }
.stream-empty { padding: 44px 18px; text-align: center; color: var(--text-mute); }

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* 观测表 */
.table-wrap { overflow-x: auto; }
table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
table.grid th, table.grid td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid rgba(150, 170, 205, 0.07);
  white-space: nowrap;
}
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid thead th {
  color: var(--text-mute);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.02);
}
table.grid tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.num-zero { color: var(--text-mute); }

/* 右栏表单 */
.field { display: block; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > span {
  display: block;
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 5px;
}
.input, select.input {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: rgba(6, 12, 22, 0.66);
  color: var(--text);
  transition: border-color 0.16s ease;
}
.input:focus { border-color: rgba(111, 168, 255, 0.5); outline: none; }
.input::placeholder { color: var(--text-mute); }

.row-inline { display: flex; gap: 8px; }
.row-inline .input { flex: 1; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(111, 168, 255, 0.12);
  border: 1px solid rgba(111, 168, 255, 0.22);
  font-size: 12px;
  color: #cfe3ff;
  margin: 0 6px 6px 0;
}
.tag button {
  border: 0; background: none; color: inherit; cursor: pointer;
  opacity: 0.6; padding: 0 0 0 2px; line-height: 1;
}
.tag button:hover { opacity: 1; }

.empty {
  padding: 26px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  color: var(--text-mute);
  font-size: 12.5px;
  text-align: center;
  line-height: 1.7;
}
.empty strong { display: block; color: var(--text-dim); font-weight: 500; margin-bottom: 2px; }

.note {
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.7;
  margin: 10px 0 0;
}
.note b { color: var(--text-dim); font-weight: 500; }

/* ── 配置抽屉 ───────────────────────────────────────── */

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(3, 7, 14, 0.62);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 60;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 92vw);
  background: linear-gradient(180deg, #101a2b, #0a1220);
  border-left: 1px solid var(--line-strong);
  box-shadow: -30px 0 70px -40px #000;
  transform: translateX(102%);
  transition: transform 0.26s cubic-bezier(0.22, 0.9, 0.24, 1);
  z-index: 70;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: none; }

.drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font-size: 15px; }
.drawer-tabs { display: flex; gap: 4px; padding: 12px 20px 0; flex-wrap: wrap; }
.drawer-tab {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-mute);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12.5px;
}
.drawer-tab[aria-selected="true"] {
  color: var(--text);
  background: var(--lilac-dim);
  border-color: rgba(111, 168, 255, 0.3);
}
.drawer-body { padding: 18px 20px 40px; overflow-y: auto; }
.drawer-pane { display: none; }
.drawer-pane.active { display: block; }

/* 占位页（其余四个平台页重建中） */
.placeholder {
  padding: 72px 24px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.placeholder h2 { margin: 0 0 8px; font-size: 17px; }
.placeholder p { margin: 0 auto 18px; max-width: 46ch; color: var(--text-dim); line-height: 1.8; }
.placeholder img,
.placeholder .placeholder-art {
  width: 170px;
  margin: 0 auto 20px;
  display: block;
  opacity: 0.42;
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(closest-side, #000 42%, transparent 78%);
  mask-image: radial-gradient(closest-side, #000 42%, transparent 78%);
}

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translate(-50%, 16px);
  background: #182540;
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 指标网格 */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.metric {
  background: rgba(9, 16, 28, 0.72);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.metric span { font-size: 11.5px; color: var(--text-mute); letter-spacing: 0.04em; }
.metric b {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ── 响应式 ─────────────────────────────────────────── */

@media (max-width: 1180px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .shell { padding: 12px 12px 56px; }
  .whale-watermark { display: none; }
  .foot { margin-top: 26px; padding: 14px 14px 6px; }
  .topbar {
    position: static;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }
  .tabs {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .topbar-actions { margin-left: auto; }
  .brand-sub { display: none; }
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 13px 14px 12px; }
  .kpi-value { font-size: 18px; }
  .stream-row { grid-template-columns: 52px minmax(0, 1fr); row-gap: 2px; padding: 10px 14px; }
  .stream-who { grid-column: 2; grid-row: 1; }
  .stream-text { grid-column: 2; grid-row: 2; }
  .stream-time { grid-row: 1 / span 2; }
  .panel-body { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── 状态裁决区（替代四等分 KPI） ─────────────────── */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.72fr);
  gap: 8px;
  padding: 26px 30px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    radial-gradient(720px 320px at 8% -20%, rgba(111, 168, 255, 0.10), transparent 66%),
    linear-gradient(180deg, rgba(20, 31, 50, 0.86), rgba(11, 18, 31, 0.9));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero[data-state="bad"] {
  background:
    radial-gradient(720px 320px at 8% -20%, rgba(229, 84, 91, 0.10), transparent 66%),
    linear-gradient(180deg, rgba(24, 30, 48, 0.9), rgba(11, 18, 31, 0.92));
}
.hero[data-state="ok"] {
  background:
    radial-gradient(720px 320px at 8% -20%, rgba(127, 227, 232, 0.09), transparent 66%),
    linear-gradient(180deg, rgba(19, 33, 48, 0.9), rgba(11, 18, 31, 0.92));
}

.hero-copy { position: relative; z-index: 2; min-width: 0; }

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 10px;
}
.hero-kicker .led {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 0 4px rgba(229, 84, 91, 0.14);
}
.hero[data-state="ok"] .hero-kicker .led { background: var(--ok); box-shadow: 0 0 0 4px rgba(127, 227, 232, 0.14); animation: breathe 3.4s ease-in-out infinite; }
.hero[data-state="warn"] .hero-kicker .led { background: var(--warn); box-shadow: 0 0 0 4px rgba(242, 160, 176, 0.14); }

.hero-title {
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  margin: 0 0 8px;
  font-size: clamp(21px, 2.2vw, 30px);
  line-height: 1.28;
  font-weight: 750;
  letter-spacing: -0.022em;
  text-wrap: pretty;
  max-width: 26ch;
}
.hero-sub {
  margin: 0 0 20px;
  color: var(--text-dim);
  font-size: 13.5px;
  max-width: 46ch;
}

.hero-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-note { font-size: 12px; color: var(--text-mute); max-width: 36ch; }

.hero-art {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.hero-art img {
  width: 100%;
  max-width: 258px;
  margin-bottom: -26px;
  opacity: 0.95;
  filter: saturate(0.92) drop-shadow(0 18px 42px rgba(56, 104, 200, 0.24));
  -webkit-mask-image: radial-gradient(closest-side at 50% 46%, #000 62%, transparent 90%);
  mask-image: radial-gradient(closest-side at 50% 46%, #000 62%, transparent 90%);
}

/* 消息列标签：空的时候也知道这一栏要装什么 */
.stream-legend {
  display: grid;
  grid-template-columns: 62px 96px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
}

/* 出口计数：两个主角 + 六个次级 */
.metrics-lead {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}
.metric-lg {
  background: rgba(9, 16, 28, 0.72);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
}
.metric-lg span { font-size: 11.5px; letter-spacing: 0.1em; color: var(--text-mute); text-transform: uppercase; }
.metric-lg b {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.metric-lg em { font-style: normal; font-size: 12px; color: var(--text-mute); }

.metrics-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.metrics-row .metric { background: rgba(9, 16, 28, 0.6); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.metrics-row .metric span { font-size: 11px; color: var(--text-mute); letter-spacing: 0.04em; }
.metrics-row .metric b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* 监听范围：能看到改动是否真的生效 */
.scope-block + .scope-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.scope-title {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12px; color: var(--text-mute);
  letter-spacing: 0.06em;
  margin-bottom: 9px;
}
.scope-title b { color: var(--text-dim); font-weight: 600; font-variant-numeric: tabular-nums; }
.scope-block .row-inline { margin-top: 10px; }
.tag[data-live="on"] { border-color: rgba(127, 227, 232, 0.3); background: rgba(127, 227, 232, 0.1); color: #c8f4f6; }
.tag[data-live="off"] { opacity: 0.72; }

.log-panel { margin-top: 16px; }

/* 移动端：裁决区收成一列，插画退到标题后面 */
@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px 16px 18px;
  }
  .hero-art {
    position: absolute;
    right: -26px;
    top: 6px;
    width: 190px;
    opacity: 0.16;
  }
  .hero-art img { width: 190px; margin: 0; }
  .hero-sub { margin-bottom: 16px; }
  .chain { gap: 6px; }
  .chain-node { border-radius: 10px; border-right: 1px solid var(--line); min-width: 0; flex: 1 1 calc(50% - 6px); }
  .chain-node:first-child, .chain-node:last-child { border-radius: 10px; }
  .hero-actions { gap: 8px; }
  .hero-note { max-width: none; }
  .stream-legend { grid-template-columns: 52px minmax(0, 1fr); }
  .stream-legend span:nth-child(2) { display: none; }
  .metrics-lead { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-lg b { font-size: 24px; }
  .metrics-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tabs {
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 88%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 88%, transparent 100%);
    padding-right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-kicker .led { animation: none !important; }
}

/* ── 状态脊柱：断点靠位置说话，不靠文案重复 ───────── */

.hero {
  grid-template-columns: 176px minmax(0, 1fr) 236px;
  align-items: start;
}

.spine {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 2px 0 0;
}
.spine-node {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  column-gap: 11px;
  padding: 7px 0;
}
.spine-node i {
  grid-column: 1;
  grid-row: 1 / span 2;
  position: relative;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-top: 7px;
  justify-self: center;
  background: rgba(150, 170, 205, 0.4);
}
.spine-node i::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 13px;
  width: 1px;
  height: 30px;
  transform: translateX(-50%);
  background: rgba(150, 170, 205, 0.22);
}
.spine-node:last-child i::after { display: none; }

.spine-node b,
.spine-node span { grid-column: 2; }

.spine-node b {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.spine-node span {
  display: block;
  font-size: 13.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.spine-node[data-state="ok"] i { background: var(--ok); box-shadow: 0 0 0 3px rgba(127, 227, 232, 0.14); }
.spine-node[data-state="ok"] span { color: #bff0f3; }
.spine-node[data-state="bad"] i {
  background: var(--bad);
  box-shadow: 0 0 0 4px rgba(229, 84, 91, 0.16);
  animation: breathe 2.6s ease-in-out infinite;
}
.spine-node[data-state="bad"] span { color: #ffc5c8; }
.spine-node[data-state="bad"] i::after {
  background: repeating-linear-gradient(180deg, rgba(229, 84, 91, 0.45) 0 4px, transparent 4px 9px);
}
.spine-node[data-state="blocked"] { opacity: 0.45; }
.spine-node[data-state="blocked"] i { background: transparent; border: 1px dashed rgba(150, 170, 205, 0.45); }
.spine-node[data-state="blocked"] i::after { background: repeating-linear-gradient(180deg, rgba(150, 170, 205, 0.3) 0 3px, transparent 3px 9px); }

/* 证据：状态旁边永远有可搜的线索 */
.evidence {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(6, 12, 22, 0.42);
}
.evidence dt {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 3px;
}
.evidence dd {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
  font-family: var(--mono);
  word-break: break-word;
  line-height: 1.55;
  max-height: 3.2em;
  overflow: hidden;
}

.updated {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 移动端：脊柱转横排，插画退出文字区 */
@media (max-width: 1180px) {
  .hero { grid-template-columns: 156px minmax(0, 1fr); }
  .hero-art { display: none; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .spine {
    flex-direction: row;
    gap: 4px;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 16px;
  }
  .spine-node {
    flex: 1 1 0;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    padding: 0;
  }
  .spine-node i { grid-column: 1; grid-row: auto; margin: 0 0 7px; }
  .spine-node b, .spine-node span { grid-column: 1; }
  .spine-node i::after { display: none; }
  .spine-node b { font-size: 10px; letter-spacing: 0.06em; }
  .spine-node span { font-size: 12px; }
  .evidence { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .updated { width: 100%; margin-left: 0; }
  .hero-actions { gap: 8px 10px; }
  .stream-legend { grid-template-columns: 44px 66px minmax(0, 1fr); }
  .stream-legend span:nth-child(2) { display: inline; }
  #stream .stream-empty, #log-stream .stream-empty { max-height: 148px; overflow: hidden; }
}


/* ── 主张：这条链路我在看着它 ───────────────────────
   断开时断点上有一枚 1.2s 呼吸点；全通时它变成沿脊柱向下流动的光点。 */

.spine-node[data-state="bad"] i::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid rgba(229, 84, 91, 0.55);
  animation: pulse-ring 1.2s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 0.85; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { opacity: 0; }
}

.spine[data-flow="on"]::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 12px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--bubble);
  box-shadow: 0 0 8px 2px rgba(127, 227, 232, 0.55);
  animation: flow-down 2.6s linear infinite;
}
@keyframes flow-down {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateY(104px); opacity: 0; }
}

.spine-node[data-state="ok"] i {
  box-shadow: 0 0 0 3px rgba(127, 227, 232, 0.12), 0 0 10px rgba(127, 227, 232, 0.35);
}

/* 品牌标识：月白细边 + 鲸蓝内光，不再用紫薯描边 */
.brand-mark {
  border-color: rgba(111, 168, 255, 0.3);
  background:
    radial-gradient(circle at 50% 18%, rgba(127, 227, 232, 0.22), transparent 70%),
    #0d1b2e;
}

@media (prefers-reduced-motion: reduce) {
  .spine-node[data-state="bad"] i::before,
  .spine[data-flow="on"]::after { animation: none !important; opacity: 0; }
}


/* 水面反光：卡片上沿一道极淡的冷光，替代通用后台的纯描边 */
.panel, .hero {
  box-shadow: var(--shadow), inset 0 1px 0 rgba(196, 233, 255, 0.06);
}

/* 正文里的数字统一等宽字形 */
.kpi-value, .metric b, .metric-lg b, .spine-node span,
#updated, .evidence dd, .stream-time { font-variant-numeric: tabular-nums; }

/* ── 第三轮修正：空态当待办、单一红源、监听范围升权 ── */

[hidden] { display: none !important; }

/* 断点不再用红（红只留给顶栏那一个），改用"待处理"的腮红色 */
.spine-node[data-state="warn"] i {
  background: var(--blush);
  box-shadow: 0 0 0 4px rgba(242, 160, 176, 0.14);
  animation: breathe 2.8s ease-in-out infinite;
}
.spine-node[data-state="warn"] span { color: #ffd0da; }
.spine-node[data-state="warn"] i::after {
  background: repeating-linear-gradient(180deg, rgba(242, 160, 176, 0.45) 0 4px, transparent 4px 9px);
}

.hero-kicker { gap: 0; }
.hero-kicker::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--blush);
  margin-right: 8px;
}

/* 待办：首屏回答"该我做什么" */
.todo {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.todo li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  column-gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(6, 12, 22, 0.38);
  border: 1px solid transparent;
  line-height: 1.5;
}
.todo li[data-state="now"] { border-color: rgba(242, 160, 176, 0.28); background: rgba(242, 160, 176, 0.06); }
.todo li[data-state="next"] { border-color: rgba(111, 168, 255, 0.22); }
.todo li[data-state="later"] { opacity: 0.62; }
.todo-step {
  grid-column: 1;
  grid-row: 1 / span 2;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  padding-top: 2px;
}
.todo li > b,
.todo li > em { grid-column: 2; }

.todo b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.todo em {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 1px;
}

/* 空态：一句左对齐的话 + 一个动作，不再讲机制 */
.stream-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 26px 18px;
  color: var(--text-mute);
  font-size: 13px;
  line-height: 1.65;
}
.stream-empty .btn { align-self: flex-start; }

.output-empty {
  margin: 0;
  font-size: 13px;
  color: var(--text-mute);
  line-height: 1.7;
}

/* 监听范围：卡片级三态 + 动作 */
.scope-state {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  margin-bottom: 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(6, 12, 22, 0.4);
  font-size: 12.5px;
}
.scope-state .scope-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-mute);
  flex: none;
}
.scope-state b { font-weight: 500; color: var(--text-dim); }
.scope-state[data-state="ok"] { border-color: rgba(127, 227, 232, 0.28); background: rgba(127, 227, 232, 0.07); }
.scope-state[data-state="ok"] .scope-dot { background: var(--bubble); box-shadow: 0 0 0 3px rgba(127, 227, 232, 0.14); }
.scope-state[data-state="ok"] b { color: #c8f4f6; }
.scope-state[data-state="wait"] { border-color: rgba(242, 160, 176, 0.3); background: rgba(242, 160, 176, 0.07); }
.scope-state[data-state="wait"] .scope-dot { background: var(--blush); }
.scope-state[data-state="wait"] b { color: #ffd0da; }
.scope-state[data-state="bad"] { border-color: rgba(229, 84, 91, 0.32); background: rgba(229, 84, 91, 0.08); }
.scope-state[data-state="bad"] .scope-dot { background: var(--bad); }
.scope-state[data-state="bad"] b { color: #ffc5c8; }

.panel-head .auto { letter-spacing: 0; text-transform: none; }

/* 立绘：收紧裁切，别让白底外环抢走主按钮 */
.hero-art img { opacity: 0.82; }

/* 移动端：按"她 → 消息 → 日志 → 监听 → 出口"排序 */
@media (max-width: 860px) {
  .cols { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
  .main-col, .rail { display: contents; }
  .panel + .panel { margin-top: 0; }
  #stream-panel { order: 1; }
  #log-panel { order: 2; }
  #scope-panel { order: 3; }
  #output-panel { order: 4; }
  #persona-panel { order: 5; }

  .hero { position: relative; }
  .hero-art {
    position: static;
    width: 100%;
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
  }
  .hero-art img { width: 78px; margin: 0; opacity: 0.75; }
  .hero-copy { padding-right: 0; }
  .todo li { padding: 8px 10px; }
  .stream-legend { display: none !important; }
  .stream-empty { padding: 18px 14px; }
}

/* ── 数据页：左目录 / 右内容 ───────────────────────── */

.split {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding-top: 26px;
}

.catalog {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  backdrop-filter: blur(10px);
  padding: 14px 10px 18px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  position: sticky;
  top: 92px;
}
.catalog-loading { padding: 20px 12px; color: var(--text-mute); font-size: 13px; }

.catalog-group + .catalog-group { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.catalog-group h3 {
  margin: 0 0 6px;
  padding: 0 10px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.catalog-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  color: var(--text-dim);
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.45;
  transition: background 0.15s ease, color 0.15s ease;
}
.catalog-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.catalog-item[aria-current="true"] {
  background: rgba(111, 168, 255, 0.12);
  color: #cfe3ff;
  box-shadow: inset 0 0 0 1px rgba(111, 168, 255, 0.24);
}
.catalog-item .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
}
.catalog-item[disabled] { opacity: 0.42; cursor: not-allowed; }
.catalog-item .sub { color: var(--text-mute); font-size: 11.5px; }

.reader {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  backdrop-filter: blur(10px);
  min-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reader-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 30px;
  color: var(--text-dim);
}
.reader-empty h2 { margin: 0 0 8px; font-size: 18px; color: var(--text); }
.reader-empty p { margin: 0; max-width: 44ch; color: var(--text-mute); font-size: 13px; line-height: 1.8; }

.reader-main { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.reader-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.reader-head h2 { margin: 0; font-size: 16px; }
.reader-path {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-mute);
  word-break: break-all;
}
.badge {
  margin-left: auto;
  flex: none;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text-mute);
}
.badge[data-kind="writable"] { color: #cfe3ff; border-color: rgba(111, 168, 255, 0.32); background: rgba(111, 168, 255, 0.1); }
.badge[data-kind="readonly"] { color: var(--text-mute); }

.reader-desc {
  margin: 0;
  padding: 14px 20px 0;
  display: grid;
  gap: 4px;
}
.reader-desc div { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 10px; }
.reader-desc dt { font-size: 11.5px; color: var(--text-mute); letter-spacing: 0.06em; }
.reader-desc dd { margin: 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.65; }

.editor {
  flex: 1;
  min-height: 320px;
  margin: 16px 20px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(4, 9, 17, 0.72);
  color: #cfe0f5;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  resize: vertical;
  tab-size: 2;
}
.editor:focus { outline: none; border-color: rgba(111, 168, 255, 0.45); }
.editor[readonly] { color: var(--text-mute); }

.reader-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-mute);
}

@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); padding-top: 16px; gap: 12px; }
  .catalog { position: static; max-height: 300px; }
  .reader { min-height: 420px; }
  .editor { min-height: 260px; margin: 12px 14px; }
  .reader-head, .reader-desc, .reader-foot { padding-left: 14px; padding-right: 14px; }
  .reader-desc div { grid-template-columns: 38px minmax(0, 1fr); }
}


/* 空态插图：不分位置，统一尺寸与软化处理 */
.placeholder-art {
  width: 128px;
  margin: 0 auto 18px;
  display: block;
  opacity: 0.4;
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(closest-side, #000 42%, transparent 78%);
  mask-image: radial-gradient(closest-side, #000 42%, transparent 78%);
}
.reader-empty .placeholder-art { width: 116px; }


/* ── 全局记忆 / 人设 / 成长 ───────────────────────── */

.identity-card {
  padding: 4px 10px 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.identity-label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.identity-card b {
  display: block;
  font-size: 20px;
  font-weight: 650;
  margin: 4px 0 9px;
  letter-spacing: -0.01em;
}
.identity-actions { display: flex; align-items: center; gap: 9px; }
.identity-actions .note { margin: 0; font-size: 11.5px; }

.catalog-item .active-badge {
  margin-left: auto;
  font-size: 10.5px;
  color: #c8f4f6;
  border: 1px solid rgba(127, 227, 232, 0.3);
  background: rgba(127, 227, 232, 0.08);
  border-radius: 999px;
  padding: 1px 7px;
}

.growth-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.growth-metrics .metric { background: rgba(9, 16, 28, 0.66); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.growth-metrics .metric span { font-size: 11px; color: var(--text-mute); letter-spacing: 0.04em; }
.growth-metrics .metric b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

.timeline-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(150, 170, 205, 0.07);
  font-size: 13px;
}
.timeline-row:last-child { border-bottom: 0; }
.timeline-time { font-family: var(--mono); font-size: 11.5px; color: var(--text-mute); padding-top: 2px; }
.timeline-kind { color: var(--bubble); font-size: 12px; }
.timeline-text { color: var(--text-dim); word-break: break-word; }

.proposal { padding: 11px 0; border-bottom: 1px solid rgba(150, 170, 205, 0.08); }
.proposal:last-child { border-bottom: 0; }
.proposal b { display: block; font-size: 13px; font-weight: 600; }
.proposal p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-mute); line-height: 1.6; }
.proposal-actions { display: flex; gap: 8px; margin-top: 9px; }

.audit-line { display: flex; gap: 8px; font-size: 12.5px; color: var(--text-dim); line-height: 1.7; }
.audit-line + .audit-line { margin-top: 4px; }
.audit-line i { font-style: normal; color: var(--text-mute); width: 62px; flex: none; }

@media (max-width: 860px) {
  .growth-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline-row { grid-template-columns: 56px minmax(0, 1fr); padding: 10px 14px; }
}


@media (max-width: 860px) {
  /* 五个 tab 在一行里放得下，不再靠横滑 */
  .tab { padding: 7px 9px; font-size: 12.5px; gap: 4px; }
  .tab .dot { display: none; }
  .tabs { -webkit-mask-image: none; mask-image: none; padding-right: 0; }
}


/* ── 抽屉：可写配置 + 唯一旧版入口 ────────────────── */

.drawer-body { padding-bottom: 24px; }
.drawer-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  background: rgba(6, 12, 22, 0.55);
}
.drawer-foot .note { margin: 0; font-size: 11.5px; }
.drawer-pane .btn-primary { width: 100%; margin-top: 4px; }
.drawer-pane .note { margin-top: 10px; }

.switch {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
  cursor: pointer;
}
.switch input { width: 16px; height: 16px; accent-color: #6fa8ff; cursor: pointer; }

.row-inline .field { flex: 1; margin-bottom: 0; }
.row-inline { margin-bottom: 14px; }


/* ── 移动端吸底操作条 ─────────────────────────────── */

.mobile-bar { display: none; }

@media (max-width: 860px) {
  .mobile-bar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: rgba(10, 19, 34, 0.92);
    backdrop-filter: blur(14px);
    box-shadow: 0 14px 40px -18px #000;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  body.drawer-open .mobile-bar { transform: translateY(140%); opacity: 0; pointer-events: none; }

  .mobile-bar-state {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--text-dim);
    margin-right: auto;
    min-width: 0;
  }
  .mobile-bar-state .led {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--blush);
    flex: none;
  }
  .mobile-bar-state[data-state="ok"] .led { background: var(--bubble); }
  .mobile-bar-state[data-state="bad"] .led { background: var(--bad); }

  .mobile-bar .btn { padding: 8px 14px; font-size: 13px; }

  /* 给吸底条留出空间，别挡住最后一个面板 */
  .shell { padding-bottom: 92px; }
}


/* 只读索引：用表代替编辑器 */
.reader-table { margin: 16px 20px; overflow-x: auto; }
.reader-table h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 500;
}
.reader-table h3 + table { margin-bottom: 18px; }
.reader-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.reader-table th, .reader-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(150, 170, 205, 0.08);
  font-variant-numeric: tabular-nums;
}
.reader-table th { color: var(--text-mute); font-weight: 500; font-size: 11.5px; }
.reader-table td.num { text-align: right; font-family: var(--mono); }
.reader-table .missing { color: var(--text-mute); }


/* ── 数据页：房间 chips、结构视图、条目计数 ─────────── */

.room-chips {
  flex-basis: 100%;
  order: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0 0;
}
.reader-head { flex-wrap: wrap; }
.room-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.room-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.room-chip em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--text-mute); }
.room-chip:hover { color: var(--text); border-color: rgba(111, 168, 255, 0.34); }
.room-chip[aria-pressed="true"] {
  color: #cfe3ff;
  background: rgba(111, 168, 255, 0.14);
  border-color: rgba(111, 168, 255, 0.36);
}

.reader-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 0;
}
.reader-summary {
  font-size: 12px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.reader-tools .btn[aria-pressed="true"] {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.catalog-item .count.is-empty { color: var(--blush); }

@media (max-width: 860px) {
  .room-chips { padding: 10px 14px 0; }
  .room-chip span { max-width: 140px; }
  .reader-tools { padding: 10px 14px 0; flex-wrap: wrap; }
}


/* 概览：四块两列，别摊成一条长表 */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 26px;
}
.overview-grid section { min-width: 0; }
.overview-grid h3 { margin-top: 0; }
.overview-grid h3 em {
  font-style: normal;
  color: var(--text-mute);
  letter-spacing: 0;
  text-transform: none;
  font-size: 11.5px;
  margin-left: 6px;
}
@media (max-width: 900px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
}


/* ══ 统一语法：页头、空态、徽标、数字 ═══════════════ */

/* 五页共用一个页头：页面名（衬线）+ 一句状态 + 主操作槽 */
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin: 6px 0 18px;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0;
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.01em;
}
.page-head .sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-mute);
  line-height: 1.6;
}
.page-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* 页头已经占掉上方留白 */
.page { padding-top: 22px; }
.split { padding-top: 0; }
.growth-metrics { margin-top: 0; }

/* 衬线不是一次性的效果：五页的页面名都用它 */
.hero-title {
  font-size: clamp(20px, 1.9vw, 26px);
  max-width: 30ch;
}

/* 状态脊柱icon：去掉会暗示"先后顺序"的连线，只留状态本身 */
.spine-node i::after { display: none; }
.spine { padding-top: 4px; }
.hero { grid-template-columns: 148px minmax(0, 1fr) 216px; }

/* 空态：一套写法——一句话说状态、一句话说来源、一个动作 */
.stream-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 20px 18px;
  text-align: left;
  color: var(--text-mute);
  font-size: 13px;
  line-height: 1.65;
}
.stream-empty strong {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
}
.stream-empty .empty-action {
  margin-top: 6px;
  color: var(--whale);
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid rgba(111, 168, 255, 0.35);
}
.stream-empty .empty-action:hover { color: #a2cdff; }

/* 待办只在链路不正常时出现 */
.todo[hidden] { display: none !important; }

/* 「已保存·等桥连上」是正常状态，不该用出事色 */
.scope-state[data-state="wait"] {
  border-color: var(--line-strong);
  background: rgba(111, 168, 255, 0.06);
}
.scope-state[data-state="wait"] .scope-dot { background: var(--whale); }
.scope-state[data-state="wait"] b { color: #cfe3ff; }

/* 成长页：结论优先，零值指标折叠成一行 */
.growth-verdict {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 12px;
  font-size: 13.5px;
}
.growth-verdict b { font-size: 15px; font-weight: 600; }
.growth-verdict span { color: var(--text-mute); font-size: 12.5px; }
.growth-zero-note {
  margin: 10px 2px 0;
  font-size: 12px;
  color: var(--text-mute);
}

@media (max-width: 1180px) {
  .hero { grid-template-columns: 132px minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .page-head { margin: 2px 0 14px; gap: 10px; }
  .page-head h1 { font-size: 20px; }
  .page-head-actions { margin-left: 0; width: 100%; }
  .hero { grid-template-columns: minmax(0, 1fr); }
}


/* 概览：四个真实数字 + 上下分组 */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}
.stat-strip > div {
  background: rgba(9, 16, 28, 0.66);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-strip span { font-size: 11px; color: var(--text-mute); letter-spacing: 0.06em; }
.stat-strip b { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-strip em { font-style: normal; font-size: 11.5px; color: var(--text-mute); }

.overview-stack { display: flex; flex-direction: column; gap: 20px; }
.overview-stack section { min-width: 0; }
.overview-stack h3 { margin: 0 0 6px; }
.section-note { margin: 0; font-size: 12.5px; color: var(--text-mute); }

.audit-detail { margin-top: 10px; }
.audit-detail summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-mute);
  list-style: none;
}
.audit-detail summary::-webkit-details-marker { display: none; }
.audit-detail summary::before { content: "▸ "; }
.audit-detail[open] summary::before { content: "▾ "; }
.audit-detail pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(4, 9, 17, 0.7);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-mute);
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 860px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* 移动端：状态四项排成 2×2，不再硬挤一行 */
@media (max-width: 860px) {
  .spine {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 0 0 14px;
    margin-bottom: 14px;
  }
  .spine-node { display: flex; align-items: center; gap: 8px; }
  .spine-node i { margin: 0; }
  .spine-node b { display: inline; font-size: 10.5px; }
  .spine-node span { font-size: 12px; }

  /* 导航点按区够大 */
  .tab { min-height: 40px; }
  .room-chip { min-height: 34px; }
  .room-chip button, .tag button { min-width: 28px; min-height: 28px; }
}


/* 监听范围：加群/加私聊收进折叠，chips 常显 */
.scope-add {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.scope-add summary {
  cursor: pointer;
  list-style: none;
  font-size: 12.5px;
  color: var(--text-mute);
}
.scope-add summary::-webkit-details-marker { display: none; }
.scope-add summary::before { content: "+ "; }
.scope-add[open] summary::before { content: "− "; }
.scope-add summary:hover { color: var(--text-dim); }
.scope-add .row-inline { margin-top: 10px; }

@media (max-width: 860px) {
  /* 手机上「启动/停止/重启」只在吸底条出现一次 */
  .hero-actions .btn { display: none; }
  .hero-actions { margin-top: 4px; }

  /* 空日志在手机上只留标题一行 */
  #log-panel[data-empty="true"] .panel-body { display: none; }
}


/* 表格里的次要时间（起–止） */
.reader-table .dim { color: var(--text-mute); font-size: 11.5px; }


/* 空态原语：全站唯一写法 */
.empty-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 16px 18px;
  margin: 14px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: rgba(6, 12, 22, 0.35);
  color: var(--text-mute);
  font-size: 13px;
  line-height: 1.65;
  max-width: 62ch;
}
.empty-block strong { color: var(--text-dim); font-weight: 600; font-size: 13.5px; }
.empty-block .empty-action {
  margin-top: 4px;
  color: var(--whale);
  background: none;
  border: 0;
  padding: 0;
  font-size: 12.5px;
  cursor: pointer;
  border-bottom: 1px solid rgba(111, 168, 255, 0.35);
}
.empty-block .empty-action:hover { color: #a2cdff; }

/* 概览摘要：不再重画目录 */
.overview-rule {
  margin: 0 20px 16px;
  padding: 10px 14px;
  border-left: 2px solid rgba(111, 168, 255, 0.5);
  background: rgba(111, 168, 255, 0.05);
  border-radius: 0 8px 8px 0;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.7;
}
.recent-list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.recent-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid rgba(150, 170, 205, 0.07);
  font-size: 12.5px;
  color: var(--text-dim);
}
.recent-list li:last-child { border-bottom: 0; }
.recent-list time {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-mute);
  white-space: nowrap;
}


/* 人设目录：按 ## 分节跳转 */
.persona-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 20px 0;
}
.toc-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}
.toc-chip:hover { color: var(--text); border-color: rgba(111, 168, 255, 0.34); }

/* 移动端：只藏重复的「启动微信」，停止/重启留着；顺序对齐桌面 */
@media (max-width: 860px) {
  /* hero 里三个按钮都在；吸底条只在 hero 滚出视野后出现，不抢位置 */
  .hero-actions .btn { display: inline-flex; }

  #stream-panel { order: 1; }
  #output-panel { order: 2; }
  #log-panel { order: 3; }
  #scope-panel { order: 4; }
  #persona-panel { order: 5; }

  .persona-toc { padding: 10px 14px 0; }
  .empty-block { margin: 12px 14px; }
}


/* 页头右侧的时间戳 */
.page-head .updated { margin-left: auto; }

/* 卡头唯一刷新入口 */
.head-action {
  font-size: 12px;
  padding: 4px 10px;
  color: var(--text-mute);
}
.head-action:hover { color: var(--text); }

/* 空态在面板里时不要额外外边距 */
.panel-body .empty-block { margin: 0; }

/* 吸底条：默认隐藏，hero 滚出视野后由 JS 打开 */
.mobile-bar { transform: translateY(140%); opacity: 0; pointer-events: none; }
.mobile-bar[data-docked="true"] { transform: none; opacity: 1; pointer-events: auto; }
body.drawer-open .mobile-bar { transform: translateY(140%); opacity: 0; pointer-events: none; }

/* 目录里零值的标法 */
.catalog-item .count.is-empty { color: var(--text-mute); }


/* 保存条固定在卡片底部，900 高内不折 */
.reader-foot {
  position: sticky;
  bottom: 0;
  background: rgba(10, 18, 31, 0.94);
  backdrop-filter: blur(8px);
  z-index: 2;
}

/* 空态块铺满面板宽度，不再缩成一小块 */
.panel-body .empty-block { max-width: none; }


/* 卡头右侧的刷新按钮统一靠右 */
.reader-head { align-items: flex-start; }
.reader-head .head-action { margin-left: auto; flex: none; }


/* 全局记忆页：复用空态块位置放表格 */
.global-table { display: block; margin: 14px 20px; }
.global-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.global-table th, .global-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(150, 170, 205, 0.08);
}
.global-table th { color: var(--text-mute); font-weight: 500; font-size: 11.5px; }
.global-table td.num { text-align: right; font-family: var(--mono); color: var(--text-mute); }
.global-table .empty-block { margin: 0; }


/* Trace 页：链路列表与阶段回放 */
.trace-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 90px 80px minmax(0, 1fr) 60px;
  gap: 10px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(150, 170, 205, 0.07);
  font-size: 12.5px;
  cursor: pointer;
}
.trace-row:hover { background: rgba(255, 255, 255, 0.03); }
.trace-row:last-child { border-bottom: 0; }
.trace-id { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; }
.trace-stage { color: var(--text-mute); }
.trace-status[data-status="ok"], .trace-status[data-status="sent"] { color: #bff0f3; }
.trace-status[data-status="blocked"], .trace-status[data-status="failed"] { color: #ffc5c8; }
.trace-room { color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace-stages { text-align: right; font-family: var(--mono); color: var(--text-mute); }

.stage-list { list-style: none; margin: 0; padding: 0; }
.stage-list li {
  display: grid;
  grid-template-columns: 90px 70px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid rgba(150, 170, 205, 0.07);
  font-size: 12.5px;
}
.stage-list li:last-child { border-bottom: 0; }
.stage-list b { font-weight: 600; color: var(--text-dim); }
.stage-list time { font-family: var(--mono); font-size: 11.5px; color: var(--text-mute); text-align: right; }
.stage-list em { grid-column: 1 / -1; font-style: normal; color: var(--text-mute); font-size: 12px; }
.stage-status[data-status="ok"] { color: #bff0f3; }
.stage-status[data-status="blocked"], .stage-status[data-status="failed"] { color: #ffc5c8; }

@media (max-width: 860px) {
  .trace-row { grid-template-columns: minmax(0, 1fr) 70px; row-gap: 2px; }
  .trace-stage, .trace-room, .trace-stages { display: none; }
}
