/* PNG-AI 客户端界面（中文演示版）
 * 主参照：ChatGPT 对话产品的白底、浅灰侧栏、黑色主操作与 28px 输入框；
 * 青色只表示“已选中”，状态色只表示状态且始终配图标与文字；阴影只用于浮层。 */

:root {
  --canvas: #ffffff;
  --fog: #f9f9f9; /* 侧栏与弱底色 */
  --carbon: #0d0d0d; /* 正文与主按钮 */
  --pewter: #5d5d5d; /* 次要文字 */
  --stone: #8f8f8f; /* 仅占位符与禁用 */
  --mist: #ececec; /* 悬停与当前项 */
  --bubble: #f4f4f4; /* 用户消息 */
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.16);
  --teal: #016a71; /* 仅选中态 */
  --teal-tint: #eef6f6;
  --link: #0062d1; /* 仅链接 */
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --danger-line: #fecdca;
  --warn: #93370d;
  --warn-bg: #fffaeb;
  --warn-line: #fedf89;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --r-composer: 28px;
  --r-card: 16px;
  --r-item: 10px;
  --side-w: 260px;
  --panel-w: 380px;
  --read-w: 768px;
  --font: ui-sans-serif, -apple-system, system-ui, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --overlay-shadow: 0 12px 32px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--canvas);
  color: var(--carbon);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-wrap: break-word;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button[aria-disabled='true'] {
  cursor: not-allowed;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

a {
  color: var(--link);
}

.icon {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

.icon.is-flip {
  transform: rotate(180deg);
}

.icon.is-sel {
  color: var(--teal);
}

.icon.is-ok {
  color: var(--ok);
}

.mark {
  display: block;
  flex: none;
  object-fit: contain;
}

.grow {
  flex: 1;
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

.muted {
  color: var(--pewter);
  font-size: 14px;
}

p.muted {
  margin: 6px 0;
}

.nowrap {
  white-space: nowrap;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.noscript {
  padding: 24px;
}

/* ---------- 焦点 ---------- */
:focus-visible {
  outline: 2px solid var(--carbon);
  outline-offset: 2px;
}

[tabindex='-1']:focus {
  outline: none;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--r-item);
  background: var(--carbon);
  color: #fff;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- 外壳 ---------- */
#app {
  height: 100vh;
  height: 100dvh;
}

.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.app.has-panel {
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--panel-w);
}

.col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.main {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.main.is-thread {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- 侧栏 ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--fog);
  border-right: 1px solid rgba(0, 0, 0, 0.05);
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 8px 0 14px;
  flex: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-wordmark {
  display: block;
  flex: none;
  object-fit: contain;
}

/* 与 .icon-btn 同级的选择器会被它覆盖，这里提高一级 */
.icon-btn.side-close,
.icon-btn.top-menu,
.icon-btn.top-new {
  display: none;
}

.ws-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--canvas);
}

.acct-sub,
.ctx-text,
.top-title,
.hist-item {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  flex: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-item);
  background: transparent;
  font-size: 14px;
  text-align: left;
}

.nav-item:hover,
.hist-item:hover,
.acct-btn:hover {
  background: var(--mist);
}

.nav-item.is-current,
.hist-item.is-current,
.acct-btn.is-current {
  background: var(--mist);
  font-weight: 500;
}

.side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 8px;
}

.side-label {
  margin: 0;
  padding: 14px 10px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--pewter);
}

.hist-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hist-item {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-item);
  background: transparent;
  font-size: 14px;
  text-align: left;
}

.side-empty {
  margin: 0;
  padding: 4px 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--pewter);
}

.side-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.acct-btn {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
}

.acct-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--mist);
}

.acct-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 14px;
}

.acct-sub {
  font-size: 12px;
  color: var(--pewter);
}

/* 左下角账户菜单：身份按钮占满剩余宽度，结束会话或退出按钮留在右侧 */
.acct-anchor {
  flex: 1;
  min-width: 0;
}

.acct-anchor .acct-btn {
  width: 100%;
}

/* ---------- 菜单 ---------- */
.menu-anchor {
  position: relative;
}

.menu {
  position: absolute;
  z-index: 20;
  max-height: min(70dvh, 520px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--canvas);
  box-shadow: var(--overlay-shadow);
  text-align: left;
}

.menu-down {
  top: calc(100% + 4px);
  left: 8px;
  right: 8px;
}

.menu-up {
  bottom: calc(100% + 10px);
  left: -6px;
  width: min(340px, calc(100vw - 32px));
}

.menu-label {
  display: block;
  margin: 0;
  padding: 8px 10px 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--pewter);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-item);
  background: transparent;
  font-size: 14px;
  text-align: left;
}

.menu-item:hover {
  background: var(--mist);
}

.menu-item[aria-current='true'],
.menu-item[aria-pressed='true'] {
  color: var(--teal);
}

.menu-item-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.menu-item-sub {
  font-size: 12px;
  color: var(--pewter);
}

.menu .select {
  width: calc(100% - 12px);
  margin: 0 6px;
}

/* 菜单内分组：与上一组之间加分隔线 */
.menu-sep {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.menu-hint {
  margin: 0;
  padding: 6px 10px 8px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--pewter);
}

.menu-note {
  margin: 6px;
  padding: 8px 10px;
  border-radius: var(--r-item);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 12.5px;
  line-height: 1.55;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  flex: none;
  padding: 0 12px;
  background: var(--canvas);
}

