/* my_agent — 轻奢风格：柔和明亮 + 磨砂半透明 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600&family=JetBrains+Mono:wght@400&display=swap');

:root {
  --bg-page: #f5f2ee;
  --bg-page-2: #ebe7e2;
  --bg-glass: rgba(255, 255, 255, 0.65);
  --bg-glass-strong: rgba(255, 255, 255, 0.85);
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-message-user: rgba(184, 165, 116, 0.22);
  --bg-message-bot: rgba(255, 255, 255, 0.9);
  --bg-system: rgba(184, 165, 116, 0.14);
  --border: rgba(0, 0, 0, 0.06);
  --border-focus: rgba(184, 165, 116, 0.5);
  --text: #2d2a26;
  --text-muted: #6b6560;
  --text-dim: #8a8580;
  --accent: #a8956e;
  --accent-hover: #b8a574;
  --accent-soft: rgba(168, 149, 110, 0.25);
  --ant-primary: #1677ff;
  --ant-primary-soft: rgba(22, 119, 255, 0.1);
  --ant-border: #d9d9d9;
  --select-arrow: linear-gradient(45deg, transparent 50%, rgba(0, 0, 0, 0.45) 50%), linear-gradient(135deg, rgba(0, 0, 0, 0.45) 50%, transparent 50%);
  --success: #5a8f5a;
  --error: #b85c5c;
  --radius: 10px;
  --radius-lg: 14px;
  --font-sans: 'Outfit', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
  --shadow-soft: 0 2px 20px rgba(0, 0, 0, 0.06);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.08);
  --ease-ui: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(160deg, var(--bg-page) 0%, var(--bg-page-2) 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 0;
  line-height: 1.55;
}

body.login-locked {
  overflow: hidden;
}

body.login-locked .app-shell {
  filter: blur(18px);
  opacity: 0.25;
  pointer-events: none;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(22, 119, 255, 0.14), transparent 28%),
    radial-gradient(circle at 84% 20%, rgba(184, 165, 116, 0.18), transparent 30%),
    linear-gradient(160deg, var(--bg-page), var(--bg-page-2));
  transition: opacity 0.35s var(--ease-ui), visibility 0.35s var(--ease-ui);
}

.login-gate-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.login-orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-orbit-ring {
  position: absolute;
  border: 1px solid rgba(22, 119, 255, 0.14);
  border-radius: 999px;
  box-shadow: inset 0 0 28px rgba(255, 255, 255, 0.35);
}

.login-orbit-ring-a {
  right: -160px;
  top: -180px;
  width: 520px;
  height: 520px;
  animation: loginOrbit 28s linear infinite;
}

.login-orbit-ring-b {
  left: -120px;
  bottom: -160px;
  width: 420px;
  height: 420px;
  border-color: rgba(168, 149, 110, 0.16);
  animation: loginOrbit 34s linear infinite reverse;
}

.login-signal-dot {
  position: absolute;
  right: 18%;
  top: 22%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--ant-primary);
  box-shadow: 0 0 0 10px rgba(22, 119, 255, 0.12), 0 0 34px rgba(22, 119, 255, 0.35);
  animation: loginPulse 2.8s ease-in-out infinite;
}

.login-preview {
  position: absolute;
  right: 5vw;
  width: min(620px, 58vw);
  height: min(620px, 72vh);
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.24);
  filter: blur(1px);
  opacity: 0.6;
  transform: rotate(-3deg) translateX(70px);
  box-shadow: 0 30px 80px rgba(45, 42, 38, 0.14);
}

.login-preview-sidebar,
.login-preview-panel {
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(18px);
}

.login-preview-sidebar {
  padding: 22px;
}

.login-preview-sidebar span,
.login-preview-header,
.login-preview-message,
.login-preview-input {
  display: block;
  border-radius: 999px;
  background: rgba(168, 149, 110, 0.18);
}

.login-preview-sidebar span {
  height: 28px;
  margin-bottom: 14px;
}

.login-preview-panel {
  padding: 26px;
}

.login-preview-header {
  width: 52%;
  height: 36px;
  margin-bottom: 80px;
}

.login-preview-message {
  width: 72%;
  height: 64px;
  margin-bottom: 18px;
}

.login-preview-message-user {
  width: 48%;
  margin-left: auto;
  background: rgba(22, 119, 255, 0.12);
}

.login-preview-input {
  position: absolute;
  left: 200px;
  right: 42px;
  bottom: 42px;
  height: 58px;
  background: rgba(255, 255, 255, 0.72);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 48px));
  min-height: 560px;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.58)),
    radial-gradient(circle at 92% 8%, rgba(22, 119, 255, 0.11), transparent 30%);
  backdrop-filter: blur(28px);
  box-shadow: 0 28px 80px rgba(45, 42, 38, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.login-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px 16px;
  border-right: 1px solid rgba(168, 149, 110, 0.16);
  background: rgba(255, 255, 255, 0.34);
}

.login-rail-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  font-weight: 700;
}

.login-rail-line {
  position: relative;
  flex: 1;
  width: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(168, 149, 110, 0.22);
}

.login-rail-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, var(--ant-primary), transparent);
  transform: translateY(-100%);
}

.login-loading .login-rail-line::after {
  animation: loginRailScan 1.2s ease-in-out infinite;
}

.login-rail-status {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.login-card-body {
  padding: 52px;
}

.login-header {
  max-width: 460px;
  margin-bottom: 30px;
}

.login-eyebrow {
  color: var(--ant-primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-header h1 {
  margin: 12px 0 14px;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.07em;
}

.login-header p {
  color: var(--text-muted);
  max-width: 390px;
}

.login-form {
  max-width: 390px;
}

.login-field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.login-field input {
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--ant-border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.login-field input:focus {
  border-color: var(--ant-primary);
  box-shadow: 0 0 0 3px var(--ant-primary-soft);
  transform: translateY(-1px);
}

.login-field-invalid input {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(184, 92, 92, 0.12);
}

.login-options,
.login-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.login-options {
  justify-content: space-between;
  margin: 4px 0 12px;
}

.login-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.login-link {
  border: 0;
  background: transparent;
  color: var(--ant-primary);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
}

.login-status {
  min-height: 22px;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.login-status[data-state='error'] {
  color: var(--error);
}

.login-status[data-state='success'] {
  color: var(--success);
}

.login-submit {
  position: relative;
  width: 100%;
  min-height: 46px;
  overflow: hidden;
}

.login-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0%, rgba(22, 119, 255, 0.28) 50%, transparent 100%);
  transform: translateX(-120%);
}

.login-loading .login-submit::after {
  animation: loginButtonScan 1.1s ease-in-out infinite;
}

.login-submit-spinner {
  display: none;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 999px;
  animation: loginSpin 0.8s linear infinite;
}

.login-loading .login-submit-spinner {
  display: inline-block;
}

.login-footer {
  margin-top: 28px;
}

.login-chip {
  padding: 5px 9px;
  border: 1px solid rgba(168, 149, 110, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--text-dim);
  font-size: 0.72rem;
}

.login-chip-blue {
  border-color: rgba(22, 119, 255, 0.18);
  color: var(--ant-primary);
}

.login-error .login-card-body {
  animation: loginShake 0.24s ease-out;
}

.login-success .login-card {
  opacity: 0;
  transform: translateY(-16px) scale(0.985);
  transition: opacity 0.26s var(--ease-ui), transform 0.26s var(--ease-ui);
}

@keyframes loginOrbit {
  to { transform: rotate(360deg); }
}

@keyframes loginPulse {
  0%, 100% { opacity: 0.52; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes loginRailScan {
  to { transform: translateY(100%); }
}

@keyframes loginButtonScan {
  to { transform: translateX(120%); }
}

@keyframes loginSpin {
  to { transform: rotate(360deg); }
}

@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

select option {
  background: #fff;
  color: var(--text);
}

.native-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.custom-select-trigger {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 32px 7px 11px;
  border: 1px solid var(--ant-border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.custom-select-trigger:hover {
  border-color: #4096ff;
}

.custom-select-open .custom-select-trigger {
  border-color: var(--ant-primary);
  box-shadow: 0 0 0 3px var(--ant-primary-soft);
}

.custom-select-disabled .custom-select-trigger,
.custom-select-trigger:disabled {
  cursor: not-allowed;
  border-color: rgba(5, 5, 5, 0.04);
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.35);
  box-shadow: none;
}

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

.custom-select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid rgba(0, 0, 0, 0.45);
  border-bottom: 1.5px solid rgba(0, 0, 0, 0.45);
  transform: translateY(-62%) rotate(45deg);
  transition: transform 0.18s ease;
}

.custom-select-open .custom-select-arrow {
  transform: translateY(-28%) rotate(225deg);
}

.custom-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 1600;
  display: none;
  max-height: 268px;
  padding: 6px;
  overflow: auto;
  border: 1px solid rgba(5, 5, 5, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.62) inset;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.custom-select-open .custom-select-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: customSelectIn 0.14s ease-out;
}

.custom-select-option {
  width: 100%;
  min-height: 32px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(0, 0, 0, 0.78);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.35;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-option:hover {
  background: rgba(22, 119, 255, 0.08);
  color: #0958d9;
}

.custom-select-option-selected {
  background: rgba(22, 119, 255, 0.12);
  color: #0958d9;
  font-weight: 600;
}

.custom-select-option-disabled,
.custom-select-option:disabled {
  cursor: not-allowed;
  background: transparent;
  color: rgba(0, 0, 0, 0.28);
}

.custom-select-workbench .custom-select-trigger {
  min-height: 28px;
  margin-top: 2px;
  padding: 3px 30px 3px 9px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.875rem;
}

.custom-select-workbench .custom-select-trigger:hover,
.custom-select-workbench.custom-select-open .custom-select-trigger {
  border-color: var(--ant-border);
  background: #fff;
}

.custom-select-workbench .custom-select-menu {
  min-width: min(420px, 84vw);
}

@keyframes customSelectIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 主容器：磨砂玻璃卡片 */
.container {
  width: 100%;
  max-width: none;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  display: flex;
  flex-direction: row;
  gap: 0;
  height: 100vh;
}

