/* CPA AGENT 专属样式覆盖 */

/* ========== 色阶调整 ==========
   topbar 与 sidebar 同色（surface-container-low）；
   输入框 wrapper 加深到 surface-container-high，与 topbar/sidebar 拉开层次；
   chat 主区（body / chat-area）维持 surface 不动；assistant 气泡也不动。 */
.input-wrapper {
  background: var(--color-surface-container-high);
}
.input-wrapper:focus-within {
  background: var(--color-surface-container-high);
  box-shadow: 0 0 0 2px var(--color-primary-container), var(--shadow-ambient);
}


/* ========== Logo（BDO 立信 + CPA AGENT 蓝字，参考 HBJ） ========== */
.sidebar .logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 32px;
  padding: 0 4px;
}
.sidebar .logo .logo-img {
  height: 26px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  filter: none;
  mix-blend-mode: normal;
}
.sidebar .logo .logo-title {
  font-family: var(--font-headline);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.02em;
  padding-left: 12px;
  line-height: 1;
  border-left: 1px solid var(--color-outline-variant);
}

/* ========== 侧边栏导航选中态（LB 风格：半透明蓝 + 左竖线） ========== */
.sidebar nav li.active > a,
.sidebar nav li.active a {
  background: var(--color-primary-container) !important;
  background: color-mix(in srgb, var(--color-primary-container) 55%, transparent) !important;
  color: var(--color-primary) !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  border-left: 4px solid var(--color-primary);
  border-radius: 0 12px 12px 0;
  padding-left: calc(16px - 4px);
}
.sidebar nav li.active > a i,
.sidebar nav li.active a i {
  color: var(--color-primary);
}

/* ========== 左下角作者署名（参考 HBJ） ========== */
.sidebar .built-by {
  margin-top: auto;
  padding: 16px 4px 0;
  border-top: 1px solid color-mix(in srgb, var(--color-outline-variant) 50%, transparent);
}
.sidebar .built-by-label {
  font-family: var(--font-headline);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--color-on-surface-variant);
  opacity: 0.5;
}
.sidebar .built-by-name {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--color-on-surface-variant);
  opacity: 0.5;
  margin-top: 2px;
}

/* ========== 顶部 header ========== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--color-surface-container-low);
  flex-shrink: 0;
}
.topbar-spacer { flex: 1; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-username {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-on-surface);
  font-weight: 500;
}
.topbar-logout {
  background: transparent;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-on-surface-variant);
  transition: all 0.2s;
}
.topbar-logout:hover {
  color: var(--color-error);
  background: var(--color-surface-container-high);
}
.topbar-avatar {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}
.topbar-avatar:hover { transform: scale(1.05); }
.topbar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 主题切换按钮：移到 topbar 内，去掉 fixed 定位 */
.topbar .theme-toggle {
  position: static !important;
  top: auto !important;
  right: auto !important;
  width: 38px;
  height: 38px;
}

/* ========== 二层下拉项布局 ========== */
.webhook-dropdown .webhook-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.88rem;
  color: var(--color-on-surface);
  cursor: pointer;
  border-radius: 8px;
  margin: 1px 6px;
  transition: background-color 0.15s;
}
.webhook-dropdown .webhook-item:hover {
  background: var(--color-surface-container-high);
}
.webhook-dropdown .webhook-item.active {
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  font-weight: 600;
}
.webhook-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.webhook-item-badges {
  display: inline-flex;
  gap: 4px;
}
.webhook-item-badges .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  color: var(--color-on-surface-variant);
  background: var(--color-surface-container-high);
}
.webhook-item-badges .badge-vision {
  color: var(--color-primary);
  background: var(--color-primary-container);
}
.webhook-item-badges .badge-thinking {
  color: var(--color-on-secondary-container);
  background: var(--color-secondary-container);
}
/* ========== 模型设置面板 ========== */
.sidebar nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.sidebar .logo { margin-bottom: 28px; }
.sidebar .webhook-section {
  padding-left: 12px;
  padding-right: 12px;
  margin-top: 0;
}
.sidebar-section-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-on-surface-variant);
  padding: 0 4px 8px;
}

/* 三行统一布局：图标 + 文字 + 右侧控件 */
.webhook-section .current-webhook-display,
.thinking-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  margin-bottom: 3px;
  border-radius: 12px;
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--color-on-surface);
  transition: background 0.2s;
}
.webhook-section .current-webhook-display:hover,
.thinking-toggle:hover {
  background: var(--color-surface-container-high);
}