.top-title {
  min-width: 0;
  margin: 0 0 0 4px;
  font-size: 15px;
  font-weight: 500;
}

.net {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--pewter);
  white-space: nowrap;
}

.net-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.net-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.demo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px dashed #b4b4b4;
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  color: var(--pewter);
  white-space: nowrap;
}

.demo-btn:hover {
  background: var(--fog);
}

.demo-btn[aria-pressed='true'] {
  border-style: solid;
  border-color: var(--teal);
  background: var(--teal-tint);
  color: var(--teal);
}

.banner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 8px 16px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 14px;
}

/* ---------- 通用控件 ---------- */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--r-item);
  background: transparent;
  color: var(--pewter);
}

.icon-btn:hover {
  background: var(--mist);
  color: var(--carbon);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--canvas);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.btn:hover {
  background: var(--fog);
}

.btn-dark {
  border-color: var(--carbon);
  background: var(--carbon);
  color: #fff;
}

.btn-dark:hover {
  background: #2f2f2f;
}

.btn[aria-disabled='true'],
.btn[aria-disabled='true']:hover {
  border-color: var(--line);
  background: var(--fog);
  color: var(--stone);
}

.btn-wide {
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--canvas);
  font-size: 13px;
  white-space: nowrap;
}

.pill-btn:hover {
  background: var(--fog);
}

.pill-btn.is-dark {
  border-color: var(--carbon);
  background: var(--carbon);
  color: #fff;
}

.pill-btn[aria-disabled='true'],
.pill-btn[aria-disabled='true']:hover {
  background: var(--fog);
  color: var(--stone);
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  color: var(--pewter);
}

.text-btn:hover {
  background: var(--mist);
  color: var(--carbon);
}

.text-btn.is-danger {
  color: var(--danger);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--link);
  font-size: 14px;
  text-decoration: underline;
  text-decoration-color: rgba(0, 98, 209, 0.35);
  text-underline-offset: 3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--mist);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.badge-neutral {
  color: var(--pewter);
}

.badge-info {
  border: 1px solid var(--line);
  background: var(--canvas);
  color: var(--carbon);
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
}

.input,
.select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--canvas);
  font-size: 16px;
}

.input[aria-invalid='true'] {
  border-color: var(--danger);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.55;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  flex: none;
  margin: 2px 0 0;
  accent-color: var(--teal);
}

/* ---------- 输入框 ---------- */
.composer-box {
  padding: 10px 10px 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-composer);
  background: var(--canvas);
}

.composer-box:focus-within {
  border-color: var(--stone);
}

#composer-input {
  display: block;
  width: 100%;
  min-height: 32px;
  max-height: 220px;
  padding: 6px 6px 2px;
  border: 0;
  background: transparent;
  font-size: 16px;
  line-height: 24px;
  resize: none;
  outline: none;
}

#composer-input::placeholder {
  color: var(--stone);
}

.composer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  min-width: 0;
}

.composer-row > .menu-anchor {
  min-width: 0;
}

.ctx-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--canvas);
  font-size: 13px;
}

button.ctx-btn:hover,
.ctx-btn[aria-expanded='true'] {
  background: var(--mist);
}

.ctx-btn.is-static {
  border-color: transparent;
  padding-left: 6px;
  color: var(--pewter);
}

.composer-hint {
  font-size: 12px;
  color: var(--pewter);
  white-space: nowrap;
}

.send {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--carbon);
  color: #fff;
}

.send[aria-disabled='true'] {
  background: var(--mist);
  color: var(--stone);
}

.composer-foot {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: var(--pewter);
}

/* 公众模式菜单沿用输入框的中性风格，青绿只标识已选中的深度模式 */
.mode-btn {
  min-height: 36px;
  padding: 0 10px;
  font-size: 14px;
  white-space: nowrap;
}

.mode-btn.is-deep {
  color: var(--teal);
  border-color: var(--teal);
}

.mode-menu {
  left: -8px;
  width: min(310px, calc(100vw - 96px));
  max-height: min(60dvh, 360px);
}

.mode-menu .menu-item-sub {
  margin-top: 3px;
}

.compose-limit {
  margin: 2px 6px 6px;
  color: var(--pewter);
  font-size: 12px;
}

.row-eyebrow {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--pewter);
}

.reasoning-sample {
  margin-top: 8px;
}

/* ---------- 附件：输入框上方的附件条与用户消息中的附件，只用中性色 ---------- */
.attach-btn[aria-disabled='true'] {
  background: transparent;
  color: var(--stone);
  cursor: not-allowed;
}

.att-tray {
  margin: 0 0 6px;
}

.att-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.att {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: min(100%, 260px);
  padding: 6px 36px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--canvas);
}

.att-thumb {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  overflow: hidden;
  border-radius: var(--r-item);
  background: var(--mist);
  color: var(--pewter);
}

.att-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.att-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

/* 限宽后长文件名不会撑大附件列表的最小宽度（260 减去缩略图、间距和移除按钮） */
.att-name {
  max-width: 166px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.att-meta {
  font-size: 12px;
  color: var(--pewter);
}

.att-remove {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--pewter);
  transform: translateY(-50%);
}

.att-remove:hover {
  background: var(--mist);
  color: var(--carbon);
}