.app-shell {
  position: relative;
}

.sidebar {
  position: relative;
  z-index: 20;
  flex: 0 0 280px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(5, 5, 5, 0.06);
  border-left: 0;
  border-radius: 0 18px 18px 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.48));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.08);
  transition: flex-basis 0.34s var(--ease-ui), width 0.34s var(--ease-ui), padding 0.34s var(--ease-ui), opacity 0.24s ease, transform 0.34s var(--ease-ui), box-shadow 0.34s var(--ease-ui);
  will-change: flex-basis, width, padding, opacity, transform;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.brand-mark {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--ant-primary), #69b1ff);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(22, 119, 255, 0.22);
}

.brand-copy {
  flex: 1;
  min-width: 0;
}

.brand-copy h1 {
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-copy p {
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.71875rem;
  white-space: nowrap;
}

.sidebar-toggle {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(247, 251, 255, 0.72)),
    radial-gradient(circle at 100% 0%, rgba(22, 119, 255, 0.12), transparent 34%);
  color: rgba(0, 0, 0, 0.58);
  cursor: pointer;
  font-family: inherit;
  font-size: 1.1rem;
  line-height: 1;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  border-color: rgba(22, 119, 255, 0.22);
  background: rgba(22, 119, 255, 0.08);
  color: var(--ant-primary);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(22, 119, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  outline: none;
}

.sidebar-hidden-controls {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-section {
  position: relative;
}

.sidebar-section-label,
.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.71875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-section-title small {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(22, 119, 255, 0.08);
  color: var(--ant-primary);
  text-align: center;
  letter-spacing: 0;
}

.sidebar-agent-card,
.sidebar-agent-item,
.sidebar-conversation-item,
.sidebar-action-btn,
.sidebar-primary-btn,
.sidebar-nav-btn,
.model-pill {
  font-family: inherit;
}

.sidebar-agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(22, 119, 255, 0.12);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(22, 119, 255, 0.08), rgba(255, 255, 255, 0.74));
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.sidebar-agent-card:hover {
  border-color: rgba(22, 119, 255, 0.28);
  box-shadow: 0 6px 18px rgba(22, 119, 255, 0.08);
}

.sidebar-agent-avatar,
.sidebar-agent-dot {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(5, 5, 5, 0.06);
}

.sidebar-agent-copy,
.sidebar-agent-item span,
.sidebar-conversation-item {
  min-width: 0;
}

.sidebar-agent-copy,
.sidebar-agent-item span {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-agent-copy strong,
.sidebar-agent-item strong,
.sidebar-conversation-item strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-agent-copy small,
.sidebar-agent-item small,
.sidebar-conversation-item small {
  overflow: hidden;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.71875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-agent-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
  display: none;
  flex-direction: column;
  gap: 5px;
  max-height: 260px;
  padding: 8px;
  overflow: auto;
  border: 1px solid rgba(5, 5, 5, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.sidebar-agent-list-open #sidebarAgentList {
  display: flex;
}

.sidebar-agent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.sidebar-agent-item:hover,
.sidebar-agent-item-active {
  border-color: rgba(22, 119, 255, 0.14);
  background: rgba(22, 119, 255, 0.06);
}

.sidebar-primary-btn,
.sidebar-action-btn,
.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(5, 5, 5, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
  color: rgba(0, 0, 0, 0.72);
  cursor: pointer;
  font-size: 0.8125rem;
  text-align: left;
}

.sidebar-primary-btn {
  justify-content: center;
  border-color: rgba(22, 119, 255, 0.22);
  background: var(--ant-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(22, 119, 255, 0.16);
}

.sidebar-primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.sidebar-action-btn:hover,
.sidebar-nav-btn:hover {
  border-color: rgba(22, 119, 255, 0.18);
  background: rgba(22, 119, 255, 0.06);
  color: var(--ant-primary);
}

.conversations-section {
  flex: 1;
  min-height: 0;
}

.sidebar-conversation-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: auto;
  padding-right: 2px;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.8125rem;
}

.sidebar-conversation-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.sidebar-conversation-item:hover,
.sidebar-conversation-item-active {
  border-color: rgba(22, 119, 255, 0.14);
  background: rgba(22, 119, 255, 0.06);
}

.sidebar-conversation-item-active {
  box-shadow: inset 3px 0 0 var(--ant-primary);
}

.sidebar-utility {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(5, 5, 5, 0.06);
}

.main-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 24px 18px 22px;
  background: transparent;
  transition: padding 0.34s var(--ease-ui);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 4px 4px 14px;
  border-bottom: 0;
  background: transparent;
  transition: padding 0.34s var(--ease-ui);
}

.chat-header-main {
  flex: 1;
  min-width: 0;
}

.chat-eyebrow {
  display: block;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-header h2 {
  overflow: hidden;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header p {
  overflow: hidden;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-pill {
  max-width: 260px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(22, 119, 255, 0.18);
  border-radius: 999px;
  background: rgba(22, 119, 255, 0.07);
  color: var(--ant-primary);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
}

.model-pill span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn-mini.mobile-sidebar-btn {
  display: none;
}

.mobile-sidebar-backdrop,
.mobile-action-dock {
  display: none;
}

.collapsed-sidebar-actions {
  position: fixed;
  top: 16px;
  left: 14px;
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(246, 250, 255, 0.72)),
    radial-gradient(circle at 12% 0%, rgba(22, 119, 255, 0.12), transparent 34%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.34s var(--ease-ui), box-shadow 0.22s ease;
}

.collapsed-action-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(5, 5, 5, 0.06);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(0, 0, 0, 0.68);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.collapsed-action-btn:hover,
.collapsed-action-btn:focus-visible {
  border-color: rgba(22, 119, 255, 0.2);
  background: rgba(22, 119, 255, 0.08);
  color: var(--ant-primary);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(22, 119, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  outline: none;
}

.collapsed-action-primary {
  background: var(--ant-primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(22, 119, 255, 0.22);
}

.collapsed-action-primary:hover {
  background: #0958d9;
  color: #fff;
}

.collapsed-action-btn.collapsed-action-disabled,
.collapsed-action-btn[aria-disabled='true'] {
  opacity: 0.45;
}

.collapsed-action-btn.collapsed-action-disabled:hover,
.collapsed-action-btn[aria-disabled='true']:hover,
.collapsed-action-btn.collapsed-action-disabled:focus-visible,
.collapsed-action-btn[aria-disabled='true']:focus-visible {
  border-color: rgba(5, 5, 5, 0.06);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(0, 0, 0, 0.68);
  transform: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.collapsed-agent-list {
  position: fixed;
  top: 68px;
  right: auto;
  left: 14px;
  z-index: 72;
  width: min(320px, calc(100vw - 28px));
  max-height: min(360px, calc(100vh - 92px));
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.14);
}

.sidebar-collapsed.collapsed-agent-list-open .collapsed-agent-list {
  display: flex;
}

.sidebar-collapsed .sidebar,
html.sidebar-prefers-collapsed .sidebar {
  flex-basis: 0;
  width: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-100%);
  overflow: hidden;
}

.sidebar-collapsed .collapsed-sidebar-actions,
html.sidebar-prefers-collapsed .collapsed-sidebar-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.sidebar-collapsed .main-panel,
html.sidebar-prefers-collapsed .main-panel {
  padding-left: 24px;
}

.sidebar-collapsed .chat-header,
html.sidebar-prefers-collapsed .chat-header {
  padding-left: 154px;
}

html.sidebar-prefers-collapsed .sidebar,
html.sidebar-prefers-collapsed .main-panel,
html.sidebar-prefers-collapsed .chat-header,
html.sidebar-prefers-collapsed .collapsed-sidebar-actions {
  transition: none;
}

/* 顶栏：磨砂半透明 */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.app-header-main {
  min-width: 0;
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.app-header .subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-glass-strong);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.icon-btn:hover {
  background: rgba(184, 165, 116, 0.12);
  color: var(--text);
  border-color: rgba(168, 149, 110, 0.4);
}

.icon-btn .icon-glyph {
  font-size: 0.95rem;
  line-height: 1;
}

.chat-container {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 136px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.messages::-webkit-scrollbar {
  width: 8px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.18);
}

.message {
  width: 100%;
  max-width: 1120px;
  margin-right: auto;
  margin-bottom: 18px;
  margin-left: auto;
  display: flex;
  animation: fadeIn 0.25s ease-out;
}

.message.user {
  margin-bottom: 22px;
}

.motion-enhanced .message,
.motion-enhanced .stream-tool-line {
  animation: none;
}

.motion-enhanced .stream-tool-line:not(.stream-tool-done):not(.stream-tool-error) {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.56), rgba(22, 119, 255, 0.075), rgba(255, 255, 255, 0.56));
  background-size: 220% 100%;
  animation: flowLineGlow 2.1s ease-in-out infinite;
}

.typing-caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 2px;
  border-radius: 999px;
  background: rgba(22, 119, 255, 0.72);
  box-shadow: 0 0 12px rgba(22, 119, 255, 0.28);
  vertical-align: -0.16em;
  animation: typingCaretPulse 0.95s ease-in-out infinite;
}

@keyframes typingCaretPulse {
  0%,
  100% {
    opacity: 0.28;
    transform: scaleY(0.82);
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  justify-content: flex-end;
}

.message-content {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: var(--radius);
  word-wrap: break-word;
  font-size: 0.9375rem;
}

.message.assistant .message-content {
  width: 100%;
  max-width: 100%;
}

.message.user .message-content {
  max-width: min(78%, 720px);
  background: var(--bg-message-user);
  color: var(--text);
  border: 1px solid rgba(168, 149, 110, 0.35);
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.message.assistant .message-content {
  padding: 4px 4px 4px 0;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.message.system .message-content {
  background: var(--bg-system);
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius);
  max-width: 100%;
}

.message-content p {
  margin-bottom: 6px;
}

.message-content p:last-child {
  margin-bottom: 0;
}
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
  margin: 10px 0 6px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.message-content h1 {
  font-size: 1.15rem;
}
.message-content h2 {
  font-size: 1.05rem;
}
.message-content h3,
.message-content h4 {
  font-size: 0.95rem;
}
.message-content hr {
  margin: 10px 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.message-content blockquote {
  margin: 8px 0;
  padding: 8px 10px;
  border-left: 3px solid var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(184, 165, 116, 0.08);
  color: var(--text-muted);
}

.message-content ul {
  margin-left: 1.25rem;
  margin-top: 6px;
}
.message-content ol {
  margin-left: 1.25rem;
  margin-top: 6px;
}
.message-content li {
  margin-bottom: 3px;
}
.message-content a {
  color: var(--accent);
}
.markdown-table-wrap {
  margin: 10px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
}
.message-content table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.message-content th,
.message-content td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.message-content th {
  background: rgba(184, 165, 116, 0.12);
  color: var(--text);
  font-weight: 600;
}
.message-content tr:last-child td {
  border-bottom: 0;
}

.message-content code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--text);
}

.message-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 6px;
}
.reasoning-block {
  margin-bottom: 8px;
  border: 1px solid rgba(168, 149, 110, 0.18);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.42), rgba(184, 165, 116, 0.075));
  box-shadow: 0 8px 22px rgba(168, 149, 110, 0.06);
  overflow: hidden;
}
.reasoning-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px 7px 12px;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.78125rem;
  font-weight: 600;
  list-style: none;
}
.reasoning-block summary::-webkit-details-marker {
  display: none;
}
.reasoning-block summary::after {
  content: '展开';
  flex-shrink: 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.65625rem;
  font-weight: 400;
}
.reasoning-block[open] summary::after {
  content: '收起';
}
.reasoning-block summary small {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: rgba(0, 0, 0, 0.38);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.reasoning-body {
  max-height: 260px;
  overflow: auto;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(168, 149, 110, 0.12);
  color: var(--text-muted);
  font-size: 0.78125rem;
  line-height: 1.5;
}
.trace-button {
  margin-left: 8px;
  padding: 3px 9px;
  border: 1px solid rgba(168, 149, 110, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
}
.trace-button:hover {
  background: rgba(184, 165, 116, 0.16);
  border-color: rgba(168, 149, 110, 0.42);
}

/* 输入区：磨砂半透明 */
.input-area {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 12px 8px 6px;
  background: transparent;
  border-top: 0;
  transition: padding 0.34s var(--ease-ui), background 0.22s ease;
}

.input-group {
  max-width: 820px;
  margin: 0 auto;
  padding: 10px;
  border: 1px solid rgba(5, 5, 5, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.1);
}

.slash-command-menu {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 10px);
  z-index: 20;
  display: none;
  width: calc(100% - 16px);
  max-width: 820px;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(246, 250, 255, 0.82)),
    radial-gradient(circle at 100% 0%, rgba(22, 119, 255, 0.13), transparent 34%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 54px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transform: translateX(-50%);
}

.slash-command-menu[aria-hidden='false'] {
  display: block;
}

.slash-command-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0 2px;
}

