/* 随身助手 · 移动端界面样式（配色对齐 DSH 桌面端主题，按 390×844 设计） */

:root {
  color-scheme: dark;
  --bg: #151517;
  --bg-elev: #232324;
  --bg-elev-2: #2c2c2e;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f9fafb;
  --muted: #cfd3d6;
  --accent: #3b82f6;
  --accent-press: #2563eb;
  --on-accent: #ffffff;
  --user-bubble: #24345c;
  --user-text: #e8f0fe;
  --danger: #f25a5a;
  --warn: #f59e0b;
  --ok: #22c55e;
  /* 主题派生色（浅色主题会覆盖） */
  --topbar-bg: rgba(21, 21, 23, 0.94);
  --composer-bg: rgba(21, 21, 23, 0.96);
  --overlay: rgba(255, 255, 255, 0.08);
  --overlay-faint: rgba(255, 255, 255, 0.04);
  --link: #93b4ff;
  --placeholder: #81858c;
  --code-bg: #1b1b1c;
  --tap: 44px;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

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

[hidden] {
  display: none !important;
}

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

.noscript {
  margin: 0;
  padding: 24px;
  color: var(--muted);
}

/* ---------- 通用控件 ---------- */

.btn {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:active {
  background: var(--accent-press);
}

.btn-block {
  width: 100%;
}

.btn-stop {
  border-color: rgba(239, 83, 80, 0.6);
  color: var(--danger);
  background: rgba(239, 83, 80, 0.1);
}

.btn-stop:active {
  background: rgba(239, 83, 80, 0.18);
}

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

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

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:active {
  background: var(--overlay);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 视图框架 ---------- */

#app {
  position: fixed;
  inset: 0;
}

.view {
  position: fixed;
  top: var(--app-offset, 0px);
  left: 0;
  right: 0;
  height: var(--app-height, 100dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- 登录 ---------- */

.view-login {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: calc(var(--safe-top) + 24px) 24px calc(var(--safe-bottom) + 24px);
}

.login-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
}

.login-title {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.login-desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pin-input {
  width: 100%;
  min-height: 56px;
  padding: 0 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.45em;
  text-align: center;
  outline: none;
}

.pin-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--overlay);
}

.login-hint {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.4;
}

/* ---------- 对话顶部栏 ---------- */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: calc(52px + var(--safe-top));
  padding: calc(var(--safe-top) + 4px) 6px 4px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.topbar-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.topbar-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 600;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}

.topbar-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.topbar-status[data-status="running"],
.topbar-status[data-status="queued"],
.topbar-status[data-status="stopping"] {
  color: var(--accent);
}

.topbar-status[data-status="error"] {
  color: var(--danger);
}

/* ---------- 提示条 ---------- */

.banners {
  flex: 0 0 auto;
}

.banner {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 6px 0 14px;
  font-size: 13px;
  line-height: 1.4;
}

.banner-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.banner-warn {
  color: #f5cd73;
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
}

.banner-error {
  color: #ffb4b2;
  background: rgba(242, 90, 90, 0.14);
  border-bottom: 1px solid rgba(242, 90, 90, 0.3);
}

.banner-close {
  flex: 0 0 auto;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.banner-close:active {
  background: var(--overlay);
}

/* ---------- 消息列表 ---------- */

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px 18px;
}

.msg-row {
  display: flex;
  justify-content: flex-end;
}

.msg-row.pending {
  opacity: 0.62;
}

.msg-user {
  max-width: 82%;
  padding: 9px 13px;
  background: var(--user-bubble);
  color: var(--user-text);
  border-radius: 16px 16px 4px 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.msg-assistant {
  align-self: stretch;
  max-width: 100%;
  padding: 2px 2px;
  background: transparent;
  border: none;
  border-radius: 0;
}

.msg-assistant.final {
  border: none;
}

.msg-assistant .para {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-assistant .para + .para {
  margin-top: 8px;
}

.link {
  color: var(--link);
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.msg strong {
  font-weight: 600;
  color: var(--text);
}

.inline-code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--overlay);
  border-radius: 5px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}

.msg-system {
  align-self: center;
  padding: 2px 10px;
  color: var(--muted);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}

/* ---------- 工具调用卡片 ---------- */

.tool-card {
  align-self: stretch;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  padding: 8px 12px;
  background: transparent;
  border: 0;
  color: var(--text);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}

.tool-head:active {
  background: var(--overlay-faint);
}

.tool-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.tool-card.done .tool-dot {
  background: var(--ok);
}

.tool-card.failed .tool-dot {
  background: var(--danger);
}

.tool-name {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}

.tool-summary {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.tool-state {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
}

.tool-caret {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  transition: transform 0.15s ease;
}

.tool-card.open .tool-caret {
  transform: rotate(180deg);
}

.tool-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.tool-label {
  margin: 10px 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.tool-pre {
  margin: 0;
  padding: 8px 10px;
  max-height: 260px;
  overflow: auto;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tool-more {
  display: block;
  width: 100%;
  min-height: var(--tap);
  margin-top: 8px;
  padding: 0 12px;
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
}

/* ---------- 空状态 ---------- */

.empty-state {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}

.empty-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- 输入区 ---------- */

.composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: var(--composer-bg);
  border-top: 1px solid var(--line);
}

.composer-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tap);
  max-height: 132px;
  padding: 11px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  resize: none;
  line-height: 1.4;
  font-size: 15px;
}

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

.composer-input:focus {
  border-color: var(--accent);
}

.composer-btn {
  flex: 0 0 auto;
  min-width: 62px;
  padding: 0 14px;
}

/* ---------- 会话列表抽屉 ---------- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.56);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.drawer.open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(86vw, 340px);
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.55);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}

.drawer.open .drawer-panel {
  transform: translateX(0);
}

.drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 6px 6px 6px 16px;
}

.drawer-title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.thread-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 8px 16px;
}

.thread-item {
  display: grid;
  grid-template-columns: 1fr var(--tap);
  align-items: stretch;
  margin-bottom: 4px;
  border-radius: 12px;
}

.thread-item.active {
  background: var(--overlay);
}

.thread-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 60px;
  padding: 8px 4px 8px 10px;
  background: transparent;
  border: 0;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.thread-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.thread-sub {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.thread-more {
  align-self: center;
  font-size: 18px;
  color: var(--muted);
}

.thread-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  padding: 0 8px 8px;
}

.thread-actions .btn {
  flex: 1 1 0;
  font-size: 14px;
}

.drawer-empty {
  margin: 0;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- 抽屉底部：新会话设置 ---------- */

.drawer-settings {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg-elev-2);
}

.drawer-settings-title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.settings-label {
  font-size: 12px;
  color: var(--muted);
}

.settings-select,
.settings-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
}