.att-note {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--pewter);
}

.u-files {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: min(80%, 560px);
}

.u-files .att-list {
  justify-content: flex-end;
}

.u-files .att {
  padding-right: 12px;
}

/* ---------- 首页 ---------- */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-height: 100%;
  padding: 32px 24px 56px;
}

.home-hero {
  max-width: var(--read-w);
  text-align: center;
}

.home-h {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.3;
}

.home-sub {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--pewter);
}

.home-compose,
.home-explore {
  width: 100%;
  max-width: var(--read-w);
}

.home-explore {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.btn[aria-pressed='true'] {
  border-color: var(--teal);
  background: var(--teal-tint);
  color: var(--teal);
}

.samples {
  width: 100%;
}

.samples-h {
  margin: 0 0 4px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--pewter);
}

.row-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row-list li + li {
  border-top: 1px solid var(--line);
}

.row-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
}

.row-btn:hover {
  background: var(--fog);
}

.row-btn .icon {
  color: var(--pewter);
}

.row-text {
  flex: 1;
}

.agent-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.agent-card p {
  margin: 0;
}

/* ---------- 对话线程 ---------- */
.chat {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.thread {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.thread-inner {
  max-width: var(--read-w);
  margin: 0 auto;
  padding: 24px 24px 16px;
}

.chat-compose {
  flex: none;
  padding: 0 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--canvas);
}

.chat-compose .composer {
  max-width: var(--read-w);
  margin: 0 auto;
}

/* 对话滚到输入框后面时渐隐，避免被横切的半行字像渲染错误 */
.is-thread .chat-compose {
  position: relative;
}

.is-thread .chat-compose::before {
  content: '';
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 24px;
  background: linear-gradient(to bottom, rgb(255 255 255 / 0), var(--canvas));
  pointer-events: none;
}

.turn {
  margin: 0 0 32px;
}

.turn-u {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.u-bubble {
  max-width: min(80%, 560px);
  margin: 0;
  padding: 10px 16px;
  border-radius: 22px;
  background: var(--bubble);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.turn-a {
  line-height: 1.75;
}

.turn-a > p {
  margin: 0 0 12px;
}

.a-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--pewter);
}

.a-meta .icon {
  color: var(--carbon);
}

.answer.is-panel {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.answer.tone-danger {
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.answer.tone-warn {
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.answer.tone-muted {
  background: var(--fog);
}

.answer.is-panel > p:not(.a-label) {
  margin: 0 0 10px;
}

.a-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 500;
}

.tone-ok {
  color: var(--ok);
}

.a-label.tone-warn {
  color: var(--warn);
}

.a-label.tone-danger {
  color: var(--danger);
}

.tone-info {
  color: var(--pewter);
}

.a-title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
}

.a-summary {
  margin: 0 0 12px;
}

.a-h {
  margin: 18px 0 4px;
  font-size: 16px;
  font-weight: 600;
}

.a-list {
  margin: 0 0 8px;
  padding-left: 1.4em;
}

.a-list li {
  margin: 4px 0;
  padding-left: 2px;
}

.a-list li::marker {
  color: var(--pewter);
}

.a-note {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--pewter);
}

.a-notices {
  list-style: none;
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--fog);
  font-size: 14px;
  line-height: 1.6;
  color: var(--pewter);
}

.a-notices li {
  display: flex;
  gap: 8px;
}

.a-notices li + li {
  margin-top: 6px;
}

.a-notices .icon {
  margin-top: 4px;
}

.hint-box {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--fog);
}

.hint-box p {
  margin: 0;
}

.hint-h {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px !important;
  font-size: 14px;
  font-weight: 600;
}

.a-practice {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--fog);
  font-size: 15px;
}

.kv {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}

.kv > div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
}

.kv dt {
  color: var(--pewter);
  font-size: 14px;
}

.kv dd {
  margin: 0;
  font-size: 14px;
}

.kv-compact dt,
.kv-compact dd {
  font-size: 13px;
  line-height: 1.6;
}

/* 来源账本：编号、版本与有效期紧跟在回答下面 */
.ledger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
}

.ledger-h {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  font-size: 13px;
  color: var(--pewter);
}

.ledger-none {
  font-size: 13px;
  color: var(--pewter);
}

.src-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px 0 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--canvas);
  font-size: 12.5px;
  line-height: 1.3;
  text-align: left;
}

button.src-chip:hover {
  background: var(--fog);
}

.src-chip.is-static {
  cursor: default;
}

.src-n {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  background: var(--mist);
  font-size: 11px;
  font-weight: 600;
}

.src-valid {
  color: var(--pewter);
}

.a-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.keep {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--fog);
  font-size: 12.5px;
  color: var(--pewter);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.keep.is-low {
  background: var(--warn-bg);
  color: var(--warn);
}

.follow {
  margin-top: 22px;
}

.follow-h {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--pewter);
}

.draft-card {
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--fog);
}

.draft-h {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-weight: 600;
}

.yes,
.no {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.yes {
  color: var(--ok);
}

.no {
  color: var(--danger);
}

/* ---------- 任务进行中 ---------- */
.run-card {
  max-width: 540px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  line-height: 1.5;
}

.run-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.run-label {
  font-weight: 500;
}

.run-count {
  margin-left: auto;
  color: var(--pewter);
  font-variant-numeric: tabular-nums;
}

.pulse {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--carbon);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    transform: scale(0.6);
    opacity: 0.45;
  }
}