.slash-command-heading span {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

.slash-command-heading small {
  color: rgba(0, 0, 0, 0.38);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.slash-command-list {
  display: grid;
  gap: 6px;
  max-height: 286px;
  padding-top: 4px;
  overflow: auto;
}

.slash-command-item {
  width: 100%;
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.055);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.46);
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.18s;
}

.slash-command-item:hover,
.slash-command-item-active {
  transform: translateY(-1px);
  border-color: rgba(22, 119, 255, 0.24);
  background: rgba(22, 119, 255, 0.065);
  box-shadow: 0 10px 24px rgba(22, 119, 255, 0.09);
}

.slash-command-item-disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.slash-command-trigger,
.slash-command-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.slash-command-trigger strong {
  color: var(--ant-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.slash-command-trigger em {
  width: fit-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(184, 165, 116, 0.12);
  color: rgba(128, 99, 42, 0.72);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.slash-command-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slash-command-copy small {
  overflow: hidden;
  color: rgba(0, 0, 0, 0.46);
  font-size: 0.74rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 工作台条：Ant Design 风格的信息分组 */
.workbench {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px 22px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(250, 250, 250, 0.7));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.workbench-primary {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  border: 1px solid var(--ant-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  overflow: visible;
}

.workbench-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.workbench-primary .workbench-item + .workbench-item {
  border-left: 1px solid rgba(5, 5, 5, 0.06);
}

.workbench-item:focus-within,
.workbench-item:hover {
  background: rgba(22, 119, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(22, 119, 255, 0.16);
}

.workbench-item-button {
  flex: 0 0 220px;
  border: 1px solid rgba(22, 119, 255, 0.2);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(22, 119, 255, 0.1), rgba(255, 255, 255, 0.86));
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
}

.workbench-item-button:hover,
.workbench-item-button:focus-visible {
  border-color: rgba(22, 119, 255, 0.38);
  background: linear-gradient(135deg, rgba(22, 119, 255, 0.14), rgba(255, 255, 255, 0.94));
  box-shadow: 0 6px 18px rgba(22, 119, 255, 0.12);
}

.workbench-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #f5f5f5;
  border: 1px solid rgba(5, 5, 5, 0.06);
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
}

.workbench-item-button .workbench-icon {
  background: var(--ant-primary);
  border-color: var(--ant-primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(22, 119, 255, 0.22);
}

.workbench-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.workbench-fields label,
.workbench-label {
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
}

.workbench-select,
.workbench-value {
  width: 100%;
  min-width: 0;
  outline: none;
  font-family: inherit;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  text-overflow: ellipsis;
}

.workbench-select {
  appearance: none;
  -webkit-appearance: none;
  height: 28px;
  margin-top: 2px;
  padding: 3px 28px 3px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.74);
  background-image: var(--select-arrow);
  background-position: calc(100% - 13px) 12px, calc(100% - 9px) 12px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.workbench-select:hover {
  border-color: var(--ant-border);
  background-color: #fff;
}

.workbench-select:focus {
  border-color: var(--ant-primary);
  background-color: #fff;
  box-shadow: 0 0 0 3px var(--ant-primary-soft);
}

.workbench-select:disabled {
  cursor: not-allowed;
  border-color: rgba(5, 5, 5, 0.04);
  background-color: rgba(0, 0, 0, 0.035);
  color: rgba(0, 0, 0, 0.35);
}

.workbench-value {
  display: block;
  padding: 3px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-chevron {
  color: var(--text-dim);
  font-size: 1.1rem;
  line-height: 1;
}

.icon-btn-mini {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-glass-strong);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.icon-btn-mini:hover {
  background: rgba(184, 165, 116, 0.16);
  color: var(--text);
  border-color: rgba(168, 149, 110, 0.4);
}

.icon-btn-mini:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.input-hint {
  max-width: 820px;
  margin: 6px auto 0;
  color: var(--text-dim);
  font-size: 0.75rem;
  text-align: right;
  transition: max-width 0.34s var(--ease-ui), padding 0.34s var(--ease-ui), opacity 0.2s ease;
}

.input-hint-warning {
  color: rgba(173, 110, 0, 0.82);
  font-weight: 500;
}

/* 设置中心 */
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  pointer-events: none;
}

.settings-modal[aria-hidden="false"] {
  display: block;
  pointer-events: auto;
}

.app-modal {
  z-index: 1120;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(22, 119, 255, 0.14), transparent 32%),
    radial-gradient(circle at 82% 10%, rgba(120, 137, 255, 0.12), transparent 28%),
    rgba(13, 22, 38, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 0.2s ease-out;
}

.settings-shell {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(920px, calc(100vw - 48px));
  height: min(820px, calc(100vh - 48px));
  max-height: min(820px, calc(100vh - 48px));
  transform: translate(-50%, -50%);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(245, 249, 255, 0.86)),
    var(--bg-glass-strong);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  box-shadow: 0 32px 90px rgba(15, 23, 42, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: settingsPopIn 0.24s var(--ease-ui);
}

.settings-shell[data-view="providers"] {
  width: min(1040px, calc(100vw - 48px));
}

.app-modal-shell {
  height: auto;
  min-height: 0;
}

.create-agent-shell {
  width: min(620px, calc(100vw - 48px));
  max-height: min(780px, calc(100vh - 48px));
}

.trace-modal-content {
  width: min(920px, calc(100vw - 48px));
  height: min(820px, calc(100vh - 48px));
  max-height: min(820px, calc(100vh - 48px));
}

@keyframes settingsPopIn {
  from {
    transform: translate(-50%, calc(-50% + 14px)) scale(0.985);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  background: rgba(255, 255, 255, 0.52);
}

.settings-title-block {
  flex: 1;
  min-width: 0;
}

.settings-title-block h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.settings-title-block p {
  margin-top: 2px;
  color: rgba(0, 0, 0, 0.48);
  font-size: 0.75rem;
}

.settings-back-btn {
  visibility: hidden;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px 24px;
}

.app-modal-body {
  min-height: 0;
}

.settings-view {
  display: none;
  animation: settingsViewIn 0.22s ease-out;
}

.settings-view-active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@keyframes settingsViewIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.settings-hero,
.settings-card {
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.settings-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 124px;
  background:
    linear-gradient(135deg, rgba(22, 119, 255, 0.11), rgba(255, 255, 255, 0.78) 42%),
    radial-gradient(circle at 90% 20%, rgba(22, 119, 255, 0.18), transparent 34%);
}

.settings-eyebrow,
.settings-entry-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--ant-primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-hero h3,
.settings-section-lead h3 {
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.settings-hero p,
.settings-section-lead p {
  margin-top: 5px;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.84rem;
  line-height: 1.5;
}

.settings-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-entry-card {
  min-height: 142px;
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.045);
  transition: transform 0.2s var(--ease-ui), border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.settings-entry-card:hover {
  transform: translateY(-2px);
  border-color: rgba(22, 119, 255, 0.28);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 40px rgba(22, 119, 255, 0.12);
}

.settings-entry-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.settings-entry-card small {
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.8rem;
  line-height: 1.45;
}

.compact-context-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(246, 250, 255, 0.68) 52%, rgba(184, 165, 116, 0.08)),
    radial-gradient(circle at 96% 0%, rgba(22, 119, 255, 0.16), transparent 30%);
}

.compact-context-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, rgba(22, 119, 255, 0.72), rgba(184, 165, 116, 0.48));
  opacity: 0.72;
}

.compact-context-card[data-state='success'] {
  border-color: rgba(82, 196, 26, 0.22);
  box-shadow: 0 18px 42px rgba(82, 196, 26, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.compact-context-card[data-state='error'] {
  border-color: rgba(255, 77, 79, 0.24);
}

.compact-context-main {
  min-width: 0;
}

.compact-context-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.compact-context-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.98rem;
}

.compact-context-copy {
  max-width: 520px;
  margin: 0 0 12px;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.8rem;
  line-height: 1.45;
}

.compact-context-pill {
  flex-shrink: 0;
  margin-top: 1px;
  padding: 4px 9px;
  border: 1px solid rgba(22, 119, 255, 0.16);
  border-radius: 999px;
  background: rgba(22, 119, 255, 0.07);
  color: var(--ant-primary);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
}

.compact-context-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 25px;
}

.compact-context-meta span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: rgba(0, 0, 0, 0.52);
  font-size: 0.73rem;
  line-height: 1.25;
}

.compact-context-summary {
  max-height: 92px;
  margin-top: 12px;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid rgba(168, 149, 110, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.52);
  color: rgba(0, 0, 0, 0.58);
  font-size: 0.78rem;
  line-height: 1.55;
}

.compact-context-card[data-state='loading'] .compact-context-summary {
  max-height: 280px;
}

.compact-context-progress {
  display: grid;
  gap: 8px;
  list-style: none;
}

.compact-context-progress li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(0, 0, 0, 0.46);
}

.compact-context-progress span {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.07);
  color: rgba(0, 0, 0, 0.48);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.compact-context-progress li[data-state='active'] {
  color: rgba(22, 119, 255, 0.78);
}

.compact-context-progress li[data-state='active'] span {
  background: rgba(22, 119, 255, 0.14);
  color: var(--ant-primary);
  box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.08);
}

