/* 用户侧（auth + user）白天/夜间主题；公共营销页不引用本文件 */

html {
  color-scheme: dark;
}

html[data-user-theme="light"] {
  color-scheme: light;
}

/* 外观切换：默认固定（登录页等无顶栏）；有 .header .user-info 时由 JS 插入文档流，避免遮挡 */
.user-theme-toggle {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top, 0px));
  right: max(1rem, 5%);
  z-index: 10000;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

.user-theme-toggle.user-theme-toggle--in-header {
  position: static;
  top: auto;
  right: auto;
  z-index: auto;
  flex-shrink: 0;
  align-self: center;
}

/* 各页内联 `.user-info button { 退出红底 }` 会套到同容器内的主题切换上 */
body.user-portal .header .user-info button.user-theme-toggle {
  background: transparent;
  color: inherit;
  padding: 0;
  border: none;
  border-radius: 0;
}

.user-theme-toggle:focus {
  outline: none;
}

.user-theme-toggle:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 3px;
  border-radius: 14px;
}

.user-theme-toggle__rail {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  min-width: 116px;
  height: 30px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.22),
    0 2px 10px rgba(0, 0, 0, 0.18);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.user-theme-toggle:hover .user-theme-toggle__rail {
  border-color: rgba(147, 197, 253, 0.45);
}

html[data-user-theme="light"] .user-theme-toggle:hover .user-theme-toggle__rail {
  border-color: #94a3b8;
}

.user-theme-toggle__highlight {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 3px);
  height: calc(100% - 4px);
  border-radius: 999px;
  background: linear-gradient(165deg, rgba(59, 130, 246, 0.55) 0%, rgba(37, 99, 235, 0.42) 100%);
  border: 1px solid rgba(147, 197, 253, 0.55);
  box-shadow:
    0 2px 8px rgba(37, 99, 235, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: left 0.22s ease;
  z-index: 0;
  pointer-events: none;
}

.user-theme-toggle[data-theme="dark"] .user-theme-toggle__highlight {
  left: calc(50% + 1px);
}

.user-theme-toggle__opt {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(226, 232, 240, 0.5);
  transition: color 0.18s ease, font-weight 0.18s ease;
  user-select: none;
}

.user-theme-toggle[data-theme="light"] .user-theme-toggle__opt[data-mode="light"] {
  color: #f8fafc;
  font-weight: 600;
}

.user-theme-toggle[data-theme="dark"] .user-theme-toggle__opt[data-mode="dark"] {
  color: #f8fafc;
  font-weight: 600;
}

/* 浅色整页下：滑轨与滑块对比度 */
html[data-user-theme="light"] .user-theme-toggle__rail {
  background: #e2e8f0;
  border-color: #cbd5e1;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.85),
    0 1px 3px rgba(15, 23, 42, 0.08);
}