.run-bar {
  height: 3px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 2px;
  background: var(--mist);
}

.run-bar span,
.progress span {
  display: block;
  height: 100%;
  background: var(--carbon);
  transition: width 0.3s ease;
}

.run-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.run-steps li,
.timeline li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.run-steps .icon,
.run-steps .dot {
  margin-top: 3px;
}

.is-done {
  color: var(--pewter);
}

.run-steps .is-done .icon,
.timeline .is-done .icon {
  color: var(--ok);
}

.is-active {
  font-weight: 500;
}

.is-pending {
  color: var(--pewter);
}

.dot {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  flex: none;
}

.dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}

.is-active .dot::before {
  opacity: 1;
  animation: pulse 1.2s ease-in-out infinite;
}

.run-note {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--pewter);
}

.run-card.is-done {
  border-style: dashed;
}

.inline-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
}

.inline-alert > span {
  flex: 1;
  min-width: 180px;
}

.inline-alert .icon {
  margin-top: 2px;
}

.inline-alert.is-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.inline-alert.is-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.inline-alert.is-info {
  background: var(--fog);
}

.notice-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.notice-card > p {
  margin: 0 0 8px;
}

.nc-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.nc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.choices {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--canvas);
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
}

.choice:hover {
  background: var(--fog);
}

.choice[aria-pressed='true'] {
  border-color: var(--teal);
  background: var(--teal-tint);
  color: var(--teal);
}

.choice[data-off],
.choice[data-off]:hover {
  background: var(--canvas);
  color: var(--stone);
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 10px 0;
  padding: 0;
  list-style: none;
}

.timeline p {
  margin: 0;
}

.timeline .muted {
  font-size: 13px;
}

.timeline .icon,
.timeline .dot {
  margin-top: 5px;
}

/* ---------- 页面 ---------- */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.page-wide {
  max-width: 1040px;
}

.page-narrow {
  max-width: 520px;
}

.page-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.page-h {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
}

.page-sub {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--pewter);
}

.page-top .page-sub {
  margin-bottom: 0;
}

.sec-h {
  margin: 28px 0 10px;
  font-size: 16px;
  font-weight: 600;
}

.card {
  margin: 12px 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.card-h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-weight: 600;
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress {
  height: 6px;
  margin: 12px 0 8px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--mist);
}

.pack-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
}

.doc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.doc-list li {
  padding: 12px 14px;
}

.doc-list li + li {
  border-top: 1px solid var(--line);
}

.doc-title {
  margin: 0;
  font-weight: 500;
}

.doc-list.is-locked .doc-title {
  color: var(--pewter);
}

.event-list {
  display: grid;
  gap: 4px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.event-list li {
  display: flex;
  gap: 10px;
}

.radio-list {
  display: grid;
  gap: 8px;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--canvas);
  text-align: left;
}

.radio-row:hover {
  background: var(--fog);
}

.radio-row[aria-checked='true'] {
  border-color: var(--teal);
}

.radio-dot {
  position: relative;
  width: 18px;
  height: 18px;
  flex: none;
  border: 2px solid #b4b4b4;
  border-radius: 50%;
}

.radio-row[aria-checked='true'] .radio-dot {
  border-color: var(--teal);
}

.radio-row[aria-checked='true'] .radio-dot::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--teal);
}

.radio-main {
  display: flex;
  flex-direction: column;
}

.radio-title {
  font-size: 15px;
  font-weight: 500;
}

.table-wrap {
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}

.table th {
  padding: 10px 12px;
  background: var(--fog);
  font-size: 13px;
  font-weight: 500;
  color: var(--pewter);
  text-align: left;
  white-space: nowrap;
}

.table th.num {
  text-align: right;
}

.table td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

/* 文字按钮自带内边距，抵消后与表头左对齐 */
.table .row-ops .text-btn:first-child {
  margin-left: -6px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.tile {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.tile-label {
  margin: 0;
  font-size: 13px;
  color: var(--pewter);
}

.tile-value {
  margin: 4px 0 0;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: -1px;
  padding: 0 12px;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  color: var(--pewter);
  text-decoration: none;
}

.tab:hover {
  color: var(--carbon);
}

.tab.is-current {
  border-bottom-color: var(--carbon);
  font-weight: 500;
  color: var(--carbon);
}

.code {
  margin: 12px 0;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--fog);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
}

.login {
  padding-top: 10vh;
  text-align: center;
}

.login-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--fog);
}

.login .timeline {
  max-width: 440px;
  margin: 20px auto;
  text-align: left;
}

.login .muted {
  margin-top: 14px;
  line-height: 1.6;
}

.field {
  margin: 16px 0;
  padding: 0;
  border: 0;
}

/* 复选框行也是 fieldset 的直接子元素，排除在外以保留 .check 的横排布局 */
.field > label:not(.check),
.field > legend {
  display: block;
  margin-bottom: 6px;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
}

.field .check {
  margin: 8px 0;
}

.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--danger);
}

.field-hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--pewter);
}

/* ---------- 侧面板 ---------- */
.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--canvas);
  border-left: 1px solid var(--line);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  flex: none;
  padding: 0 8px 0 18px;
  border-bottom: 1px solid var(--line);
}