.compact-context-progress li[data-state='done'] {
  color: rgba(56, 158, 13, 0.68);
}

.compact-context-progress li[data-state='done'] span {
  background: rgba(82, 196, 26, 0.14);
  color: #389e0d;
}

.compact-context-stream {
  margin-top: 10px;
  color: rgba(0, 0, 0, 0.64);
}

.compact-context-stream-live {
  position: relative;
  max-height: 220px;
  overflow: auto;
}

.compact-context-stream-live::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 1em;
  margin-left: 3px;
  border-radius: 999px;
  background: rgba(22, 119, 255, 0.55);
  vertical-align: -0.15em;
  animation: typingCaretPulse 1s steps(2, start) infinite;
}

.compact-context-stream h1,
.compact-context-stream h2,
.compact-context-stream h3,
.compact-context-stream h4 {
  margin: 0.7em 0 0.35em;
  color: rgba(0, 0, 0, 0.72);
  font-size: 0.86rem;
}

.compact-context-stream p,
.compact-context-stream ul,
.compact-context-stream ol {
  margin: 0.45em 0;
}

.compact-context-stream ul,
.compact-context-stream ol {
  padding-left: 1.15rem;
}

.compact-context-action {
  margin-top: 4px;
  white-space: nowrap;
}

.compact-context-success {
  color: var(--success) !important;
}