/* 统一无底色图标容器样式：默认使用浅灰色 */
.model-setting-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-on-surface-variant);
  transition: color 0.2s;
}

/* 静态高亮项：云朵与闪电图标默认呈高亮主题蓝 */
.provider-selector .model-setting-icon,
.model-selector .model-setting-icon {
  color: var(--color-primary);
}

/* 动态联动项：Thinking 开启时，大脑图标呈高亮主题蓝 */
.thinking-toggle.active .model-setting-icon {
  color: var(--color-primary);
}

/* 思考模式未开启时，大脑图标和 text 文字整体呈浅灰失效效果 */
.thinking-toggle:not(.active) .model-setting-icon,
.thinking-toggle:not(.active) .model-setting-text {
  opacity: 0.45;
  transition: opacity 0.2s, color 0.2s;
}

/* 思考模式开启时，恢复完整清晰度 */
.thinking-toggle.active .model-setting-icon,
.thinking-toggle.active .model-setting-text {
  opacity: 1;
}

/* 未开启状态下悬停（hover），提供微光反馈指示可点击 */
.thinking-toggle:not(.active):hover .model-setting-icon,
.thinking-toggle:not(.active):hover .model-setting-text {
  opacity: 0.8;
}

/* 选项 hover 交互：不管是选择框还是 Thinking，hover 时都亮起为主题蓝 */
.webhook-section .current-webhook-display:hover .model-setting-icon,
.thinking-toggle:hover .model-setting-icon {
  color: var(--color-primary);
}
.model-setting-text {
  flex: 1;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-setting-caret {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--color-on-surface-variant);
}

/* 思考模式：开关样式（文字保留 Thinking） */
.thinking-toggle { margin-top: 2px; }
.thinking-switch {
  flex-shrink: 0;
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--color-outline-variant);
  transition: background 0.2s;
}
.thinking-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s;
}
.thinking-toggle.active .thinking-switch {
  background: var(--color-primary);
}
.thinking-toggle.active .thinking-switch-thumb {
  transform: translateX(18px);
}

/* ========== 最近对话 (Recents) ========== */
.recents-section {
  margin-top: 18px;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.recents-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.recents-header .sidebar-section-label { padding-bottom: 0; }
.new-chat-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--color-on-surface-variant);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.new-chat-btn:hover {
  background: var(--color-primary-container);
  color: var(--color-on-primary-container);
}
.recents-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 8px 0 0;
  padding: 0;
  overflow-y: auto;
  min-height: 0;
}
.recents-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 4px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--color-on-surface-variant);
  transition: background 0.2s;
  min-width: 0;
  overflow: hidden;
}
.recents-item:hover {
  background: var(--color-surface-container-high);
  color: var(--color-on-surface);
}
.recents-item.active {
  background: var(--color-primary-container);
  color: var(--color-on-primary-container);
  font-weight: 600;
}
.recents-item > i {
  flex-shrink: 0;
  font-size: 0.9rem;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.recents-item-title {
  flex: 1;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
}
.recents-item-time {
  flex-shrink: 0;
  font-size: 0.72rem;
  opacity: 0.7;
}
.recents-item-delete {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}
.recents-item:hover .recents-item-delete { display: flex; }
.recents-item:hover .recents-item-time { display: none; }
.recents-item-delete:hover { background: rgba(0,0,0,0.12); }

#chat-input {
  min-height: 24px;
  max-height: 200px;
  resize: none;
}
#chat-input::placeholder {
  font-size: 0.85rem;
}

/* 上传按钮在模型不支持图片时置灰禁用 */
#upload-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* assistant 消息的模型标签（chip） */
.model-chip {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-on-surface-variant);
  background: var(--color-surface-container-high);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* typing 三点动画 */
.message.typing .message-bubble .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--color-on-surface-variant);
  opacity: 0.4;
  animation: cpa-typing 1.2s infinite ease-in-out;
}
.message.typing .message-bubble .dot:nth-child(2) { animation-delay: 0.15s; }
.message.typing .message-bubble .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes cpa-typing {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ========== 图片预览/缩略图/lightbox ========== */
.image-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 8px;
}
.image-previews:empty { padding: 0; }
.image-preview-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-surface-container-high);
}
.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-preview-remove:hover {
  background: rgba(0,0,0,0.75);
}

.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.message-image-thumb {
  max-width: 220px;
  max-height: 220px;
  border-radius: 12px;
  cursor: zoom-in;
  object-fit: cover;
  box-shadow: var(--shadow-ambient);
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-lightbox);
  cursor: zoom-out;
  padding: 32px;
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