.panel-h {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px calc(24px + env(safe-area-inset-bottom));
}

.panel-note {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--pewter);
}

.src-list {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.src-list li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.src-list li.is-focus {
  border-color: var(--teal);
}

.src-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 13px;
}

.src-title {
  margin: 0;
  font-weight: 500;
}

.demo-h {
  margin: 22px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pewter);
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seg-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--canvas);
  font-size: 13px;
}

.seg-btn:hover {
  background: var(--fog);
}

.seg-btn[aria-pressed='true'] {
  border-color: var(--teal);
  background: var(--teal-tint);
  color: var(--teal);
}

.demo-spec {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--pewter);
}

.demo-list {
  display: grid;
  gap: 2px;
  margin-bottom: 12px;
}

.demo-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  font-size: 14px;
  text-align: left;
}

.demo-row:hover {
  background: var(--fog);
}

.demo-row .icon {
  margin-top: 2px;
  color: var(--pewter);
}

.demo-row[aria-pressed='true'] {
  border-color: var(--teal);
  color: var(--teal);
}

.demo-row[aria-pressed='true'] .icon {
  color: var(--teal);
}

.demo-row[aria-disabled='true'],
.demo-row[aria-disabled='true']:hover {
  background: transparent;
  color: var(--stone);
}

.demo-row-main {
  display: flex;
  flex-direction: column;
}

.demo-row-sub {
  font-size: 12px;
  color: var(--pewter);
}

.log {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  line-height: 1.5;
}

.log li {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
}

.log-t,
.log-text {
  color: var(--pewter);
}

.log-who {
  font-weight: 500;
}

.log-text {
  overflow-wrap: anywhere;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.4);
}

.panel-scrim {
  display: none;
}

/* ---------- 对话框与提示 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.4);
}

.dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 61;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 22px 24px;
  border-radius: 20px;
  background: var(--canvas);
  box-shadow: var(--overlay-shadow);
  transform: translate(-50%, -50%);
}

.dialog > p {
  margin: 0 0 10px;
}

.dialog-h {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 600;
}

.dialog .sec-h {
  margin: 18px 0 6px;
  font-size: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(110px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--carbon);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--overlay-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

#toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 知识发布与审核 ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 20px 0 12px;
}

.toolbar .seg {
  flex: 1;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 240px;
  max-width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--pewter);
}

.search input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  color: var(--carbon);
}

.search input::placeholder {
  color: var(--stone);
}

.doc-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  max-width: 100%;
  min-height: 44px;
  margin: -6px;
  padding: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  text-align: left;
}

.doc-btn:hover {
  background: var(--mist);
}

.doc-btn > span {
  min-width: 0;
}

.doc-btn-title,
.doc-btn-id,
.cell-main,
.cell-sub {
  display: block;
}

.doc-btn-title,
.cell-main {
  font-weight: 500;
}

.doc-btn-id,
.cell-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--pewter);
}

.table tr.is-selected {
  background: var(--teal-tint);
}

.tag-inline {
  display: inline-flex;
  margin-left: 6px;
  vertical-align: middle;
}

.cell-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pipeline {
  gap: 10px;
  margin: 12px 0;
}

.pipeline .is-error {
  color: var(--danger);
}

.panel-sec {
  margin: 24px 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.doc-id {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--pewter);
}

.doc-h {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
}

.panel-foot {
  display: flex;
  flex-wrap: wrap;
  flex: none;
  gap: 8px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--canvas);
}

.panel-foot .btn {
  flex: 1 1 150px;
  padding-block: 8px;
  white-space: normal;
}

.plain-list {
  margin: 12px 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.plain-list li + li {
  margin-top: 6px;
}

.role-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 20px 0;
  padding: 0;
  list-style: none;
}

.role-list .card {
  margin: 0;
}

.inline-alert.is-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

/* ---------- 管理后台：沿用同一套令牌，分组导航放在侧栏滚动区 ---------- */
.nav-groups {
  padding: 0;
  gap: 0;
}

.nav-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list .nav-item {
  width: 100%;
}

.nav-list + .side-label {
  padding-top: 24px;
}

.level-chip {
  flex: none;
  border: 0;
  background: transparent;
}

.level-chip.net-warn {
  background: var(--warn-bg);
}

.level-chip.net-danger {
  background: var(--danger-bg);
}

.level-chip:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
  padding: 0;
  list-style: none;
}

.card-grid .card {
  min-width: 0;
  margin: 0;
}

.card-en {
  margin: 0 0 14px;
  font-size: 12px;
}

.kv-terms > div {
  grid-template-columns: 180px minmax(0, 1fr);
}

.tile {
  min-width: 0;
}

.tile-unit {
  margin-left: 4px;
  font-size: 13px;
  font-weight: 400;
  color: var(--pewter);
}

.tile-value.is-text {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.5;
}

.tile-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--pewter);
}

.tile.is-bad {
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.tile.is-bad .tile-note,
.text-bad {
  color: var(--danger);
}

.text-bad {
  font-size: 14px;
}

.text-bad > .icon {
  margin-right: 6px;
}

.level-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.level-steps li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12px;
  text-align: center;
  color: var(--pewter);
}

.level-steps .is-current {
  border-color: var(--line-strong);
  background: var(--fog);
  font-weight: 600;
  color: var(--carbon);
}

.level-steps .tone-warn {
  border-color: var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn);
}