.settings-select:focus,
.settings-input:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-hint {
  margin: 2px 0 0;
  min-height: 16px;
  font-size: 12px;
  color: var(--muted);
}

.settings-hint.ok {
  color: var(--ok);
}

.settings-hint.error {
  color: var(--danger);
}

/* ---------- 模态框 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.modal-input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.modal-input:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn {
  flex: 1 1 0;
}

/* ---------- 技能 / 目标面板 ---------- */

.panel {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}

.panel-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(84vh, 680px);
  padding-bottom: var(--safe-bottom);
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.4);
  animation: panel-in 0.2s ease;
}

@keyframes panel-in {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px 8px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-tabs {
  flex: 1 1 auto;
  display: flex;
  gap: 6px;
}

.panel-tab {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.panel-tab.active {
  background: var(--overlay);
  color: var(--text);
}

.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px calc(14px + var(--safe-bottom));
  overflow: hidden;
}

.panel-search {
  flex: 0 0 auto;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.panel-search:focus {
  border-color: var(--accent);
}

.panel-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 4px;
}

.panel-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.panel-item:active {
  background: var(--overlay);
}

.panel-item-name {
  font-size: 14px;
  font-weight: 600;
}

.panel-item-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.panel-empty {
  margin: 0;
  padding: 20px 4px;
  color: var(--muted);
  font-size: 14px;
}

.panel-footer {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
}

.panel-footer .btn {
  flex: 1 1 0;
}

.panel-section-title {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.goal-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev-2);
}