.compact-context-error {
  color: var(--error) !important;
}

.settings-section-lead-row,
.settings-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-card-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(5, 5, 5, 0.06);
}

.settings-focus-card {
  max-width: 680px;
}

.settings-provider-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.5fr);
  gap: 16px;
  align-items: start;
}

.settings-provider-list-panel {
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.settings-mcp-picker {
  min-width: min(320px, 100%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: rgba(0, 0, 0, 0.65);
  font-size: 0.75rem;
  font-weight: 500;
}

.settings-mcp-picker select {
  min-height: 36px;
}

.drawer-tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.drawer-tools-grid h4 {
  color: rgba(0, 0, 0, 0.65);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.capability-grid > div {
  padding: 12px;
  border: 1px solid rgba(5, 5, 5, 0.06);
  border-radius: 12px;
  background: #fafafa;
}

.capability-grid h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.capability-grid h4::after {
  content: '可多选';
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.6875rem;
  font-weight: 500;
}

.agent-model-grid {
  padding: 12px;
  border: 1px solid rgba(22, 119, 255, 0.12);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(22, 119, 255, 0.06), rgba(255, 255, 255, 0.68));
}

.btn-mini {
  padding: 7px 12px;
  font-size: 0.8125rem;
  border-radius: 8px;
}

.provider-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.compact-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.compact-form-grid label,
.provider-secret-row,
.provider-models-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: rgba(0, 0, 0, 0.65);
  font-size: 0.75rem;
  font-weight: 500;
}
.compact-form-grid input,
.compact-form-grid select,
.provider-secret-row input,
.provider-models-row textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--ant-border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.compact-form-grid select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 36px;
  padding-right: 32px;
  background-color: #fff;
  background-image: var(--select-arrow);
  background-position: calc(100% - 15px) 16px, calc(100% - 11px) 16px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.compact-form-grid select:hover {
  border-color: #4096ff;
}
.compact-form-grid input:focus,
.compact-form-grid select:focus,
.provider-secret-row input:focus,
.provider-models-row textarea:focus {
  outline: none;
  border-color: var(--ant-primary);
  box-shadow: 0 0 0 3px var(--ant-primary-soft);
}
.compact-form-grid select:disabled {
  cursor: not-allowed;
  border-color: rgba(5, 5, 5, 0.04);
  background-color: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.35);
}
.provider-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 408px;
  overflow: auto;
}
.provider-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(5, 5, 5, 0.06);
  border-radius: 12px;
  background: #fafafa;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.provider-card:hover,
.provider-card-active {
  border-color: rgba(22, 119, 255, 0.32);
  background: rgba(22, 119, 255, 0.045);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.06);
}
.provider-card strong {
  color: var(--text);
  font-size: 0.8125rem;
}
.provider-card small {
  display: block;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.6875rem;
  line-height: 1.35;
  margin-top: 2px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.provider-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}