/* ========== 登录页（HBJ 风格） ========== */
.login-page .auth-container {
  flex-direction: column;
  gap: 32px;
  padding: 32px 16px;
}
.login-page .auth-card {
  text-align: left;
  padding: 40px 44px;
  max-width: 440px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}
.auth-brand-logo {
  height: 36px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}
.auth-brand-text {
  border-left: 1px solid var(--color-outline-variant);
  padding-left: 14px;
}
.auth-brand-title {
  font-family: var(--font-headline);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.auth-brand-subtitle {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--color-on-surface-variant);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.auth-heading {
  font-family: var(--font-headline);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-on-surface);
  margin: 0 0 28px;
  letter-spacing: -0.01em;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-label {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-on-surface-variant);
  letter-spacing: 0.04em;
}
.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.auth-submit i { font-size: 0.9rem; }
.auth-built-by {
  text-align: center;
  font-family: var(--font-body);
}
.auth-built-by .built-by-label {
  font-family: var(--font-headline);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--color-on-surface-variant);
  opacity: 0.7;
}
.auth-built-by .built-by-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-on-surface-variant);
  margin-top: 2px;
}

/* 登录页右上角浮动主题按钮（chat 页面 topbar 里的 theme-toggle 不受此影响） */
.theme-toggle-fixed {
  position: absolute;
  top: 24px;
  right: 30px;
  width: 44px;
  height: 44px;
}

/* ========== 设置页 ========== */
.settings-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 40px 40px;
}
.settings-content > * {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
.settings-header {
  margin-bottom: 28px;
}
.settings-title {
  font-family: var(--font-headline);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-on-surface);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.settings-subtitle {
  font-size: 0.9rem;
  color: var(--color-on-surface-variant);
}
.settings-grid {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 24px;
}
.settings-card {
  background: var(--color-surface-container-lowest);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow-ambient);
}
.profile-card { text-align: center; }
.profile-avatar-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
}
.profile-avatar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--color-primary-container);
  padding: 4px;
}
.profile-avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.profile-online-dot {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2dba78;
  border: 3px solid var(--color-surface-container-lowest);
}
.profile-name {
  font-family: var(--font-headline);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-on-surface);
  margin-bottom: 4px;
}
.profile-role {
  color: var(--color-primary);
  font-size: 0.9rem;
  font-style: italic;
  margin-bottom: 6px;
}
.profile-email {
  font-size: 0.85rem;
  color: var(--color-on-surface-variant);
  margin-bottom: 12px;
}
.profile-fy-chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--color-surface-container-high);
  font-size: 0.75rem;
  color: var(--color-on-surface-variant);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
}
.profile-stats {
  display: flex;
  justify-content: space-around;
  margin: 24px 0;
}
.profile-stat-num {
  font-family: var(--font-headline);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-on-surface);
}
.profile-stat-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--color-on-surface-variant);
  margin-top: 2px;
}
.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.profile-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.profile-btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dim));
  color: var(--color-on-primary);
}
.profile-btn-secondary {
  background: var(--color-primary-container);
  color: var(--color-on-primary-container);
}
.profile-btn-ghost {
  background: transparent;
  color: var(--color-on-surface);
  border: 1px solid var(--color-outline-variant);
}
.profile-btn-ghost:hover {
  background: var(--color-surface-container-high);
}

/* ========== Usage Statistics Card ========== */
.usage-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.usage-title {
  font-family: var(--font-headline);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-on-surface);
}
.usage-subtitle {
  font-size: 0.82rem;
  color: var(--color-on-surface-variant);
  margin-top: 2px;
}
.usage-select {
  padding: 6px 32px 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-outline-variant);
  background: var(--color-surface-container-low);
  color: var(--color-on-surface);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23797b78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}