.level-steps .tone-danger {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}

/* 级别卡最长的标签“公众新请求预演”为 7 个汉字，标签列放宽到一行能放下 */
.level-card .kv > div {
  grid-template-columns: 112px minmax(0, 1fr);
}

.btn-sub {
  color: var(--pewter);
}

.pool {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.pool-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.pool-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.pool-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--pewter);
}

.pool-count {
  flex: none;
  margin: 0;
  font-size: 13px;
  text-align: right;
  color: var(--pewter);
}

.gpu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gpu {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-item);
}

.gpu-id {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}

.gpu-state {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 6px 0 0;
  font-size: 12px;
}

.gpu-util {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--pewter);
}

.gpu.is-fault,
.gpu.is-down {
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.gpu.is-paused {
  background: var(--fog);
}

.tone-ok {
  color: var(--ok);
}

.tone-info,
.tone-neutral {
  color: var(--pewter);
}

.tone-warn {
  color: var(--warn);
}

.tone-danger {
  color: var(--danger);
}

.meter {
  height: 3px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--mist);
}

.meter > span {
  display: block;
  height: 100%;
  background: var(--carbon);
}

.usage {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
}

.usage .progress {
  flex: 1;
  min-width: 80px;
  margin: 0;
}

.progress.is-bad > span {
  background: var(--danger);
}

.step-n {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 12px;
}

/* 容量图不借用选中色或状态色区分类别：实色、两种斜纹、点纹、空心，加数字与文字清单 */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--pewter);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
}

.cap {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.cap-h {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 500;
}

.cap-bar {
  display: flex;
  gap: 2px;
  min-height: 30px;
  margin: 8px 0;
}

.cap-seg {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 0 4px 4px 0;
  font-family: var(--mono);
  font-size: 12px;
}

.cap-public,
.hbar-base {
  background: #4d4d4d;
  color: #fff;
}

.cap-safety,
.hbar-half {
  background-color: #f1f1f1;
  background-image: repeating-linear-gradient(45deg, transparent 0 3px, #757575 3px 4px);
}

.cap-maint {
  background-color: #e5e5e5;
  background-image: repeating-linear-gradient(135deg, transparent 0 3px, #757575 3px 4px);
}

.cap-included {
  background-color: var(--fog);
  background-image: radial-gradient(#757575 0.7px, transparent 1px);
  background-size: 4px 4px;
}

.cap-sellable {
  border-color: #757575;
  background: var(--canvas);
}

.cap-overflow {
  background-color: var(--warn-bg);
  background-image: repeating-linear-gradient(45deg, transparent 0 3px, var(--warn) 3px 4px);
}

.cap-n {
  padding: 0 3px;
  border-radius: 2px;
  background: var(--canvas);
  color: var(--carbon);
}

.cap-public .cap-n {
  background: #4d4d4d;
  color: #fff;
}

.cap-list {
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--pewter);
}

.cap-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--warn);
}

.cap-note > .icon {
  margin-top: 3px;
}

.formula-line {
  margin: 0;
  font-size: 14px;
}

.formula {
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--fog);
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.formula p {
  margin: 10px 0;
}

.formula-total {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.formula-total .yes,
.formula-total .no {
  display: flex;
  margin-top: 6px;
  white-space: normal;
}

.chart {
  margin: 28px 0 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

.chart-h {
  font-size: 16px;
  font-weight: 600;
}

.hbars {
  display: grid;
  gap: 2px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.hbars > li {
  padding: 10px 12px;
  border-radius: var(--r-item);
}

.hbars > li.is-selected {
  background: var(--teal-tint);
}

.hbar-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
}

.hbar-row {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 12px;
  min-height: 26px;
}

.hbar-key,
.hbar-val {
  font-size: 13px;
  color: var(--pewter);
}

.hbar-val {
  text-align: right;
}

.hbar {
  height: 10px;
  min-width: 0;
}

.hbar-fill {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
}

/* 图表悬停与键盘聚焦给出同一提示，图外清单始终可读；提示只用正文色 */
.chart-tip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 2;
  display: none;
  width: max-content;
  max-width: min(240px, calc(100vw - 32px));
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--canvas);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.5;
  color: var(--carbon);
  pointer-events: none;
}

.cap-seg:first-child .chart-tip,
.hbar-row .chart-tip {
  right: auto;
  left: 0;
}

.chart-mark:hover .chart-tip,
.chart-mark:focus-visible .chart-tip {
  display: block;
}

/* ---------- 根目录入口页：无脚本的静态链接，正文自行滚动 ---------- */
body.launch {
  overflow-y: auto;
}

.launch-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 72px 20px calc(48px + env(safe-area-inset-bottom));
}

.launch-title {
  margin: 28px 0 8px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
}

.launch-lead {
  margin: 0 0 28px;
  color: var(--pewter);
  text-wrap: pretty;
}

.launch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.launch-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  color: inherit;
  text-decoration: none;
}

.launch-link:hover {
  background: var(--fog);
  border-color: var(--line-strong);
}

.launch-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.launch-name {
  font-size: 16px;
  font-weight: 600;
}

.launch-sub {
  font-size: 14px;
  color: var(--pewter);
}

.launch-go {
  color: var(--pewter);
}

.launch-note {
  margin: 24px 0 0;
  font-size: 13px;
  color: var(--pewter);
}