.provider-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(22, 119, 255, 0.08);
  color: var(--ant-primary);
  font-size: 0.6875rem;
  white-space: nowrap;
}
.provider-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.provider-identity-grid {
  grid-template-columns: minmax(112px, 0.72fr) minmax(0, 1fr);
}
.drawer-disclosure {
  border: 1px solid rgba(5, 5, 5, 0.06);
  border-radius: 12px;
  background: #fafafa;
  overflow: hidden;
}
.drawer-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: rgba(0, 0, 0, 0.75);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.drawer-disclosure summary::-webkit-details-marker {
  display: none;
}
.drawer-disclosure summary::after {
  content: '展开';
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(5, 5, 5, 0.06);
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.6875rem;
  font-weight: 500;
}
.drawer-disclosure[open] summary::after {
  content: '收起';
}
.drawer-disclosure summary small {
  flex: 1;
  min-width: 0;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.71875rem;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-disclosure-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px 12px;
}
.provider-models-row textarea {
  min-height: 76px;
  resize: vertical;
  font-family: var(--font-mono);
}
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(5, 5, 5, 0.06);
  border-radius: 999px;
  background: #fafafa;
  color: rgba(0, 0, 0, 0.65);
  font-size: 0.75rem;
}
.provider-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.provider-actions .btn-primary,
.provider-actions .btn-secondary {
  padding: 8px 12px;
  font-size: 0.8125rem;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 12px 12px;
}
.tools-grid h3 {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.check-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 220px;
  overflow: auto;
}
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 11px;
  background: #fafafa;
  border: 1px solid rgba(5, 5, 5, 0.06);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.8125rem;
  transition: background 0.2s, border-color 0.2s;
}
.check-item:hover {
  background: rgba(22, 119, 255, 0.04);
  border-color: rgba(22, 119, 255, 0.18);
}
.check-item-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.btn-inline {
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid rgba(22, 119, 255, 0.18);
  border-radius: 8px;
  background: rgba(22, 119, 255, 0.06);
  color: var(--ant-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  white-space: nowrap;
}
.btn-inline:hover {
  color: #0958d9;
  border-color: rgba(22, 119, 255, 0.34);
}
.mcp-tools-panel {
  margin: -1px 0 7px 30px;
  padding: 9px 11px;
  border: 1px dashed rgba(22, 119, 255, 0.24);
  border-radius: 12px;
  background: rgba(22, 119, 255, 0.035);
  color: rgba(0, 0, 0, 0.65);
  font-size: 0.75rem;
}
.settings-mcp-tools-list .mcp-tools-panel {
  margin: 0;
  border-style: solid;
  background: rgba(255, 255, 255, 0.5);
}
.mcp-tools-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.mcp-tool-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.mcp-tool-row strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.mcp-tool-row small {
  color: var(--text-dim);
  line-height: 1.35;
}
.check-item input {
  flex-shrink: 0;
  margin-top: 3px;
}
.check-item span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.check-item small {
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.75rem;
  line-height: 1.35;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.agent-selector label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.agent-selector select {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
}

.agent-selector select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.input-group {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

#messageInput {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: 12px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text);
  resize: none;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#messageInput::placeholder {
  color: var(--text-dim);
}

#messageInput:focus {
  box-shadow: none;
}

.context-usage-indicator {
  --context-usage: 0%;
  --context-color: rgba(148, 163, 184, 0.72);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 5px 8px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  color: rgba(0, 0, 0, 0.44);
  cursor: help;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.2s;
}

.context-usage-indicator:hover {
  border-color: rgba(22, 119, 255, 0.18);
  background: rgba(255, 255, 255, 0.82);
}

.context-usage-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(var(--context-color) var(--context-usage), rgba(15, 23, 42, 0.08) 0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.context-usage-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.context-usage-text {
  min-width: 28px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  text-align: right;
}

.context-usage-indicator[data-state='ok'] {
  --context-color: rgba(22, 119, 255, 0.72);
  color: rgba(22, 119, 255, 0.66);
}

.context-usage-indicator[data-state='summary'] {
  --context-color: rgba(82, 196, 26, 0.72);
  color: rgba(56, 158, 13, 0.72);
}

.context-usage-indicator[data-state='warning'] {
  --context-color: rgba(250, 173, 20, 0.82);
  color: rgba(173, 110, 0, 0.72);
}

.context-usage-indicator[data-state='danger'] {
  --context-color: rgba(255, 77, 79, 0.82);
  color: rgba(207, 19, 34, 0.74);
}

.global-tooltip {
  --tooltip-arrow-left: 50%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1600;
  max-width: min(300px, calc(100vw - 24px));
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s var(--ease-ui);
}

.global-tooltip[aria-hidden='false'] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.global-tooltip-body {
  position: relative;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 255, 0.82)),
    radial-gradient(circle at 100% 0%, rgba(22, 119, 255, 0.13), transparent 36%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  color: rgba(0, 0, 0, 0.68);
  font-size: 0.76rem;
  line-height: 1.55;
  white-space: pre-line;
  overflow: hidden;
}

.global-tooltip-body::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 14px 0 0 14px;
  background: linear-gradient(180deg, rgba(22, 119, 255, 0.58), rgba(184, 165, 116, 0.52));
}

.global-tooltip-arrow {
  position: absolute;
  left: var(--tooltip-arrow-left);
  width: 11px;
  height: 11px;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.9);
  transform: translateX(-50%) rotate(45deg);
  box-shadow: 4px 4px 12px rgba(15, 23, 42, 0.06);
}

.global-tooltip[data-placement='top'] .global-tooltip-arrow {
  bottom: -5px;
}

.global-tooltip[data-placement='bottom'] .global-tooltip-arrow {
  top: -5px;
  border: 0;
  border-left: 1px solid rgba(15, 23, 42, 0.08);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: -4px -4px 12px rgba(15, 23, 42, 0.04);
}

/* 主按钮：柔和金色，微光泽 */
.btn-primary,
.btn-secondary {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-hover) 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(168, 149, 110, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  box-shadow: 0 4px 16px rgba(168, 149, 110, 0.4);
}

.btn-primary:disabled {
  background: var(--text-dim);
  color: rgba(255, 255, 255, 0.8);
  box-shadow: none;
  cursor: not-allowed;
}

/* 次要按钮：磨砂半透明 */
.btn-secondary {
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-glass-strong);
  color: var(--text);
  border-color: rgba(0, 0, 0, 0.1);
}
.btn-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* 表单：统一磨砂风格 */
#createAgentForm {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-group {
  margin-bottom: 16px;
}

.form-group:last-of-type {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--ant-border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 40px;
  padding-right: 34px;
  background-image: var(--select-arrow);
  background-position: calc(100% - 16px) 18px, calc(100% - 12px) 18px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.form-group select:hover {
  border-color: #4096ff;
}

.form-group input[type="text"]::placeholder,
.form-group textarea::placeholder {
  color: var(--text-dim);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--ant-primary);
  box-shadow: 0 0 0 3px var(--ant-primary-soft);
}

.form-group select:disabled {
  cursor: not-allowed;
  border-color: rgba(5, 5, 5, 0.04);
  background-color: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.35);
}

.form-group textarea {
  resize: vertical;
  min-height: 72px;
}

/* 标签行：标签与提示同一行 */
.form-label-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.form-label-row label {
  margin-bottom: 0;
  flex-shrink: 0;
}

.form-hint,
.form-group small.form-hint,
#agentModelDefaultHint {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 400;
}