.usage-select:hover {
  background-color: var(--color-surface-container-high);
  border-color: var(--color-primary);
}
.usage-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-container);
}
.usage-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.usage-stat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--color-surface-container-low);
  border-radius: 16px;
  box-shadow: var(--shadow-ambient);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.usage-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 102, 140, 0.08);
}
[data-theme="dark"] .usage-stat-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.usage-stat-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.usage-stat-label {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--color-on-surface-variant);
  font-weight: 600;
}
.usage-stat-value {
  font-family: var(--font-headline);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-on-surface);
  line-height: 1.2;
}
.usage-stat-sub {
  font-size: 0.72rem;
  color: var(--color-on-surface-variant);
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.usage-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--color-primary-container);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.usage-stat-card:hover .usage-stat-icon {
  transform: scale(1.05);
}
.usage-chart-container {
  background: var(--color-surface-container-low);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-ambient);
}
.usage-chart-title {
  font-family: var(--font-headline);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-on-surface);
}
.usage-chart-subtitle {
  font-size: 0.75rem;
  color: var(--color-on-surface-variant);
  margin-bottom: 16px;
}
/* ApexCharts tooltip design matching Serene Architect */
.apexcharts-tooltip {
  font-family: var(--font-body) !important;
  background: var(--color-surface-container-lowest) !important;
  border: 1px solid var(--color-outline-variant) !important;
  box-shadow: var(--shadow-ambient) !important;
  border-radius: 8px !important;
}
.apexcharts-tooltip-title {
  background: var(--color-surface-container-low) !important;
  border-bottom: 1px solid var(--color-outline-variant) !important;
  font-weight: 600 !important;
}
/* Mobile responsive adjustments */
@media (max-width: 520px) {
  .usage-stats {
    grid-template-columns: 1fr;
  }
}

.bottom-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--color-surface-container-lowest);
  border-radius: 16px;
  box-shadow: var(--shadow-ambient);
}
.status-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary-container);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.status-card-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--color-on-surface-variant);
  margin-bottom: 2px;
}
.status-card-value {
  font-family: var(--font-headline);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-on-surface);
}
.status-card-note {
  font-size: 0.72rem;
  color: var(--color-on-surface-variant);
  margin-top: 2px;
}

/* 响应式：小屏单列 */
@media (max-width: 920px) {
  .settings-grid { grid-template-columns: 1fr; }
  .bottom-cards { grid-template-columns: 1fr; }
}

/* ========== Mobile（≤ 768px）：汉堡抽屉式 sidebar ==========
   覆盖 style.css 中 768px 的"底部 tab bar"设计，CPA 只有 1 个 nav 项不适合。
   桌面端 (>768px) 不受影响：汉堡按钮 hidden，sidebar 正常左侧 280px。 */

/* 桌面端隐藏汉堡和遮罩 */
.mobile-menu-btn { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 768px) {
  /* iOS Safari 100vh 包含地址栏高度，chat-input-area 会被底部 tab bar 遮挡
     用 100dvh（动态视口高度，iOS 15.4+ 支持）+ -webkit-fill-available 兜底 */
  html, body {
    height: 100dvh !important;
    height: -webkit-fill-available !important;
  }
  body {
    height: 100dvh !important;
    overflow: hidden;
  }

  /* 撤回 style.css 的 col-reverse 等设计 */
  .container {
    flex-direction: row !important;
    height: 100% !important;
  }

  /* sidebar 变抽屉：fixed + 默认隐藏，加 .open 滑入 */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 280px !important;
    height: 100dvh !important;
    /* 抽屉用纯块流（非 flex）：flex 列 + overflow 下子项高度计算不可靠（nav 被压矮、
       recents overflow 溢出框外盖住 built-by）。block 流则按内容高自然堆叠，整列一起滚 */
    display: block !important;
    padding: 32px 20px !important;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 200;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.open {
    transform: translateX(0);
  }

  /* 撤回 style.css 把 logo / webhook-section / profile 隐藏的规则 */
  .sidebar .logo,
  .sidebar .built-by {
    display: flex !important;
  }
  .sidebar .webhook-section {
    display: block !important; /* 内部两个 webhook-selector 默认竖排 */
  }

  /* sidebar nav 在 mobile 抽屉里也用竖排（撤回 style.css 的横向 tab bar） */
  /* mobile：抽屉整体滚动，nav/recents 一律块流（不用嵌套 flex 高度，避免 iOS 把 nav 算矮、
     recents overflow:visible 溢出框外、built-by 插进列表中间重叠的渲染 bug） */
  .sidebar nav {
    width: 100%;
    flex: none;
    display: block;
    height: auto; /* 覆盖 style.css 旧"底部 tab bar"的 nav{height:100%}，否则 nav 被钉死、recents 溢出盖住 built-by */
  }
  .recents-section { flex: none; display: block; min-height: 0; }
  .recents-list { overflow: visible; min-height: 0; max-height: none; }
  .sidebar .built-by { margin-top: 24px; flex-direction: column; align-items: flex-start; }
  .sidebar nav ul {
    flex-direction: column !important;
    align-items: stretch;
    height: auto;
    justify-content: flex-start;
    gap: 8px;
  }
  .sidebar nav a {
    flex-direction: row !important;
    padding: 10px 14px !important;
    gap: 10px !important;
    font-size: 0.9rem !important;
    border-radius: 10px;
  }
  .sidebar nav a i { font-size: 1rem !important; }

  /* 遮罩：覆盖在 chat-area 上方，sidebar 在更上层 */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 150;
  }
  .sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* 主区占满 */
  .chat-area, .settings-area {
    width: 100%;
    padding-bottom: 16px;
  }

  /* topbar 左侧给汉堡按钮腾位 */
  .topbar {
    padding: 12px 16px;
    justify-content: space-between;
  }
  .topbar-spacer { display: none; }
  .topbar-actions { gap: 10px; }
  .topbar-username { display: none; } /* 移动端节省空间，省略用户名 */

  /* 汉堡按钮显示 */
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: transparent;
    border: none;
    color: var(--color-on-surface);
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
  }
  .mobile-menu-btn:hover {
    background: var(--color-surface-container-high);
  }

  /* chat-history / settings-content 内边距精简 */
  .chat-history {
    padding: 16px;
  }
  .chat-input-area {
    padding: 0 12px;
  }
  .settings-content {
    padding: 8px 16px 32px;
  }

  /* 模型 chip 长名 mobile 换行 */
  .model-chip { white-space: normal; }

  /* 气泡 padding 缩小，给内容多挤出横向空间（mobile 视口窄） */
  .message-bubble {
    padding: 12px 16px;
  }
}