@media (max-width: 767px) {
  .launch-main {
    padding-top: 40px;
  }

  .launch-title {
    font-size: 24px;
  }
}

/* ---------- 平板与手机：侧栏改为抽屉 ---------- */
@media (max-width: 1023px) {
  .app,
  .app.has-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: min(300px, 86vw);
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform 0.2s ease, visibility 0.2s;
  }

  .is-drawer .sidebar {
    visibility: visible;
    transform: none;
    box-shadow: var(--overlay-shadow);
  }

  .icon-btn.side-close,
  .icon-btn.top-menu,
  .icon-btn.top-new {
    display: inline-grid;
  }

  .topbar {
    padding: 0 8px;
  }

  .table th,
  .table td {
    padding-inline: 10px;
  }

  .panel-scrim {
    display: block;
  }

  .side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: min(var(--panel-w), 92vw);
    border-left: 0;
    box-shadow: var(--overlay-shadow);
  }
}

/* ---------- 手机 ---------- */
@media (max-width: 767px) {
  .net-text,
  .demo-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .net {
    padding: 0 8px;
  }

  .demo-btn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .side-panel {
    top: auto;
    left: 0;
    width: auto;
    max-height: 86dvh;
    border-radius: 20px 20px 0 0;
  }

  .side-panel .panel-head {
    position: relative;
  }

  .side-panel .panel-head::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--mist);
    transform: translateX(-50%);
  }

  /* 手机首页：输入框贴底，示例在其上方，与对话页位置一致 */
  .home {
    justify-content: flex-end;
    gap: 16px;
    padding: 16px 12px 0;
  }

  .home-hero {
    margin-top: auto;
    padding-top: 16px;
  }

  .home-h {
    font-size: 24px;
  }

  .home-explore {
    order: 2;
    align-items: stretch;
  }

  .home-compose {
    position: sticky;
    bottom: 0;
    order: 3;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: var(--canvas);
  }

  .thread-inner {
    padding: 16px 16px 8px;
  }

  .chat-compose {
    padding: 0 10px calc(8px + env(safe-area-inset-bottom));
  }

  .composer-foot {
    font-size: 12px;
  }

  .u-bubble {
    max-width: 88%;
  }

  .page {
    padding: 24px 16px 48px;
  }

  .page-h {
    font-size: 22px;
  }

  .card-grid,
  .role-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar .seg {
    flex-basis: 100%;
  }

  .search {
    width: 100%;
  }

  .pool-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .pool-count {
    text-align: left;
  }

  .gpu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart {
    padding: 14px 10px;
  }

  .hbars > li {
    padding-inline: 8px;
  }

  .hbar-row {
    grid-template-columns: 30px minmax(0, 1fr) 54px;
    gap: 8px;
  }

  .table-stack td:not([data-label]):not(.row-ops) {
    justify-content: flex-start;
  }

  .table-stack .mono {
    overflow-wrap: anywhere;
  }

  .kv > div {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* 两列网格里落单的最后一块横跨整行 */
  .tile:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  /* 业务表格在手机上改为逐行条目：首列作标题、操作放在标题行右侧，其余列用 data-label 标出列名 */
  .table-stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .table-stack,
  .table-stack tbody {
    display: block;
  }

  .table-stack tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    padding: 12px 14px;
  }

  .table-stack tr + tr {
    border-top: 1px solid var(--line);
  }

  .table-stack td {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 3px 0;
    border-top: 0;
    text-align: right;
  }

  .table-stack td::before {
    content: attr(data-label);
    flex: none;
    font-family: var(--font);
    font-size: 13px;
    color: var(--pewter);
    text-align: left;
  }

  .table-stack td:first-child {
    grid-column: 1;
    grid-row: 1;
    padding-bottom: 6px;
    font-weight: 600;
    text-align: left;
  }

  .table-stack td:first-child::before,
  .table-stack td.row-ops::before {
    content: none;
  }

  /* 接口示例在窄屏上换行显示，避免关键信息藏在横向滚动里 */
  .code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .table-stack td.row-ops {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-end;
    padding: 0;
  }

  .agent-card {
    flex-wrap: wrap;
  }

  .dialog {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: 90dvh;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    transform: none;
  }

  .dialog-actions .btn {
    flex: 1;
  }

  #toast {
    bottom: calc(132px + env(safe-area-inset-bottom));
  }

  /* 手机上附件排成一行横向滑动，避免多个附件把输入框撑得过高；露出下一个附件提示还能滑动 */
  .att-tray .att-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .att-tray .att {
    flex: none;
    width: 220px;
    scroll-snap-align: start;
  }
}

/* ---------- 桌面：侧面板占右栏，不遮挡对话 ---------- */
@media (min-width: 1024px) {
  .is-drawer .drawer-scrim {
    display: none;
  }
}

/* 触屏：小控件补足 44px 触控高度 */
@media (pointer: coarse) {
  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .att {
    padding-right: 50px;
  }

  .att-remove {
    right: 4px;
    width: 44px;
    height: 44px;
  }

  .pill-btn,
  .src-chip,
  .text-btn,
  .seg-btn,
  .ctx-btn,
  .demo-btn,
  .hist-item,
  .nav-item,
  .level-chip,
  .hbar-row,
  .btn {
    min-height: 44px;
  }

  .send {
    width: 40px;
    height: 40px;
  }

  /* 整行标签都可点，用上下内边距把触控高度撑到 44px */
  .check,
  .field .check {
    margin: 0;
    padding-block: 11px;
  }
}

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