/* 模型选择：下拉紧跟标签行 */
#agentModelWrap select {
  display: block;
  margin-top: 0;
}
.trace-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 18px 24px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 149, 110, 0.42) rgba(255, 255, 255, 0.28);
}
.trace-modal-body::-webkit-scrollbar,
.trace-details pre::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.trace-modal-body::-webkit-scrollbar-track,
.trace-details pre::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 0 0 1px rgba(168, 149, 110, 0.08);
}
.trace-modal-body::-webkit-scrollbar-track {
  margin-block: 18px;
}
.trace-details pre::-webkit-scrollbar-track {
  margin-block: 8px;
}
.trace-modal-body::-webkit-scrollbar-thumb,
.trace-details pre::-webkit-scrollbar-thumb {
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(184, 165, 116, 0.66), rgba(22, 119, 255, 0.42));
  box-shadow: 0 4px 12px rgba(168, 149, 110, 0.16);
}
.trace-modal-body::-webkit-scrollbar-thumb:hover,
.trace-details pre::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(168, 149, 110, 0.82), rgba(22, 119, 255, 0.58));
}
.trace-modal-body::-webkit-scrollbar-corner,
.trace-details pre::-webkit-scrollbar-corner {
  background: transparent;
}
.trace-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-right: 28px;
}
.trace-heading span {
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.trace-heading small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.trace-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.trace-summary div {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
}
.trace-summary small,
.trace-item em {
  display: block;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.trace-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 0.875rem;
}
.trace-section {
  margin-top: 18px;
}
.trace-section h3 {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}
.trace-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trace-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
}
.trace-item-error {
  border-left-color: var(--error);
}
.trace-reasoning-card {
  border-left-color: var(--accent);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.58), rgba(184, 165, 116, 0.1));
}
.trace-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.trace-item-main strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trace-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}
.trace-item p {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}
.trace-details {
  margin-top: 8px;
}
.trace-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.75rem;
}
.trace-details pre {
  margin-top: 8px;
  max-height: 260px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 149, 110, 0.42) rgba(255, 255, 255, 0.24);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(45, 42, 38, 0.06);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

/* 表单提交按钮 */
#createAgentForm .btn-primary {
  width: 100%;
  padding: 12px 18px;
  font-size: 0.9375rem;
  border-radius: var(--radius);
}

.error {
  color: var(--error);
  background: rgba(184, 92, 92, 0.12);
  border: 1px solid rgba(184, 92, 92, 0.3);
  padding: 12px;
  border-radius: var(--radius);
  margin-top: 8px;
  font-size: 0.875rem;
}

.success {
  color: var(--success);
  background: rgba(90, 143, 90, 0.12);
  border: 1px solid rgba(90, 143, 90, 0.3);
  padding: 12px;
  border-radius: var(--radius);
  margin-top: 8px;
  font-size: 0.875rem;
}

.muted {
  color: var(--text-muted);
  font-size: 0.875em;
}

/* 流式消息 */
.message.streaming .message-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stream-status {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.stream-text {
  margin-top: 8px;
}

.stream-tools {
  position: relative;
  display: grid;
  gap: 5px;
  margin: 2px 0 4px;
  padding-left: 10px;
}
.stream-tools:empty {
  display: none;
}
.stream-tools::before {
  content: '';
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 3px;
  width: 1px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(22, 119, 255, 0.22), rgba(168, 149, 110, 0.18));
}
.stream-tool-line {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 5px 9px;
  border: 1px solid rgba(5, 5, 5, 0.045);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: 0 1px 7px rgba(168, 149, 110, 0.045);
  transform-origin: left center;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  animation: flowLineIn 0.22s ease-out;
}
.stream-tool-line::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  width: 7px;
  height: 7px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 149, 110, 0.12);
  transform: translateY(-50%);
}
.stream-tool-line:not(.stream-tool-done):not(.stream-tool-error) {
  border-color: rgba(22, 119, 255, 0.14);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.56), rgba(22, 119, 255, 0.075), rgba(255, 255, 255, 0.56));
  background-size: 220% 100%;
  animation: flowLineIn 0.22s ease-out, flowLineGlow 2.1s ease-in-out infinite;
}

.stream-tool-label {
  color: rgba(0, 0, 0, 0.52);
  font-weight: 600;
  flex-shrink: 0;
}