/* ========== Lucide 线性图标样式定义 ========== */
.lucide, [data-lucide] {
  width: 1.1rem;
  height: 1.1rem;
  stroke: currentColor;
  stroke-width: 1.8px;
  fill: none;
  display: inline-block;
  vertical-align: middle;
}

/* 供应商/模型设置区稍加粗，且放大到 20px 以配合无背景风格 */
.model-setting-icon .lucide,
.model-setting-icon [data-lucide] {
  width: 20px;
  height: 20px;
  stroke-width: 2px; 
}

/* 导航与设置栏图标微调 */
.sidebar nav li a .lucide,
.sidebar nav li a [data-lucide] {
  margin-right: 12px;
  width: 20px;
  height: 20px;
  stroke-width: 1.8px;
  text-align: center;
}

/* 模型列表的 badge 里面的 svg 图标 */
.webhook-item-badges .badge .lucide,
.webhook-item-badges .badge [data-lucide] {
  width: 11px;
  height: 11px;
  stroke-width: 2px;
}

/* ========== 聊天区空状态图标颜色覆盖，与 bot avatar 保持一致 ========== */
.chat-empty-icon {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dim)) !important;
  color: var(--color-on-primary) !important;
}

/* ========== 最近对话项的编辑按钮样式覆盖 ========== */
.recents-item-edit {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  margin-right: -6px;
}
.recents-item:hover .recents-item-edit {
  display: flex;
}
.recents-item-edit:hover {
  background: rgba(0, 0, 0, 0.12);
}
[data-theme="dark"] .recents-item-edit:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ========== 中止回答状态下的发送按钮：类似 Claude 风格的白底橘红方块 ========== */
#send-btn.stop-state {
  background: #ffffff !important;
  color: #da5b38 !important; /* 类似 Claude 的橘红色 */
  border: 1px solid rgba(218, 91, 56, 0.35) !important;
  box-shadow: 0 2px 8px rgba(218, 91, 56, 0.18) !important;
}
#send-btn.stop-state:hover {
  background: #fdf6f4 !important;
  transform: scale(1.05);
}


.user-name-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dim));
  color: var(--color-on-primary, #fff);
  font-weight: 600;
  font-family: var(--font-headline), system-ui, sans-serif;
  user-select: none;
  border-radius: 50%;
}
.topbar-name-avatar {
  width: 100%;
  height: 100%;
  font-size: 1rem;
}
.chat-name-avatar {
  width: 34px;
  height: 34px;
  font-size: 0.9rem;
}
.profile-name-avatar {
  width: 100%;
  height: 100%;
  font-size: 2.2rem;
}
.sidebar-name-avatar {
  width: 100%;
  height: 100%;
  font-size: 1.5rem;
}

/* ========== 头像编辑铅笔按钮与上传 Loading 遮罩 ========== */
.avatar-edit-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-on-primary, #fff) !important;
  border: 2.5px solid var(--color-surface-container-lowest);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
  font-size: 0.75rem;
}
.avatar-edit-btn:hover {
  transform: scale(1.1);
  background: var(--color-primary-dim);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.avatar-loading-overlay {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.2rem;
  z-index: 10;
  animation: fadeIn 0.25s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