@media (forced-colors: active) {
  .send,
  .btn-dark,
  .pill-btn.is-dark {
    border: 1px solid ButtonText;
  }

  .nav-item[aria-pressed='true'],
  .btn[aria-pressed='true'],
  .seg-btn[aria-pressed='true'],
  .choice[aria-pressed='true'] {
    outline: 2px solid Highlight;
  }

  .cap-public,
  .hbar-base,
  .meter > span,
  .progress > span {
    forced-color-adjust: none;
    background: CanvasText;
    color: Canvas;
  }

  .cap-safety,
  .hbar-half {
    forced-color-adjust: none;
    background: repeating-linear-gradient(45deg, Canvas 0 3px, CanvasText 3px 4px);
  }

  .cap-maint {
    forced-color-adjust: none;
    background: repeating-linear-gradient(135deg, Canvas 0 3px, CanvasText 3px 4px);
  }

  .cap-included {
    forced-color-adjust: none;
    background: radial-gradient(CanvasText 0.7px, transparent 1px) Canvas;
    background-size: 4px 4px;
  }

  .cap-sellable,
  .cap-overflow {
    background: Canvas;
    border: 1px solid CanvasText;
  }

  .cap-overflow {
    border-style: dashed;
  }

  .cap-n {
    forced-color-adjust: none;
    background: Canvas;
    color: CanvasText;
  }

  .cap-public .cap-n {
    background: CanvasText;
    color: Canvas;
  }

  .is-thread .chat-compose::before {
    display: none;
  }
}

/* 三语长标签保持可读。 */
.nav-item > span, .row-text, .menu-item-main { overflow-wrap: anywhere; }

/* 本地录音：状态、计时和确认优先，不绘制模拟波形。 */
.voice-mic { flex: none; width: 44px; height: 44px; }
.voice-tray {
  margin: 0 0 12px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.voice-status, .voice-clip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}
.voice-clip { justify-content: space-between; }
.voice-note { margin: 10px 0 0; color: var(--pewter); font-size: 12px; line-height: 1.6; }
.voice-transcript { display: block; width: 100%; margin: 8px 0; min-height: 96px; resize: vertical; }
.voice-tray .pill-btn { min-height: 44px; white-space: normal; }
.voice-tray .btn-row { flex-wrap: wrap; }
.a-actions [data-action='voiceRead'] { width: 44px; height: 44px; }

/* 用量图：单一已报告 token 序列；输入、输出和未知用量在表格中分别核对。 */
.usage-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.usage-filters label { display: grid; gap: 6px; min-width: 0; color: var(--pewter); font-size: 13px; }
.usage-filters .select { min-width: 0; width: 100%; min-height: 44px; color: var(--carbon); }
.usage-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.usage-tiles .tile { min-width: 0; }
.usage-tiles .tile-value { font-size: clamp(22px, 2.2vw, 28px); overflow-wrap: anywhere; }
.usage-tiles .tile-note { margin: 8px 0 0; color: var(--pewter); font-size: 12px; line-height: 1.5; }
.usage-trend { margin-block: 24px; }
.chart-scale { margin: 6px 0 0; color: var(--pewter); font-size: 12px; font-variant-numeric: tabular-nums; }
.usage-bars { display: flex; gap: 4px; padding: 42px 4px 4px; overflow-x: auto; }
.usage-bar-item { position: relative; flex: 1 0 40px; min-width: 40px; padding: 0 4px; text-align: center; border-radius: 4px; }
.usage-bar-track { display: flex; justify-content: center; align-items: flex-end; height: 150px; border-bottom: 1px solid var(--line); }
.usage-bar-fill { display: block; width: 14px; background: var(--carbon); border-radius: 4px 4px 0 0; }
.usage-bar-date { display: block; margin-top: 8px; color: var(--pewter); font-size: 11px; font-variant-numeric: tabular-nums; }
.usage-bar-item .chart-tip { position: fixed; left: 0; right: auto; top: 0; bottom: auto; visibility: hidden; font-size: 12px; }
.usage-section { margin-top: 28px; }
.usage-partial { display: inline-block; margin-left: 6px; color: var(--pewter); font-size: 11px; }
.usage-daily { margin: 24px 0; }
.usage-daily > summary { padding: 12px 0; cursor: pointer; min-height: 44px; }
.usage-notes { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.usage-notes .a-list { color: var(--pewter); font-size: 13px; }
.usage-page .table th, .usage-page .table td { overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .usage-filters, .usage-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composer-row { gap: 6px; }
  .composer-row .ctx-btn { padding-inline: 10px; white-space: normal; min-height: 44px; }
  .composer-row .ctx-btn.is-static { min-width: 0; }
  .composer-row .ctx-btn.is-static .ctx-text { min-width: 0; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  .voice-tray { max-height: 45dvh; overflow-y: auto; }
  .usage-page .page-top { flex-wrap: wrap; gap: 10px; }
}
@media (max-width: 419px) {
  .usage-filters { grid-template-columns: 1fr; }
  .composer-hint { display: none; }
}
@media (forced-colors: active) {
  .usage-bar-fill { forced-color-adjust: none; background: CanvasText; }
}