.stream-tool-name {
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stream-tool-detail {
  flex: 1;
  overflow: hidden;
  color: var(--text-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-tool-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ant-primary);
  box-shadow: 0 0 10px rgba(22, 119, 255, 0.34);
  animation: streamDot 1s ease-in-out infinite;
  flex-shrink: 0;
}

.stream-tool-line.stream-tool-done {
  border-color: rgba(5, 5, 5, 0.04);
  background: rgba(255, 255, 255, 0.34);
  box-shadow: none;
}
.stream-tool-line.stream-tool-done::before {
  background: rgba(90, 143, 90, 0.82);
  box-shadow: 0 0 0 3px rgba(90, 143, 90, 0.1);
}
.stream-tool-line.stream-tool-error {
  border-color: rgba(184, 92, 92, 0.24);
  background: rgba(184, 92, 92, 0.08);
}
.stream-tool-line.stream-tool-error::before {
  background: var(--error);
  box-shadow: 0 0 0 3px rgba(184, 92, 92, 0.1);
}
.stream-tool-line.stream-tool-error .stream-tool-label,
.stream-tool-line.stream-tool-error .stream-tool-done-mark {
  color: var(--error);
}

.stream-tool-done-mark {
  color: var(--success);
  font-weight: 700;
}

@keyframes streamDot {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.stream-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
  padding-top: 6px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.stream-footer em {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid rgba(15, 23, 42, 0.055);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
  color: rgba(0, 0, 0, 0.38);
  font-style: normal;
  line-height: 1.25;
}

.stream-footer-context {
  border-color: rgba(22, 119, 255, 0.1) !important;
  background: rgba(22, 119, 255, 0.045) !important;
  color: rgba(22, 119, 255, 0.58) !important;
}

.stream-footer-error {
  border-color: rgba(255, 77, 79, 0.16) !important;
  background: rgba(255, 77, 79, 0.06) !important;
  color: rgba(207, 19, 34, 0.72) !important;
}
@keyframes flowLineIn {
  from {
    opacity: 0;
    transform: translateX(-4px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}
@keyframes flowLineGlow {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}
.diagnostic-error {
  color: var(--error);
}
@media (max-width: 880px) {
  .container {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  :root {
    --mobile-composer-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  body {
    padding: 0;
    overflow: hidden;
    background:
      radial-gradient(circle at 12% 8%, rgba(22, 119, 255, 0.16), transparent 28%),
      radial-gradient(circle at 86% 12%, rgba(168, 149, 110, 0.22), transparent 28%),
      linear-gradient(160deg, var(--bg-page) 0%, var(--bg-page-2) 100%);
  }

  .login-gate {
    padding: 14px;
    overflow-y: auto;
  }

  .login-preview {
    width: 90vw;
    height: 58vh;
    right: -18vw;
    opacity: 0.28;
  }

  .login-card {
    width: calc(100vw - 28px);
    min-height: auto;
    grid-template-columns: 1fr;
    border-radius: 24px;
  }

  .login-rail {
    min-height: 76px;
    flex-direction: row;
    justify-content: flex-start;
    border-right: 0;
    border-bottom: 1px solid rgba(168, 149, 110, 0.16);
  }

  .login-rail-line {
    flex: 1;
    width: auto;
    height: 2px;
  }

  .login-rail-status {
    writing-mode: initial;
    transform: none;
  }

  .login-card-body {
    padding: 24px;
  }

  .login-header h1 {
    font-size: clamp(2rem, 13vw, 3.2rem);
  }

  .container {
    height: 100dvh;
    overflow: hidden;
  }

  .main-panel,
  .sidebar-collapsed .main-panel,
  html.sidebar-prefers-collapsed .main-panel {
    padding: 10px 10px 0;
  }

  .sidebar {
    position: fixed;
    inset: auto 10px calc(10px + env(safe-area-inset-bottom)) 10px;
    z-index: 96;
    width: auto;
    height: min(78dvh, 680px);
    flex-basis: auto;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 28px 28px 22px 22px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 255, 0.78)),
      radial-gradient(circle at 86% 0%, rgba(22, 119, 255, 0.12), transparent 34%);
    box-shadow: 0 -24px 80px rgba(15, 23, 42, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.92);
    opacity: 1;
    pointer-events: none;
    transform: translateY(calc(100% + 28px));
    overflow: hidden;
  }

  .sidebar-mobile-open .sidebar {
    width: auto;
    flex-basis: auto;
    padding: 14px;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 92;
    display: block;
    border: 0;
    background:
      radial-gradient(circle at 50% 100%, rgba(22, 119, 255, 0.12), transparent 34%),
      rgba(15, 23, 42, 0.22);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    transition: opacity 0.24s ease;
  }

  .sidebar-mobile-open .mobile-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .collapsed-sidebar-actions,
  .sidebar-collapsed .collapsed-sidebar-actions,
  html.sidebar-prefers-collapsed .collapsed-sidebar-actions,
  .collapsed-agent-list {
    display: none;
  }

  .mobile-action-dock {
    display: none;
  }

  .mobile-dock-btn {
    min-height: 54px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.52);
    color: rgba(0, 0, 0, 0.58);
    cursor: pointer;
    font-family: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .mobile-dock-btn span {
    font-size: 1rem;
    line-height: 1;
  }

  .mobile-dock-btn small {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  .mobile-dock-primary {
    border-color: rgba(22, 119, 255, 0.2);
    background: linear-gradient(135deg, var(--ant-primary), #69b1ff);
    color: #fff;
    box-shadow: 0 12px 24px rgba(22, 119, 255, 0.24);
  }

  .mobile-dock-btn-disabled,
  .mobile-dock-btn[aria-disabled='true'] {
    opacity: 0.42;
    pointer-events: none;
  }

  .icon-btn-mini.mobile-sidebar-btn {
    display: inline-flex;
  }

  .sidebar-collapsed .icon-btn-mini.mobile-sidebar-btn,
  html.sidebar-prefers-collapsed .icon-btn-mini.mobile-sidebar-btn {
    display: inline-flex;
  }

  .chat-header {
    position: relative;
    z-index: 30;
    min-height: 68px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: 24px;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(247, 251, 255, 0.62)),
      radial-gradient(circle at 100% 0%, rgba(22, 119, 255, 0.13), transparent 34%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  }

  .sidebar-collapsed .chat-header,
  html.sidebar-prefers-collapsed .chat-header {
    padding-left: 12px;
  }

  .chat-header p {
    display: none;
  }

  .chat-container {
    min-height: 0;
  }

  .messages {
    padding: 18px 4px calc(170px + env(safe-area-inset-bottom));
    scroll-padding-bottom: calc(170px + env(safe-area-inset-bottom));
  }

  .model-pill {
    max-width: 42vw;
    padding: 8px 10px;
  }

  .message-content {
    max-width: 94%;
    font-size: 0.92rem;
  }

  .message {
    margin-bottom: 16px;
  }

  .message.user .message-content {
    max-width: 88%;
    border-radius: 18px 18px 5px 18px;
  }

  .message.assistant .message-content {
    padding-right: 2px;
  }

  .reasoning-body {
    max-height: 190px;
  }

  .input-area {
    position: fixed;
    right: 10px;
    bottom: var(--mobile-composer-bottom);
    left: 10px;
    z-index: 84;
    padding: 0;
  }

  .input-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    max-width: none;
    padding: 10px;
    border-radius: 24px;
    background:
      linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(246, 250, 255, 0.8)),
      radial-gradient(circle at 100% 0%, rgba(168, 149, 110, 0.14), transparent 32%);
    box-shadow: 0 18px 54px rgba(15, 23, 42, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.94);
  }

  #messageInput {
    grid-column: 1 / -1;
    min-height: 74px;
    max-height: 142px;
    padding: 12px 12px 6px;
    font-size: 16px;
  }

  .context-usage-indicator {
    min-height: 38px;
    width: fit-content;
    align-self: center;
  }

  .input-group .btn-primary {
    width: auto;
    min-width: 92px;
    min-height: 40px;
    border-radius: 999px;
  }

  .input-hint {
    padding: 7px 8px 0;
    color: rgba(0, 0, 0, 0.5);
    font-size: 0.7rem;
  }

  .slash-command-menu {
    right: 0;
    left: 0;
    bottom: calc(100% + 8px);
    width: 100%;
    max-width: none;
    transform: none;
  }

  .slash-command-item {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .slash-command-heading {
    flex-direction: column;
    gap: 2px;
  }

  .input-hint {
    text-align: left;
  }

  .tools-grid,
  .compact-form-grid,
  .drawer-tools-grid {
    grid-template-columns: 1fr;
  }

  .settings-shell,
  .settings-shell[data-view="providers"],
  .create-agent-shell,
  .trace-modal-content {
    top: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    width: calc(100vw - 20px);
    height: min(88dvh, 820px);
    max-height: min(88dvh, 820px);
    border-radius: 28px 28px 22px 22px;
    transform: none;
    animation: mobileSheetIn 0.24s var(--ease-ui);
  }

  .settings-header {
    padding: 14px;
  }

  .settings-body {
    padding: 14px;
  }

  .settings-hero,
  .settings-section-lead-row,
  .settings-card-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-context-card {
    grid-template-columns: 1fr;
  }

  .compact-context-heading {
    flex-direction: column;
  }

  .compact-context-action {
    width: 100%;
  }

  .settings-entry-grid,
  .settings-provider-layout {
    grid-template-columns: 1fr;
  }

  .settings-entry-card {
    min-height: 112px;
  }

  .provider-actions {
    flex-direction: column;
  }

  .provider-actions .btn-primary,
  .provider-actions .btn-secondary {
    width: 100%;
  }

  .provider-cards {
    max-height: 220px;
  }
}

@keyframes mobileSheetIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 520px) {
  .login-orbit {
    display: none;
  }

  .login-preview {
    display: none;
  }

  .login-card-body {
    padding: 22px;
  }

  .login-options {
    align-items: flex-start;
    flex-direction: column;
  }

  .collapsed-sidebar-actions {
    left: 10px;
    flex-direction: column;
    gap: 6px;
    padding: 5px;
  }

  .collapsed-action-btn {
    width: 32px;
    height: 32px;
  }

  .collapsed-agent-list {
    top: 10px;
    left: 54px;
    width: min(300px, calc(100vw - 64px));
    max-height: calc(100vh - 20px);
  }

  .sidebar-collapsed .chat-header,
  html.sidebar-prefers-collapsed .chat-header {
    padding-left: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-orbit-ring,
  .login-signal-dot,
  .login-rail-line::after,
  .login-submit::after,
  .login-submit-spinner,
  .login-error .login-card-body {
    animation: none !important;
  }
}