html[data-user-theme="light"] .user-theme-toggle__highlight {
  background: linear-gradient(165deg, #ffffff 0%, #f1f5f9 100%);
  border-color: #93c5fd;
  box-shadow:
    0 2px 8px rgba(37, 99, 235, 0.12),
    inset 0 1px 0 #ffffff;
}

html[data-user-theme="light"] .user-theme-toggle__opt {
  color: rgba(71, 85, 105, 0.65);
}

html[data-user-theme="light"] .user-theme-toggle[data-theme="light"] .user-theme-toggle__opt[data-mode="light"] {
  color: #1d4ed8;
  font-weight: 600;
}

html[data-user-theme="light"] .user-theme-toggle[data-theme="dark"] .user-theme-toggle__opt[data-mode="dark"] {
  color: #1e293b;
  font-weight: 600;
}

/* ========== 夜间（默认，与现有页面一致） ========== */
body.user-portal {
  --ut-page-bg: #0b1120;
  --ut-page-bg2: #1e293b;
  --ut-text: #f8fafc;
  --ut-muted: #94a3b8;
  --ut-header-bg: rgba(15, 23, 42, 0.78);
  --ut-sidebar-bg: rgba(15, 23, 42, 0.92);
  --ut-card: rgba(30, 41, 59, 0.82);
  --ut-input-bg: rgba(15, 23, 42, 0.8);
  --ut-input-border: #475569;
  --ut-link: #60a5fa;
  --ut-footer: #64748b;
  --ut-accent-a: #38bdf8;
  --ut-accent-b: #818cf8;
  --ut-accent-c: #c084fc;
  --ut-card-glow: 0 0 0 1px rgba(99, 102, 241, 0.12), 0 12px 40px rgba(0, 0, 0, 0.35);
}

/* 已登录控制台：深色下叠一层柔光网格，避免「纯灰板」感 */
body.user-portal:has(.sidebar) {
  background:
    radial-gradient(ellipse 100% 70% at 15% -10%, rgba(56, 189, 248, 0.14), transparent 52%),
    radial-gradient(ellipse 90% 55% at 95% 5%, rgba(129, 140, 248, 0.12), transparent 48%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(192, 132, 252, 0.06), transparent 55%),
    var(--ut-page-bg) !important;
}

body.user-portal.auth-page {
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(56, 189, 248, 0.2), transparent 55%),
    radial-gradient(ellipse 70% 45% at 85% 15%, rgba(129, 140, 248, 0.16), transparent 50%),
    linear-gradient(160deg, #0b1120 0%, #0f172a 45%, #1e293b 100%) !important;
}

/* ========== 白天 ========== */
html[data-user-theme="light"] body.user-portal {
  --ut-page-bg: #f1f5f9;
  --ut-page-bg2: #e2e8f0;
  --ut-text: #0f172a;
  --ut-muted: #64748b;
  --ut-header-bg: rgba(255, 255, 255, 0.88);
  --ut-sidebar-bg: rgba(255, 255, 255, 0.96);
  --ut-card: #ffffff;
  --ut-input-bg: #ffffff;
  --ut-input-border: #cbd5e1;
  --ut-link: #2563eb;
  --ut-footer: #64748b;
  --ut-accent-a: #0ea5e9;
  --ut-accent-b: #4f46e5;
  --ut-accent-c: #9333ea;
  --ut-card-glow: 0 0 0 1px rgba(148, 163, 184, 0.2), 0 10px 28px rgba(15, 23, 42, 0.06);
}

html[data-user-theme="light"] body.user-portal.auth-page {
  background:
    radial-gradient(ellipse 90% 50% at 10% 0%, rgba(14, 165, 233, 0.12), transparent 50%),
    radial-gradient(ellipse 80% 45% at 90% 10%, rgba(79, 70, 229, 0.1), transparent 48%),
    linear-gradient(160deg, #e8eef5 0%, #f8fafc 55%, #ffffff 100%) !important;
}

/* 用户控制台布局：浅色非认证页统一铺底（含侧栏与全屏对话等） */
html[data-user-theme="light"] body.user-portal:not(.auth-page) {
  background:
    radial-gradient(ellipse 100% 55% at 0% 0%, rgba(37, 99, 235, 0.08), transparent 50%),
    radial-gradient(ellipse 80% 45% at 100% 0%, rgba(124, 58, 237, 0.06), transparent 48%),
    var(--ut-page-bg) !important;
  color: var(--ut-text) !important;
}

html[data-user-theme="light"] body.user-portal .header {
  background: var(--ut-header-bg) !important;
  border-bottom: 1px solid #e2e8f0;
}

html[data-user-theme="light"] body.user-portal .user-info span {
  color: var(--ut-muted) !important;
}

html[data-user-theme="light"] body.user-portal .sidebar {
  background: var(--ut-sidebar-bg) !important;
  border-right: 1px solid #e2e8f0;
}

html[data-user-theme="light"] body.user-portal .sidebar a {
  color: #334155 !important;
}

html[data-user-theme="light"] body.user-portal .sidebar a:hover {
  background: #f1f5f9 !important;
  color: var(--ut-link) !important;
}

html[data-user-theme="light"] body.user-portal .sidebar a.active {
  background: linear-gradient(90deg, rgba(219, 234, 254, 0.95), rgba(241, 245, 249, 0.85)) !important;
  color: #1d4ed8 !important;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.28), 0 6px 18px rgba(37, 99, 235, 0.1) !important;
}

/* 主区默认正文色；不再使用 .main * { color: inherit }，否则会压掉徽章/链接/表格等组件自己的 color */
html[data-user-theme="light"] body.user-portal:not(.auth-page) .main {
  color: var(--ut-text);
}

/* ---------- 仪表盘 SPA + 独立用户页：浅色下仍为「深底」的块，统一改为浅底深字 ---------- */
html[data-user-theme="light"] body.user-portal .main .filter-bar {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0;
}
html[data-user-theme="light"] body.user-portal .main .filter-bar input[type="date"],
html[data-user-theme="light"] body.user-portal .main .filter-bar select {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
html[data-user-theme="light"] body.user-portal .main .filter-bar input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
  opacity: 0.7;
}
html[data-user-theme="light"] body.user-portal .main .table-container {
  background: var(--ut-card) !important;
  border: 1px solid #e2e8f0;
}
html[data-user-theme="light"] body.user-portal .main .table-container th {
  color: var(--ut-muted) !important;
  border-bottom-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .main .table-container td {
  color: var(--ut-text) !important;
  border-bottom-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .main .table-container tr:hover {
  background: #f8fafc !important;
}
html[data-user-theme="light"] body.user-portal .order-card {
  background: var(--ut-card) !important;
  border: 1px solid #e2e8f0;
}
html[data-user-theme="light"] body.user-portal .order-header .order-no {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .order-item .value {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .order-footer .time {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .order-footer button {
  color: var(--ut-text) !important;
  border-color: #cbd5e1 !important;
}
html[data-user-theme="light"] body.user-portal .greeting h1 {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .stat-card .value {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .usage-trend-card {
  background: var(--ut-card) !important;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
html[data-user-theme="light"] body.user-portal .trend-bar {
  background: linear-gradient(180deg, #bfdbfe, #60a5fa) !important;
}
html[data-user-theme="light"] body.user-portal .trend-empty {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .usage-trend-head h2 {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .usage-trend-head select {
  background: #ffffff !important;
  color: var(--ut-text) !important;
  border-color: #cbd5e1 !important;
}
html[data-user-theme="light"] body.user-portal .action-card:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08) !important;
}
html[data-user-theme="light"] body.user-portal .action-card .title {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .recent-activity {
  background: var(--ut-card) !important;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
html[data-user-theme="light"] body.user-portal .recent-activity h2 {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .activity-item .detail .time {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .activity-item--placeholder .title,
html[data-user-theme="light"] body.user-portal .activity-item--placeholder .detail .title {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .activity-item .detail .title {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .key-header .name {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .key-value {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .key-value code {
  background: #ffffff !important;
  color: #334155 !important;
  border: 1px solid #e2e8f0;
}
html[data-user-theme="light"] body.user-portal .key-footer .actions button {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .key-footer .actions button:hover {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .payment {
  background: var(--ut-card) !important;
  border-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .payment .name {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .pricing-recharge .plan h3 {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .pricing-recharge .plan li {
  color: var(--ut-muted) !important;
  border-bottom-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .order-summary {
  background: var(--ut-card) !important;
  border: 1px solid #e2e8f0;
}
html[data-user-theme="light"] body.user-portal .payment-modal-content {
  background: #ffffff !important;
  border: 1px solid #e2e8f0;
}
html[data-user-theme="light"] body.user-portal .payment-body,
html[data-user-theme="light"] body.user-portal .order-info {
  background: #f8fafc !important;
}
html[data-user-theme="light"] body.user-portal .info-row .value {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .support-thread {
  background: var(--ut-card) !important;
  border-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .support-msg.user .bubble {
  color: #1e3a5f !important;
  background: rgba(59, 130, 246, 0.15) !important;
  border-color: rgba(59, 130, 246, 0.35) !important;
}
html[data-user-theme="light"] body.user-portal .support-msg.admin .bubble {
  color: #14532d !important;
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}
html[data-user-theme="light"] body.user-portal .support-compose textarea {
  background: #ffffff !important;
  color: var(--ut-text) !important;
  border-color: #cbd5e1 !important;
}
html[data-user-theme="light"] body.user-portal .title h1 {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .level-info .key-limit span {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .level-info {
  background: #eff6ff !important;
  border: 1px solid #bfdbfe;
}
html[data-user-theme="light"] body.user-portal .main .pagination button:not(.active):not(:disabled) {
  background: #ffffff !important;
  color: var(--ut-text) !important;
  border-color: #cbd5e1 !important;
}
html[data-user-theme="light"] body.user-portal .main .pagination button:not(.active):not(:disabled):hover {
  background: #f1f5f9 !important;
}

html[data-user-theme="light"] body.user-portal .activity-item {
  border-bottom-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .greeting p {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .stat-card .label {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .live-stats {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .action-card .desc {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .order-summary .row .label {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .order-summary .row .value {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .order-summary .row.total .value {
  color: #2563eb !important;
}
html[data-user-theme="light"] body.user-portal .order-summary .row.total .label {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .order-summary h3 {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .low-balance-banner {
  background: rgba(245, 158, 11, 0.14) !important;
  border-color: rgba(217, 119, 6, 0.4) !important;
  color: #b45309 !important;
}
html[data-user-theme="light"] body.user-portal .info-row .label {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .trend-label {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .payment-methods h2,
html[data-user-theme="light"] body.user-portal .section-title h2 {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .pricing-recharge .plan .original-price {
  color: #94a3b8 !important;
}
html[data-user-theme="light"] body.user-portal .pricing-recharge .plan .token {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .pricing-recharge .plan-tag {
  color: #1e3a8a !important;
  background: rgba(59, 130, 246, 0.15) !important;
  border-color: rgba(59, 130, 246, 0.35) !important;
}

/* 订单详情弹窗（dashboard.js 动态插入） */
html[data-user-theme="light"] body.user-portal .order-detail-modal-content {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .order-detail-modal-content h3 {
  color: var(--ut-text) !important;
  border-bottom-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .order-detail-modal-content .detail-row {
  border-bottom-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .order-detail-modal-content .detail-label {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal .order-detail-modal-content .detail-value {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .order-detail-modal-content .btn-close {
  background: #e2e8f0 !important;
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal .order-detail-modal-content .btn-close:hover {
  background: #cbd5e1 !important;
}

html[data-user-theme="light"] body.user-portal .key-card,
html[data-user-theme="light"] body.user-portal .chat-container,
html[data-user-theme="light"] body.user-portal .stat-card,
html[data-user-theme="light"] body.user-portal .action-card,
html[data-user-theme="light"] body.user-portal .order-card,
html[data-user-theme="light"] body.user-portal table {
  background: var(--ut-card) !important;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

html[data-user-theme="light"] body.user-portal code {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

html[data-user-theme="light"] body.user-portal .modal,
html[data-user-theme="light"] body.user-portal .modal-overlay .modal {
  background: #ffffff !important;
  color: var(--ut-text) !important;
}

html[data-user-theme="light"] body.user-portal .modal .message {
  color: var(--ut-muted) !important;
}

/* 认证页容器 */
html[data-user-theme="light"] body.user-portal .container {
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 25px 50px rgba(15, 23, 42, 0.12) !important;
}

html[data-user-theme="light"] body.user-portal .container .logo h1 {
  color: var(--ut-link) !important;
}

html[data-user-theme="light"] body.user-portal .back-home {
  color: var(--ut-muted) !important;
}

html[data-user-theme="light"] body.user-portal .form-group label,
html[data-user-theme="light"] body.user-portal .checkbox {
  color: var(--ut-muted) !important;
}

html[data-user-theme="light"] body.user-portal .form-group input {
  background: var(--ut-input-bg) !important;
  border-color: var(--ut-input-border) !important;
  color: var(--ut-text) !important;
}

html[data-user-theme="light"] body.user-portal .footer,
html[data-user-theme="light"] body.user-portal .footer-links a {
  color: var(--ut-footer) !important;
}

html[data-user-theme="light"] body.user-portal .login-link,
html[data-user-theme="light"] body.user-portal .register-link {
  color: var(--ut-muted) !important;
}

html[data-user-theme="light"] body.user-portal .divider {
  color: var(--ut-muted) !important;
}

html[data-user-theme="light"] body.user-portal .divider::before,
html[data-user-theme="light"] body.user-portal .divider::after {
  background: #cbd5e1 !important;
}

html[data-user-theme="light"] body.user-portal .social-btn {
  border-color: var(--ut-input-border) !important;
  color: var(--ut-text) !important;
}

/* 对话页（含独立 /chat 与仪表盘 iframe 嵌入） */
html[data-user-theme="light"] body.user-portal .message.assistant .content {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}
html[data-user-theme="light"] body.user-portal .input-area {
  background: #ffffff !important;
  border-top-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .input-container textarea {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
html[data-user-theme="light"] body.user-portal .usage-bar {
  background: #f1f5f9 !important;
}
html[data-user-theme="light"] body.user-portal .usage-bar .label {
  color: var(--ut-muted) !important;
}

/* 完整对话 / 嵌入：浅色下工具栏、下拉与按钮与主区一致 */
html[data-user-theme="light"] body.user-portal.tg-full-chat,
html[data-user-theme="light"] body.user-portal.tg-chat-embed {
  background: var(--ut-page-bg) !important;
  color: var(--ut-text);
}
html[data-user-theme="light"] body.user-portal.tg-chat-embed .embed-top {
  background: var(--ut-card) !important;
  border-bottom-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal.tg-chat-embed .embed-top a {
  color: var(--ut-link) !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-toolbar,
html[data-user-theme="light"] body.user-portal.tg-full-chat .session-toolbar,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-toolbar,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .session-toolbar {
  background: #f8fafc !important;
  border-bottom-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-toolbar .model-row,
html[data-user-theme="light"] body.user-portal.tg-full-chat .session-toolbar .session-row,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-toolbar .model-row,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .session-toolbar .session-row {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-toolbar label,
html[data-user-theme="light"] body.user-portal.tg-full-chat .session-toolbar label,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-toolbar label,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .session-toolbar label {
  color: var(--ut-text) !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-toolbar select,
html[data-user-theme="light"] body.user-portal.tg-full-chat .session-toolbar select,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-toolbar select,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .session-toolbar select {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
/* 模板下拉：避免 WebKit 将占位/首项显示为浅灰（与背景对比不足） */
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-toolbar select#templateSelect,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-toolbar select#templateSelect {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-toolbar select#templateSelect option,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-toolbar select#templateSelect option {
  color: #0f172a;
  background-color: #ffffff;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-toolbar button,
html[data-user-theme="light"] body.user-portal.tg-full-chat .session-toolbar button,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-toolbar button,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .session-toolbar button {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-toolbar button:hover,
html[data-user-theme="light"] body.user-portal.tg-full-chat .session-toolbar button:hover,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-toolbar button:hover,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .session-toolbar button:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-md,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-md {
  color: #0f172a !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-md h1,
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-md h2,
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-md h3,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-md h1,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-md h2,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-md h3 {
  color: #0f172a !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-md blockquote,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-md blockquote {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-left-color: var(--ut-link) !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .chat-md :not(pre) > code,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .chat-md :not(pre) > code {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .msg-fork,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .msg-fork {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .msg-copy-all,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .msg-copy-all,
html[data-user-theme="light"] body.user-portal.tg-full-chat .msg-icon-btn--copy,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .msg-icon-btn--copy {
  background: #f8fafc !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .msg-copy-all:hover,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .msg-copy-all:hover,
html[data-user-theme="light"] body.user-portal.tg-full-chat .msg-icon-btn--copy:hover,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .msg-icon-btn--copy:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .input-container button,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .input-container button {
  color: #ffffff !important;
}
html[data-user-theme="light"] body.user-portal.tg-full-chat .message.user .content,
html[data-user-theme="light"] body.user-portal.tg-full-chat .message.user .content p,
html[data-user-theme="light"] body.user-portal.tg-full-chat .message.user .content .chat-user-text,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .message.user .content,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .message.user .content p,
html[data-user-theme="light"] body.user-portal.tg-chat-embed .message.user .content .chat-user-text {
  color: #ffffff !important;
}

/* 充值套餐卡、表格 */
html[data-user-theme="light"] body.user-portal .balance-card,
html[data-user-theme="light"] body.user-portal .pricing-recharge .plan.selectable {
  background: var(--ut-card) !important;
  border-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .title p,
html[data-user-theme="light"] body.user-portal .subtitle {
  color: var(--ut-muted) !important;
}
html[data-user-theme="light"] body.user-portal table th,
html[data-user-theme="light"] body.user-portal table td {
  border-color: #e2e8f0 !important;
}
html[data-user-theme="light"] body.user-portal .data-table tbody tr:nth-child(even),
html[data-user-theme="light"] body.user-portal tbody tr:nth-child(even) {
  background: #f8fafc !important;
}