.goal-card.clickable {
  cursor: pointer;
}

.goal-card.clickable:active {
  background: var(--overlay);
}

.goal-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.goal-phase {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--overlay);
  font-size: 11px;
  font-weight: 600;
}

.goal-phase-active {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.16);
}

.goal-phase-paused {
  color: var(--warn);
  background: rgba(245, 158, 11, 0.16);
}

.goal-phase-complete {
  color: var(--ok);
  background: rgba(34, 197, 94, 0.16);
}

.goal-phase-blocked {
  color: var(--danger);
  background: rgba(242, 90, 90, 0.16);
}

.goal-rounds,
.goal-thread,
.goal-time {
  color: var(--muted);
  font-size: 11px;
}

.goal-thread {
  margin-left: auto;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-objective {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.goal-blocked {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(242, 90, 90, 0.1);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.goal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.goal-actions .btn {
  flex: 1 1 auto;
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
}

/* ---------- 大屏适配（仍以手机为主） ---------- */

@media (min-width: 700px) {
  .view-chat {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .panel-sheet {
    width: 640px;
    border: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}


/* ---------- 浅色主题（对齐 DSH 桌面端浅色） ---------- */

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-elev-2: #f9fafb;
  --line: rgba(15, 17, 21, 0.08);
  --text: #0f1115;
  --muted: #61666b;
  --accent: #2563eb;
  --accent-press: #1d4ed8;
  --on-accent: #ffffff;
  --user-bubble: #edf3fe;
  --user-text: #0f1115;
  --danger: #ec1313;
  --warn: #f59e0b;
  --ok: #22c55e;
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --composer-bg: rgba(255, 255, 255, 0.96);
  --overlay: rgba(15, 17, 21, 0.06);
  --overlay-faint: rgba(15, 17, 21, 0.03);
  --link: #2563eb;
  --placeholder: #979da6;
  --code-bg: #fafafa;
}

html[data-theme="light"] .banner-warn {
  color: #8a5a00;
  background: rgba(245, 158, 11, 0.14);
  border-bottom-color: rgba(245, 158, 11, 0.32);
}

html[data-theme="light"] .banner-error {
  color: #b30f0f;
  background: rgba(236, 19, 19, 0.08);
  border-bottom-color: rgba(236, 19, 19, 0.22);
}

html[data-theme="light"] .tool-dot {
  box-shadow: none;
}

/* ---------- 电脑端会话（只读） ---------- */

.desk-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 52vh;
  overflow-y: auto;
}

.desk-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.desk-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.desk-item-meta {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.desk-item-snippet {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.desk-item-action {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 13px;
  min-height: 34px;
  padding: 4px 12px;
}

/* ---------- 顶部模式/模型信息 ---------- */

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar-settings {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 附件 ---------- */

.composer-attach {
  flex: 0 0 auto;
  width: var(--tap);
  height: var(--tap);
  font-size: 22px;
  color: var(--muted);
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px 0;
  flex: 0 0 auto;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  font-size: 12px;
  color: var(--text);
}

.attachment-chip-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip-remove {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.attachment-chip.uploading {
  opacity: 0.6;
}

.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.msg-attachment {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .msg-attachment {
  background: rgba(255, 255, 255, 0.1);
}

/* ---------- 指令面板 ---------- */

.cmd-palette {
  flex: 0 0 auto;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 8px;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
}

.cmd-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 9px 8px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}

.cmd-item.active,
.cmd-item:active {
  background: var(--overlay);
}

.cmd-name {
  font-weight: 600;
  white-space: nowrap;
}

.cmd-desc {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 目标条 ---------- */

.goal-bar {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(59, 130, 246, 0.1);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.goal-bar:active {
  background: rgba(59, 130, 246, 0.18);
}

.goal-label {
  flex: 0 0 auto;
  font-weight: 600;
  color: var(--accent);
}

.goal-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-arrow {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
