:root {
  --bg: #0f1115;
  --card: #171a21;
  --line: #232733;
  --text: #e6e8ec;
  --dim: #9aa1ad;
  --faint: #6b7280;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --radius: 14px;
  --gap: 12px;
  --pad: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  padding: 0 12px calc(124px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
.hidden { display: none !important; }

/* 顶部窄栏 */
header.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px;
  background: linear-gradient(var(--bg) 70%, rgba(15,17,21,0));
}
header.bar .now {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
header.bar .meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

/* 卡片 */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--pad); margin-bottom: var(--gap);
  animation: rise 200ms ease-out both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card h2 {
  margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .04em;
  color: var(--dim); text-transform: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card h2 .badge { font-size: 12px; color: var(--faint); font-weight: 400; }
.big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: -.02em; }
.row { display: flex; gap: 10px; align-items: baseline; }
.row + .row { margin-top: 8px; }
.k { color: var(--faint); font-size: 13px; flex: none; min-width: 3.4em; }
.v { color: var(--text); word-break: break-word; }
.muted { color: var(--dim); }
.faint { color: var(--faint); font-size: 13px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 状态点 */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.chip.ok i { background: var(--ok); }
.chip.warn i { background: var(--warn); }
.chip.bad i { background: var(--bad); }
.tag { font-size: 12px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim); }
.tag.ok { color: var(--ok); border-color: #1d3a24; }
.tag.warn { color: var(--warn); border-color: #3a2f14; }
.tag.bad { color: var(--bad); border-color: #3d1f1f; }

/* 列表 */
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { padding: 9px 0; border-top: 1px solid var(--line); display: flex; gap: 9px; align-items: flex-start; }
ul.list li:first-child { border-top: 0; padding-top: 2px; }
ul.list li .body { flex: 1; min-width: 0; }
ul.list li .title { font-size: 15px; }
ul.list li .sub { font-size: 13px; color: var(--faint); margin-top: 2px; }
ul.list li .sub.warn { color: var(--warn); }
ul.list li .sub.bad { color: var(--bad); }
ul.list li .right { font-size: 12px; color: var(--faint); white-space: nowrap; flex: none; padding-top: 2px; }
.more {
  display: block; width: 100%; margin-top: 10px; padding: 9px; min-height: 44px;
  background: #12151b; color: var(--dim); border: 1px solid var(--line); border-radius: 10px;
  font-size: 13px; font-family: inherit;
}
.empty { color: var(--faint); font-size: 14px; padding: 4px 0; }
.err {
  background: #14161c; border: 1px dashed #2c313d; border-radius: 10px;
  padding: 12px; color: var(--dim); font-size: 14px;
}
.section-title { font-size: 13px; color: var(--faint); margin: 14px 0 4px; }

/* 麦克风 */
/* 底部容器：输入条＋麦克风共用一条（2026-10-31 输入框单） */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  max-height: 12vh;
  background: linear-gradient(rgba(15,17,21,0), var(--bg) 32%);
  transform: translateY(calc(-1 * var(--kb, 0px)));
}
.dock-row { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 560px; }
.ask-open {
  flex: 1; min-width: 0; height: 40px; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background: #14161c; border: 1px solid var(--line); border-radius: 999px;
  color: var(--faint); font-size: 15px; font-family: inherit; padding: 0 16px;
}
.ask-open:active { background: #171a21; }
.ask-form { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.ask {
  flex: 1; min-width: 0; height: 40px; padding: 0 14px;
  background: #14161c; border: 1px solid #2a3040; border-radius: 999px;
  color: var(--text); font-size: 16px; font-family: inherit;
}
.ask:focus { outline: none; border-color: #3a4a6b; }
.send {
  flex: none; height: 40px; padding: 0 15px; border-radius: 999px;
  background: var(--text); color: #0f1115; border: 0; font-size: 15px; font-weight: 600; font-family: inherit;
}
.mic-stage { position: relative; display: flex; align-items: center; justify-content: center; flex: none; }
.mic-hint {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--dim); background: rgba(15,17,21,.96); padding: 1px 10px;
  border-radius: 999px; border: 1px solid var(--line); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 160ms ease;
}
.mic-hint.live { opacity: 1; color: var(--text); border-color: #3a4a6b; }
.mic {
  pointer-events: auto;
  width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid #2a3040; background: radial-gradient(circle at 50% 35%, #1d2331, #14171e);
  color: var(--text); font-size: 24px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 22px rgba(0,0,0,.45);
  transition: transform 180ms ease, background 180ms ease;
}
.mic:active { transform: scale(.95); }
.mic.on { background: radial-gradient(circle at 50% 35%, #26314a, #161b25); border-color: #3a4a6b; }
.mic-ring {
  position: absolute; width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid #3a4a6b; opacity: 0; pointer-events: none;
}
.mic.on + .mic-ring, .mic-ring.on { animation: ripple 1.8s ease-out infinite; }
@keyframes ripple { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.75); opacity: 0; } }

/* 登录 */
.login { max-width: 420px; margin: 22vh auto 0; padding: 0 20px; text-align: center; }
.login h1 { font-size: 22px; font-weight: 600; margin: 0 0 18px; }
.login input {
  width: 100%; padding: 13px 14px; font-size: 16px; color: var(--text);
  background: #14161c; border: 1px solid var(--line); border-radius: 12px; font-family: inherit;
}
.login button {
  width: 100%; margin-top: 12px; padding: 13px; font-size: 16px; font-family: inherit;
  color: #0f1115; background: var(--text); border: 0; border-radius: 12px; font-weight: 600;
}
.login .msg { color: var(--bad); font-size: 14px; margin-top: 10px; }

/* 对话浮层 */
.sheet {
  position: fixed; inset: 0; z-index: 30; background: rgba(10,11,14,.72);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.sheet .panel {
  background: var(--card); border-top-left-radius: 18px; border-top-right-radius: 18px;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  max-height: 62vh; display: flex; flex-direction: column; gap: 10px;
  animation: rise 200ms ease-out both;
}
.sheet .head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--faint); }
.sheet .head button {
  background: none; border: 0; color: var(--dim); font-size: 14px; font-family: inherit; padding: 4px 6px;
}
.sheet .log { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.sheet .line { font-size: 15px; }
.sheet .line.you { color: var(--dim); }
.sheet .line.bot { color: var(--text); }
.sheet .line.sys { color: var(--faint); font-size: 13px; }
.sheet .live { color: var(--faint); font-size: 14px; min-height: 20px; }

@media (prefers-reduced-motion: reduce) {
  .card, .sheet .panel { animation: none; }
  .mic.on + .mic-ring, .mic-ring.on { animation: none; }
  .mic { transition: none; }
}

/* 信息层级（2026-10-31 ORD-20261031-220753-51393e）：关键数字大号、现场卡两行截断、空对话压缩 */
.metrics {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px; margin: 2px 0 12px;
}
.metric {
  background: #12151b; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 8px; text-align: center; min-width: 0;
}
.metric strong {
  display: block; font-size: 30px; line-height: 1.15; font-weight: 700;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: -.02em;
  color: var(--text);
}
.metric span { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; }
.metric.warn strong { color: var(--warn); }
.metric.ok strong { color: var(--ok); }
.metric.bad strong { color: var(--bad); }
.row { align-items: flex-start; }
.row .v.clamp2 { flex: 1; min-width: 0; }
.row .v.clamp2.open { display: block; overflow: visible; -webkit-line-clamp: unset; }
.row-toggle {
  flex: none; background: none; border: 1px solid var(--line); color: var(--faint);
  font-size: 12px; font-family: inherit; padding: 2px 8px; border-radius: 999px; margin-top: 1px;
}
.row-toggle:active { background: #12151b; }
.card.talk.is-empty { padding-bottom: 12px; }
.card.talk.is-empty .talk-log { max-height: none; }
.empty.compact { padding: 0; font-size: 13px; }

a.navlink {
  color: var(--dim); text-decoration: none; font-size: 13px; white-space: nowrap;
  padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px;
}
a.navlink:active { background: #12151b; }

/* 对话区（2026-10-31 输入框单）：用户一行灰、分身一行白，最多 20 轮，存 localStorage */
.talk h2 .badge { display: flex; align-items: center; gap: 8px; }
.talk-clear {
  background: none; border: 1px solid var(--line); color: var(--faint);
  font-size: 12px; font-family: inherit; padding: 2px 9px; border-radius: 999px;
}
.talk-log {
  max-height: 38vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 8px;
}
.talk-item { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; line-height: 1.55; }
.talk-item .talk-text {
  flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.talk-item.you { color: var(--dim); }
.talk-item.you .talk-text { background: none; }
.talk-item.bot { color: var(--text); }
.talk-item.bot .talk-text { background: #12151b; }
.talk-speak { flex: none; background: none; border: 0; color: var(--faint); font-size: 16px; line-height: 1; padding: 6px 2px; }
.talk-speak.on { color: var(--text); }
.talk-retry {
  flex: none; background: #12151b; border: 1px solid var(--line); color: var(--dim);
  font-size: 12px; font-family: inherit; padding: 4px 9px; border-radius: 999px; margin-top: 6px;
}
.talk-retry[disabled] { opacity: .5; }
.talk-via {
  flex: none; align-self: flex-start; margin-top: 4px;
  font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 999px;
  color: var(--dim); background: #1b1f27; border: 1px solid var(--line);
}
/* 分流回执（2026-11-02）：为什么这么判、判错了点哪改判 */
.talk-route { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.talk-why { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.talk-tag {
  flex: none; font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 999px;
  color: #0f1115; background: #8fb3ff;
}
.talk-why-text { font-size: 12px; line-height: 1.5; color: var(--dim); }
.talk-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.talk-act {
  background: #1b1f27; border: 1px solid var(--line); color: var(--dim);
  font-size: 12px; line-height: 1; padding: 6px 9px; border-radius: 8px; cursor: pointer;
}
.talk-act:hover { color: var(--text); border-color: #3a4a6b; }
.talk-act:active { background: #171a21; }