:root {
  color-scheme: light;
  --bg: #fff;
  --sidebar: #f9f9fb;
  --hover: #ececef;
  --surface: #fff;
  --soft: #f4f4f5;
  --text: #111318;
  --muted: #70747f;
  --line: #e8e8ec;
  --shadow: 0 18px 60px rgba(17, 19, 24, .14);
  --radius: 10px;
  /* Brand colors */
  --brand: #6D5DFB;
  --brand-light: #8B7EFF;
  --brand-dark: #5548E0;
  --brand-glow: rgba(109, 93, 251, 0.15);
  --brand-gradient: linear-gradient(135deg, #6D5DFB 0%, #00C2FF 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--text); background: var(--bg); }
button, input, textarea, select { font: inherit; }
button { border: 0; color: inherit; background: none; cursor: pointer; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(109, 93, 246, 0.18); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(109, 93, 246, 0.30); }
::-webkit-scrollbar-button { display: none; }

/* ── Layout ── */
.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 14px 10px;
  background: rgba(249, 249, 251, 0.85);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-right: 1px solid rgba(232, 232, 236, 0.6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 10px 12px 14px;
  margin: 0 -10px 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, rgba(109, 93, 251, 0.06) 0%, rgba(0, 194, 255, 0.04) 100%);
  border-bottom: 1px solid rgba(232, 232, 236, 0.5);
  border-radius: 0 0 12px 12px;
  flex: 0 0 auto;
}

.brand-logo,
.active-model-logo,
#composerModelLogo,
#detectedLogo,
.avatar,
.model-logo {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-logo { width: 28px; height: 28px; }
.brand-logo.has-user-avatar { border-radius: 50%; overflow: hidden; }
.active-model-logo, #composerModelLogo { width: 24px; height: 24px; }
#detectedLogo { width: 42px; height: 42px; }
.model-logo { width: 28px; height: 28px; }
.brand-logo svg, .active-model-logo svg, #composerModelLogo svg, #detectedLogo svg, .avatar svg, .model-logo svg { display: block; width: 100%; height: 100%; }
.brand-logo img, .active-model-logo img, #composerModelLogo img, #detectedLogo img, .avatar img, .model-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.logo-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
}
.avatar .logo-fallback { border-radius: 50%; background: #666; }
.model-logo .logo-fallback { border-radius: 7px; }

.main-nav {
  display: grid;
  gap: 2px;
  flex: 0 0 auto;
}
.sidebar-bottom {
  display: grid;
  gap: 2px;
}

.nav-item,
.settings-entry,
.model-item,
.ghost-button,
.tiny-button,
.text-button,
.primary-button,
.active-model,

.nav-item,
.settings-entry,
.model-item {
  width: 100%;
  justify-content: flex-start;
  padding: 0 10px;
  color: #22252c;
  font-size: 14px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active,
.model-item:hover,
.model-item.active {
  background: var(--hover);
}

.model-item.active {
  background: rgba(109, 93, 251, 0.065);
  color: var(--brand);
  border-left-color: rgba(109, 93, 246, 0.16);
}

.nav-item.active {
  background: var(--brand-glow);
  color: var(--brand);
  font-weight: 600;
}

.settings-entry {
  justify-content: center;
  border: 1px solid rgba(109, 93, 251, 0.18);
  background: rgba(109, 93, 251, 0.06);
  color: var(--brand);
  font-weight: 700;
  font-size: 13px;
}
.settings-entry:hover { background: rgba(109, 93, 251, 0.12); border-color: rgba(109, 93, 251, 0.28); }

.sidebar-search { display: none; margin: 8px 0 4px; }
.sidebar-search.open { display: block; }
.sidebar-search input,
.settings-grid input,
.settings-grid select,
.full-label textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.sidebar-search input:focus,
.settings-grid input:focus,
.settings-grid select:focus,
.full-label textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.sidebar-search input { height: 38px; padding: 0 12px; }

.model-section {
  display: flex;
  min-height: 200px;
  flex: 5 1 0;
  flex-direction: column;
  margin-top: 10px;
  position: relative;
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  padding: 0 8px;
  color: #8a8e98;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.tiny-button {
  min-height: 26px;
  padding: 0 8px;
  color: #5f636d;
  font-size: 12px;
  font-weight: 600;
}
.tiny-button:hover { background: var(--brand-glow); color: var(--brand); }
.tiny-button.active { background: var(--brand-glow); color: var(--brand); }

.section-title-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ── Brand subtitle ── */
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.brand-text small {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.2;
}

/* ── New chat button ── */
.new-chat-btn {
  background: linear-gradient(135deg, #6D5DF6 0%, #8B7DFF 100%);
  color: #fff;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(109, 93, 246, 0.18);
}
.new-chat-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(109, 93, 246, 0.28);
}

/* ── Model status summary ── */
.section-title-info {
  display: flex;
  align-items: center;
  gap: 6px;
}
.model-status-summary {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}

/* ── Tiny icon button ── */
.tiny-icon-btn {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
}
.tiny-icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

/* ── Model more menu ── */
.model-more-menu {
  position: absolute;
  right: 8px;
  top: 40px;
  z-index: 20;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 4px;
  animation: popup-in .15s ease;
}
.model-more-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  border-radius: 6px;
  text-align: left;
}
.model-more-item:hover {
  background: var(--hover);
}
.model-more-item svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

/* ── Model search ── */
.model-search {
  flex: 0 0 auto;
  padding: 4px 8px;
}
.model-search input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  background: var(--soft);
  border: 1px solid transparent;
  border-radius: 8px;
  outline: none;
  color: var(--text);
}
.model-search input:focus {
  border-color: var(--brand);
  background: var(--surface);
}
.model-search input::placeholder {
  color: var(--muted);
}

/* ── Sidebar bottom row ── */
.sidebar-bottom-row {
  display: flex;
  gap: 2px;
}
.sidebar-bottom-row .nav-item {
  flex: 1;
  justify-content: center;
  font-size: 12px;
  min-height: 34px;
  color: #9ca3af;
  transition: all 0.15s ease;
}
.sidebar-bottom-row .nav-item:hover {
  color: #6d5df6;
  background: rgba(109, 93, 246, 0.06);
}
body.business-mode .sidebar-bottom-row .nav-item {
  color: #5a5850;
}
body.business-mode .sidebar-bottom-row .nav-item:hover {
  color: var(--gold);
  background: rgba(201, 169, 110, 0.06);
}

/* ── Sidebar User Card ── */
.sidebar-user-card {
  width: calc(100% - 20px);
  margin: 8px 10px 12px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(109, 93, 246, 0.14);
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(109, 93, 246, 0.08);
  transition: all 0.2s;
  text-align: left;
  font: inherit;
  color: inherit;
}
.sidebar-user-card:hover {
  background: #ffffff;
  border-color: rgba(109, 93, 246, 0.28);
  box-shadow: 0 12px 28px rgba(109, 93, 246, 0.12);
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6d5df6, #38c7ff);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  box-shadow: 0 0 18px rgba(109, 93, 246, 0.28);
  flex-shrink: 0;
}
.user-info {
  min-width: 0;
  flex: 1;
}
.user-name {
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.user-meta {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #8a8f9c;
}
.admin-badge {
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(109, 93, 246, 0.10);
  color: #6d5df6;
  font-weight: 800;
  font-size: 10px;
}
.user-arrow {
  color: #9ca3af;
  font-size: 18px;
  flex-shrink: 0;
}
body.business-mode .sidebar-user-card {
  background: rgba(201, 169, 110, 0.06);
  border-color: rgba(212, 175, 55, 0.15);
}
body.business-mode .sidebar-user-card:hover {
  background: rgba(201, 169, 110, 0.10);
  border-color: rgba(212, 175, 55, 0.30);
}
body.business-mode .user-name { color: #e8e6e1; }
body.business-mode .user-meta { color: #7a7870; }
body.business-mode .admin-badge {
  background: rgba(201, 169, 110, 0.12);
  color: var(--gold);
}
body.business-mode .user-arrow { color: #5a5850; }

body.image-mode .sidebar-user-card {
  background: rgba(16, 22, 46, 0.72);
  border-color: rgba(109, 93, 246, 0.18);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}
body.image-mode .sidebar-user-card:hover {
  background: rgba(22, 30, 56, 0.85);
  border-color: rgba(109, 93, 246, 0.32);
}
body.image-mode .user-name { color: #e2eaff; }
body.image-mode .user-meta { color: rgba(180, 196, 255, 0.55); }
body.image-mode .user-arrow { color: rgba(180, 196, 255, 0.4); }

.multi-select-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  margin: 2px 0;
  font-size: 12px;
  color: var(--muted);
  background: var(--soft);
  border-radius: 6px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.model-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid var(--line);
  border-radius: 4px;
  margin-right: 4px;
  transition: all 0.15s ease;
}
.model-checkbox.checked {
  background: var(--brand);
  border-color: var(--brand);
}
.model-checkbox.checked::after {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}

.model-list {
  display: grid;
  align-content: start;
  gap: 2px;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 8px;
}
.model-group-header {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  background: var(--sidebar);
  z-index: 1;
}
body.business-mode .model-group-header {
  background: #0e0f14;
  color: #5a5850;
}
body.business-mode .model-list {
  scrollbar-color: rgba(212, 175, 55, 0.15) transparent;
  scrollbar-width: thin;
}
body.business-mode .conversation-list {
  scrollbar-color: rgba(212, 175, 55, 0.15) transparent;
  scrollbar-width: thin;
}

.model-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  min-height: 58px;
  max-height: 58px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  border-left: 3px solid transparent;
  transition: background .15s ease, border-color .15s ease;
}
.model-item .model-logo {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
.model-item .model-logo img,
.model-item .model-logo svg,
.model-item .model-logo .logo-fallback {
  width: 26px;
  height: 26px;
}
.model-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  flex: 1;
  overflow: hidden;
}
.model-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.model-item-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #a0a4ae;
  font-size: 11px;
  line-height: 1.3;
}
body.business-mode .model-item-meta {
  color: #4a4840;
}

/* ── Model Family (Two-Level) ── */
.model-family-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: 8px; cursor: pointer; transition: background 0.12s;
  margin: 1px 0; height: 40px; min-width: 0; overflow: hidden;
}
.model-family-item:hover { background: #f3f0ff; }
.model-family-item.has-selected { background: #f8f6ff; }
.model-family-logo { width: 24px; height: 24px; border-radius: 5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.model-family-logo .model-logo { width: 24px; height: 24px; }
.model-family-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.model-family-name { font-size: 13px; font-weight: 500; color: var(--text, #111); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-family-count { font-size: 11px; color: var(--muted, #9ca3af); white-space: nowrap; }
.model-family-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.model-family-selected { font-size: 11px; color: var(--brand, #6d5dfb); font-weight: 500; white-space: nowrap; }
.model-family-arrow { font-size: 16px; color: var(--muted, #9ca3af); font-weight: 300; }

/* Family header (two-line: back, then name + count) */
.model-family-header { display: flex; align-items: center; gap: 8px; padding: 8px 10px 2px; }
.model-family-back { font-size: 12px; color: var(--brand, #6d5dfb); cursor: pointer; font-weight: 500; }
.model-family-back:hover { opacity: 0.8; }
.model-family-title-row { display: flex; align-items: baseline; gap: 6px; padding: 2px 10px 6px; }
.model-family-title-name { font-size: 14px; font-weight: 600; color: var(--text, #111); }
.model-family-title-count { font-size: 11px; color: var(--muted, #9ca3af); }

/* Compact model item (for family drill-down) */
.model-item.compact { height: 42px; min-height: 42px; max-height: 42px; gap: 8px; }
.model-item.compact .model-logo { width: 22px; height: 22px; }
.model-item.compact .model-logo img,
.model-item.compact .model-logo svg,
.model-item.compact .model-logo .logo-fallback { width: 22px; height: 22px; }
.model-item.compact .model-item-name { font-size: 12px; }

/* More button for collapsed selected models */
.model-more-btn {
  padding: 5px 10px; margin: 0 6px; font-size: 12px;
  color: var(--brand, #6d5dfb); cursor: pointer; border-radius: 6px;
  text-align: center; transition: background 0.12s;
}
.model-more-btn:hover { background: #f3f0ff; }
.model-expand-wrap { display: contents; }

/* Dark mode */
body.business-mode .model-family-item:hover { background: rgba(201,169,110,0.06); }
body.business-mode .model-family-item.has-selected { background: rgba(201,169,110,0.04); border-left: 2px solid rgba(212,175,55,0.3); padding-left: 8px; }
body.business-mode .model-family-name { color: #e8e6e1; }
body.business-mode .model-family-count { color: #6b6660; }
body.business-mode .model-family-selected { color: var(--gold); }
body.business-mode .model-family-arrow { color: #6b6660; }
body.business-mode .model-family-back { color: var(--gold); }
body.business-mode .model-family-title-name { color: #e8e6e1; }
body.business-mode .model-family-title-count { color: #6b6660; }
body.business-mode .model-more-btn { color: var(--gold); }
body.business-mode .model-more-btn:hover { background: rgba(201,169,110,0.06); }

.empty-models {
  margin: 8px;
  padding: 12px;
  color: var(--muted);
  border: 1px dashed #d5d5da;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.conversation-section {
  display: flex;
  min-height: 0;
  flex: 4 1 0;
  flex-direction: column;
  margin-top: 0;
  overflow: hidden;
  border-top: 1px solid rgba(212, 175, 55, 0.08);
  padding-top: 10px;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 6px;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: #22252c;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  transition: background .15s ease;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
}
.conversation-item:hover { background: var(--hover); }
.conversation-item.active { background: var(--hover); font-weight: 600; }

.conversation-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.conversation-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 500;
}
.conversation-item-time {
  color: var(--muted);
  font-size: 11px;
}
.conversation-item-delete {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  opacity: 0;
  color: #999;
  transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.conversation-item:hover .conversation-item-delete { opacity: 1; }
.conversation-item-delete:hover { background: rgba(109, 93, 251, 0.1); color: var(--brand); }
.conversation-item-delete svg { width: 14px; height: 14px; }
body.business-mode .conversation-item-delete:hover { background: rgba(201, 169, 110, 0.1); color: var(--gold); }

/* ── Conversation Filter Bar ── */
.conv-filter-bar {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 0 8px 8px; flex: 0 0 auto;
}
.conv-filter-tab {
  height: 30px; border: none; border-radius: 8px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--muted, #9ca3af);
  transition: all .15s;
}
.conv-filter-tab:hover { background: var(--hover, rgba(0,0,0,0.04)); color: var(--text, #111); }
.conv-filter-tab.active { background: rgba(109,93,251,0.08); color: var(--brand, #6d5dfb); }

/* ── Time Group Header ── */
.conv-time-group {
  padding: 8px 10px 2px; font-size: 11px; font-weight: 600;
  color: var(--muted, #9ca3af); text-transform: uppercase; letter-spacing: 0.04em;
  flex: 0 0 auto;
}
.conv-time-group:not(:first-child) { margin-top: 6px; border-top: 1px solid var(--line, #e5e7eb); padding-top: 8px; }

/* ── Conversation Item (updated) ── */
.conversation-item-meta {
  color: var(--muted, #9ca3af); font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Hover Actions ── */
.conv-item-actions {
  display: flex; align-items: center; gap: 2px;
  opacity: 0; transition: opacity .15s;
  flex-shrink: 0;
}
.conversation-item:hover .conv-item-actions { opacity: 1; }

.conv-star-btn {
  width: 24px; height: 24px; border: none; border-radius: 6px;
  background: transparent; color: var(--muted, #9ca3af);
  font-size: 14px; cursor: pointer; display: inline-grid; place-items: center;
  transition: all .15s;
}
.conv-star-btn:hover { background: rgba(109,93,251,0.1); color: #f59e0b; }
.conv-star-btn.favorited { color: #f59e0b; }

.conv-more-btn {
  width: 24px; height: 24px; border: none; border-radius: 6px;
  background: transparent; color: var(--muted, #9ca3af);
  font-size: 16px; cursor: pointer; display: inline-grid; place-items: center;
  letter-spacing: 1px; transition: all .15s;
}
.conv-more-btn:hover { background: rgba(109,93,251,0.1); color: var(--text, #111); }

/* ── Context Menu ── */
.conv-context-menu {
  background: #fff; border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  padding: 4px 0; min-width: 140px; animation: popup-in .12s ease;
}
.conv-menu-item {
  display: block; width: 100%; padding: 8px 14px; border: none;
  background: transparent; color: var(--text, #111); font-size: 13px;
  text-align: left; cursor: pointer; transition: background .12s;
}
.conv-menu-item:hover { background: #f3f0ff; }
.conv-menu-item.danger { color: #ef4444; }
.conv-menu-item.danger:hover { background: #fef2f2; }
.conv-menu-sep { height: 1px; background: var(--line, #e5e7eb); margin: 4px 0; }

/* ── Undo Toast ── */
.undo-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; z-index: 9999; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2); animation: popup-in .15s ease;
}
.undo-toast-btn {
  background: transparent; border: 1px solid rgba(255,255,255,0.3);
  color: #fff; padding: 4px 12px; border-radius: 6px; font-size: 12px;
  cursor: pointer; font-weight: 500; transition: all .15s;
}
.undo-toast-btn:hover { background: rgba(255,255,255,0.15); }

/* ── Dark mode — Conversation Management ── */
body.business-mode .conv-filter-tab { color: #6b6660; }
body.business-mode .conv-filter-tab:hover { background: rgba(201,169,110,0.06); color: #e8e6e1; }
body.business-mode .conv-filter-tab.active { background: rgba(201,169,110,0.1); color: var(--gold); }
body.business-mode .conv-time-group { color: #5a5850; }
body.business-mode .conv-time-group { border-color: rgba(212,175,55,0.1); }
body.business-mode .conversation-item-meta { color: #5a5850; }
body.business-mode .conv-star-btn { color: #5a5850; }
body.business-mode .conv-star-btn:hover { background: rgba(201,169,110,0.1); color: #f0d98c; }
body.business-mode .conv-star-btn.favorited { color: #f0d98c; }
body.business-mode .conv-more-btn { color: #5a5850; }
body.business-mode .conv-more-btn:hover { background: rgba(201,169,110,0.1); color: #e8e6e1; }
body.business-mode .conv-context-menu { background: #16171d; border-color: rgba(212,175,55,0.2); box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 20px rgba(212,175,55,0.04); }
body.business-mode .conv-menu-item { color: #e8e6e1; }
body.business-mode .conv-menu-item:hover { background: rgba(201,169,110,0.06); }
body.business-mode .conv-menu-item.danger { color: #f87171; }
body.business-mode .conv-menu-item.danger:hover { background: rgba(239,68,68,0.08); }
body.business-mode .conv-menu-sep { background: rgba(212,175,55,0.1); }
body.business-mode .undo-toast { background: #1e1e24; border: 1px solid rgba(212,175,55,0.2); }
body.business-mode .undo-toast-btn { border-color: rgba(212,175,55,0.3); }
body.business-mode .undo-toast-btn:hover { background: rgba(201,169,110,0.1); }

.sidebar-bottom {
  flex: 0 0 auto;
  padding-top: 10px;
  border-top: 1px solid rgba(212, 175, 55, 0.08);
  margin-top: auto;
}

/* ── Workspace ── */
.workspace {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% 58%, rgba(109, 93, 246, 0.07), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fbfbff 100%);
}
body.business-mode .workspace {
  background:
    radial-gradient(circle at 50% 62%, rgba(212, 175, 55, 0.075), transparent 34%),
    radial-gradient(circle at 80% 18%, rgba(212, 175, 55, 0.035), transparent 28%),
    linear-gradient(180deg, #07080b 0%, #090a0e 100%);
}
body.business-mode .workspace::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  z-index: 0;
  background-image:
    linear-gradient(rgba(212, 175, 55, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 175, 55, 0.12) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at center, black 0%, transparent 76%);
  -webkit-mask-image: radial-gradient(circle at center, black 0%, transparent 76%);
}
body.business-mode .workspace::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 900px 520px at 50% 30%, rgba(230,200,117,0.16) 0%, rgba(212,175,55,0.10) 22%, rgba(212,175,55,0.055) 42%, rgba(212,175,55,0.022) 62%, transparent 86%),
    radial-gradient(ellipse 1250px 760px at 50% 38%, rgba(212,175,55,0.07) 0%, rgba(212,175,55,0.035) 36%, rgba(212,175,55,0.014) 58%, transparent 90%),
    radial-gradient(ellipse 1500px 900px at 50% 48%, rgba(212,175,55,0.035) 0%, rgba(212,175,55,0.014) 46%, transparent 92%);
}
.business-mode .empty-state,
.business-mode .empty-matrix-stage,
.business-mode .topbar {
  position: relative;
  z-index: 2;
}
.business-mode .composer {
  position: relative;
  z-index: 100;
}
.business-mode .composer-wrap {
  z-index: 2;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(232, 232, 236, 0.5);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}
body.business-mode .topbar {
  background: rgba(8, 9, 12, 0.8);
  border-bottom-color: rgba(30, 31, 39, 0.5);
}

/* ── Topbar Left ── */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topbar-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.topbar-mode-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}
.topbar-selected {
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d5df6;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
body.business-mode .topbar-selected {
  background: rgba(212, 175, 55, 0.10);
  color: #E6C875;
}

/* ── Topbar Chips ── */
.topbar-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-chips::-webkit-scrollbar { display: none; }
.topbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-chip-logo {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.topbar-chip-logo .logo-fallback {
  width: 14px;
  height: 14px;
  font-size: 7px;
  border-radius: 3px;
}
.topbar-chip-more {
  padding: 4px 8px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.topbar-chip-more:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* ── Topbar Right ── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
}

/* ── Status Pills ── */
.topbar-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(109, 93, 246, 0.08);
  border: 1px solid rgba(109, 93, 246, 0.18);
  color: #6d5df6;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill .pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}
.status-pill.online {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.18);
  color: #16a06a;
}
body.business-mode .status-pill {
  background: rgba(201, 169, 110, 0.08);
  border-color: rgba(212, 175, 55, 0.2);
  color: var(--gold);
}
body.business-mode .status-pill.online {
  background: rgba(201, 169, 110, 0.06);
  border-color: rgba(212, 175, 55, 0.15);
  color: #6ee7b7;
}
body.business-mode .status-pill .pill-dot {
  background: #6ee7b7;
  box-shadow: 0 0 6px rgba(110, 231, 183, 0.5);
}
.status-pill.low {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #EF4444;
}
.status-pill.warn {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: #D97706;
}
body.business-mode .status-pill.low {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #F87171;
}
body.business-mode .status-pill.warn {
  background: rgba(234, 179, 8, 0.1);
  border-color: rgba(234, 179, 8, 0.3);
  color: #FBBF24;
}
.topbar-api-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--soft);
  white-space: nowrap;
  cursor: pointer;
}
.topbar-api-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ccc;
}
.topbar-api-status.connected .topbar-api-dot {
  background: #10b981;
}
.topbar-api-status.connected {
  color: #10b981;
}

/* ── Topbar More Menu ── */
.topbar-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 4px;
  animation: popup-in .15s ease;
}
.topbar-more-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  border-radius: 6px;
  text-align: left;
}
.topbar-more-item:hover {
  background: var(--hover);
}
.topbar-more-item svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }
.danger-item { color: #ef4444; }
.danger-item:hover { background: #fef2f2; }

.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 8px;
  color: #555a64;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
}
.ghost-button:hover {
  background: var(--soft);
}

/* ── Conversation ── */
.conversation {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  overflow-y: auto;
  padding: 28px clamp(24px, 10vw, 180px) 140px;
  scroll-behavior: smooth;
}

.message {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 820px;
  animation: msg-in .25s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.user {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr);
}
.message.user .avatar {
  display: none;
  grid-column: 2;
  grid-row: 1;
  background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(96, 165, 250, 0.3);
}
.message.user .message-body { grid-column: 1; align-items: flex-end; }
.avatar { width: 32px; height: 32px; color: #fff; background: transparent; border-radius: 50%; font-size: 12px; font-weight: 800; overflow: hidden; }
.avatar.has-user-avatar {
  background: transparent;
}
.avatar.has-user-avatar .user-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 36%;
  border-radius: 50%;
}
.clickable-avatar {
  cursor: pointer;
  transition: transform 0.15s ease;
}
.clickable-avatar:hover {
  transform: scale(1.6);
}
.message-body { display: flex; min-width: 0; flex-direction: column; }
.message-meta { display: flex; gap: 8px; margin-bottom: 3px; color: #9da1aa; font-size: 12px; }
.message.user .message-meta { display: none; }
.bubble {
  width: fit-content;
  max-width: min(800px, 100%);
  color: #17191f;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  border-left: 3px solid var(--msg-color, #555);
  padding: 9px 14px;
  transition: max-height .3s ease, box-shadow .2s ease;
  overflow: hidden;
  position: relative;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.message:not(.user) .bubble:hover {
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 0 0 1px rgba(0, 0, 0, 0.03);
}
.message.user .bubble {
  padding: 9px 16px;
  background: #e9f3ff;
  color: #0f172a;
  line-height: 1.55;
  border-radius: 22px;
  border-left: none;
  box-shadow: none;
  position: relative;
  overflow: visible;
}
.message.user .bubble::before {
  content: none;
}
.message.user .bubble:hover {
  box-shadow: none;
  transform: none;
}
.user-quote-preview {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: min(560px, 100%);
  margin: 0 4px 8px 0;
  padding: 0 2px 0 0;
  color: #8b9098;
  font-size: 14px;
  line-height: 1.45;
}
.user-quote-arrow {
  flex: 0 0 auto;
  color: #8b9098;
  font-size: 18px;
  line-height: 1.15;
  transform: translateY(1px);
}
.user-quote-text {
  max-width: 100%;
  color: #8b9098;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
}
.message.user .user-quote-preview + span,
.message.user .user-quote-preview + .message-images {
  margin-top: 2px;
}
body.business-mode .user-quote-preview,
body.business-mode .user-quote-arrow,
body.business-mode .user-quote-text {
  color: rgba(232, 226, 210, 0.58);
}
.bubble.collapsed::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5em;
  background: linear-gradient(transparent, var(--surface, #fff));
  pointer-events: none;
}
body.business-mode .bubble.collapsed::after { background: linear-gradient(transparent, var(--surface, #08090C)); }
.bubble.thinking {
  display: block;
  min-width: 48px;
  min-height: 28px;
  padding: 4px 0;
}

/* ── Thinking indicator (before first chunk) ── */
.thinking-indicator { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.thinking-header { display: flex; align-items: center; gap: 8px; }
.thinking-icon { font-size: 14px; color: var(--brand); display: inline-flex; }
.thinking-icon.pulse { animation: pulse-glow 1.5s ease-in-out infinite; }
@keyframes pulse-glow {
  0%, 100% { opacity: .6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}
.thinking-label { font-size: 13px; color: #8d929d; letter-spacing: .3px; }
.thinking-dots { display: flex; gap: 3px; align-items: center; }
.thinking-dots span {
  width: 4px; height: 4px; background: var(--brand); border-radius: 50%;
  animation: dot-bounce 1.4s infinite ease-in-out;
}
.thinking-dots span:nth-child(2) { animation-delay: .16s; }
.thinking-dots span:nth-child(3) { animation-delay: .32s; }
@keyframes dot-bounce {
  0%, 80%, 100% { opacity: .25; transform: scale(.8); }
  40% { opacity: 1; transform: scale(1.2); }
}
body.business-mode .thinking-label { color: #5a5850; }
body.business-mode .thinking-icon { color: rgba(201, 169, 110, 0.5); }
body.business-mode .thinking-summary .thinking-icon { color: rgba(201, 169, 110, 0.5); }
body.business-mode .thinking-section.completed:hover .thinking-summary { color: var(--gold-light); }
body.business-mode .thinking-section.completed:hover .thinking-summary .thinking-icon { color: var(--gold); }

/* ── Thinking section ── */
.thinking-section { margin: 0; }
.thinking-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  color: #8d929d;
  font-size: 13px;
  user-select: none;
}
.thinking-summary .thinking-icon { font-size: 12px; color: var(--brand); }
.thinking-section .response-content { display: none; }

/* Completed: show content */
.thinking-section.completed .response-content { display: block; }
.thinking-section.completed:hover .thinking-summary { color: var(--brand); }

/* Long thinking: collapse thinking summary, response always visible */
.thinking-section.completed.collapsible .thinking-summary {
  cursor: pointer;
}
.thinking-section.completed.collapsible .response-content {
  display: block;
}

body.business-mode .thinking-summary { color: var(--muted); }
body.business-mode .thinking-dots span { background: #4a4840; }

/* ── Message Actions ── */
.message-actions { display: flex; gap: 2px; margin-top: 6px; color: #9298a4; opacity: 0; transition: opacity .15s ease; }
.message:hover .message-actions { opacity: 1; }
.message.user .message-actions {
  margin-top: 8px;
  padding-right: 8px;
}
.message-actions button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 12px;
  color: #9298a4;
  transition: color .15s ease, background .15s ease;
}
.message-actions button [data-icon] { width: 13px; height: 13px; }
.message-actions button:hover { color: var(--brand); background: var(--brand-glow); }
.message.user .message-actions button {
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
  border-radius: 999px;
  color: #6b7280;
  font-size: 0;
}
.message.user .message-actions button [data-icon] {
  width: 17px;
  height: 17px;
}
.message.user .message-actions button:hover {
  color: #111827;
  background: #f3f4f6;
}

/* ── Composer ── */
.composer-wrap {
  position: absolute;
  right: clamp(14px, 10vw, 190px);
  bottom: 20px;
  left: clamp(14px, 10vw, 190px);
  display: grid;
  gap: 16px;
  justify-items: center;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 30px;
  margin-top: -24px;
  position: relative;
  width: 100%;
  max-width: 980px;
  text-align: center;
  animation: fade-in-up .4s ease;
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
/* ── Empty matrix stage ── */
.empty-matrix-stage {
  position: relative;
  width: 100%;
  height: 360px;
  margin-bottom: -34px;
  pointer-events: none;
  overflow: visible;
  mask-image: radial-gradient(ellipse at center, black 0%, black 48%, rgba(0,0,0,0.72) 62%, transparent 82%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 0%, black 48%, rgba(0,0,0,0.72) 62%, transparent 82%);
}
.hero-matrix-empty {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 720px;
  height: 420px;
  transform: translate(-50%, -50%) scale(0.9);
  transform-origin: center;
  animation: matrixFloat 7s ease-in-out infinite;
}
@keyframes matrixFloat {
  0%, 100% { transform: translate(-50%, -50%) scale(0.9); }
  50% { transform: translate(-50%, calc(-50% - 6px)) scale(0.9); }
}
.empty-content {
  position: relative;
  z-index: 3;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
/* ── Normal mode matrix ── */
body:not(.business-mode) .hero-matrix-empty {
  opacity: 0.55;
  filter: brightness(1.08) saturate(0.9);
}
body:not(.business-mode) .empty-matrix-stage::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  width: 900px;
  height: 540px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at center, rgba(109,93,246,0.14) 0%, rgba(109,93,246,0.07) 22%, rgba(109,93,246,0.025) 42%, transparent 72%);
  filter: blur(18px);
}
body:not(.business-mode) .empty-matrix-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 55%;
  width: 1100px;
  height: 680px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(ellipse at center, rgba(109,93,246,0.045) 0%, rgba(109,93,246,0.018) 36%, transparent 76%);
  filter: blur(42px);
}
/* ── Business mode matrix (gold) ── */
.business-mode .hero-matrix-empty {
  opacity: 0.96;
  filter: sepia(0.50) saturate(0.82) hue-rotate(350deg) brightness(0.88) contrast(0.96);
}
.business-mode .empty-matrix-stage::before,
.business-mode .empty-matrix-stage::after {
  content: none !important;
}
.business-mode .model-node span {
  background: linear-gradient(180deg, rgba(25,21,15,0.92), rgba(9,8,6,0.94));
  border-color: rgba(212, 175, 55, 0.24);
  color: #f3efe3;
  box-shadow: 0 14px 34px rgba(0,0,0,0.36), 0 0 18px rgba(212,175,55,0.10), inset 0 1px 0 rgba(255,255,255,0.06);
}
.business-mode .model-node span::before {
  background: #e6c875;
  box-shadow: 0 0 10px rgba(212,175,55,0.65);
}
.business-mode .chip-body {
  background: radial-gradient(circle at 70% 28%, rgba(255,229,150,0.30), transparent 30%), radial-gradient(circle at 50% 50%, rgba(212,175,55,0.18), transparent 55%), linear-gradient(180deg, rgba(58,48,29,0.96), rgba(22,18,12,0.98));
  border-color: rgba(230,200,117,0.46);
  box-shadow: 0 0 42px rgba(212,175,55,0.28), 0 0 90px rgba(212,175,55,0.10), inset 0 1px 0 rgba(255,255,255,0.10);
}
.business-mode .chip-glow {
  background: radial-gradient(circle, rgba(212,175,55,0.20), transparent 58%), radial-gradient(circle, rgba(230,200,117,0.16), transparent 64%);
}
.business-mode .chip-label {
  color: #fff0bd;
  text-shadow: 0 0 10px rgba(255,240,189,0.70), 0 0 24px rgba(212,175,55,0.55);
}
.business-mode .chip-pins { opacity: 0.5; }
.business-mode .pin-top, .business-mode .pin-bottom {
  background: repeating-linear-gradient(90deg, rgba(212,175,55,0.38) 0, rgba(212,175,55,0.38) 5px, transparent 5px, transparent 13px);
}
.business-mode .pin-left, .business-mode .pin-right {
  background: repeating-linear-gradient(180deg, rgba(212,175,55,0.38) 0, rgba(212,175,55,0.38) 5px, transparent 5px, transparent 13px);
}
.business-mode .matrix-link-main { stroke: rgba(212,175,55,0.30); filter: drop-shadow(0 0 6px rgba(212,175,55,0.22)); }
.business-mode .matrix-link-peer { stroke: rgba(212,175,55,0.14); filter: drop-shadow(0 0 4px rgba(212,175,55,0.10)); }
.business-mode .compute-badge {
  background: rgba(212,175,55,0.10);
  border-color: rgba(212,175,55,0.20);
  color: rgba(243,239,227,0.70);
}
.business-mode .circuit {
  stroke: rgba(255,230,160,0.72);
  filter: drop-shadow(0 0 12px rgba(212,175,55,0.65));
}
.business-mode .chip-dot {
  fill: #ffe596;
  filter: drop-shadow(0 0 10px rgba(212,175,55,0.80));
}
/* ── Model matrix shared styles ── */
.hero-matrix {
  position: relative;
  width: 560px;
  height: 360px;
}
.matrix-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.matrix-link-main {
  stroke: rgba(120,170,255,0.36);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 8 16;
  animation: mainLinkFlow 2.6s linear infinite;
  filter: drop-shadow(0 0 8px rgba(96,180,255,0.28));
}
@keyframes mainLinkFlow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -48; } }
.matrix-link-peer {
  stroke: rgba(150,160,255,0.18);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-dasharray: 4 18;
  animation: peerLinkFlow 4.4s linear infinite;
  filter: drop-shadow(0 0 5px rgba(123,109,255,0.14));
}
@keyframes peerLinkFlow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 44; } }
.ai-chip {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150px;
  height: 120px;
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 6;
}
.chip-glow {
  position: absolute;
  inset: -42px;
  border-radius: 42px;
  background: radial-gradient(circle, rgba(76,140,255,0.32), transparent 58%), radial-gradient(circle, rgba(123,109,255,0.28), transparent 64%);
  filter: blur(4px);
  animation: chipAura 2.8s ease-in-out infinite;
}
@keyframes chipAura { 0%, 100% { opacity: 0.55; transform: scale(1); } 50% { opacity: 0.95; transform: scale(1.06); } }
.chip-body {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(37,54,94,0.98), rgba(17,24,46,0.98)), radial-gradient(circle at 30% 20%, rgba(255,255,255,0.22), transparent 28%);
  border: 1px solid rgba(155,180,255,0.42);
  box-shadow: 0 0 38px rgba(84,126,255,0.42), 0 0 90px rgba(56,199,255,0.18), inset 0 1px 0 rgba(255,255,255,0.22), inset 0 -18px 40px rgba(0,0,0,0.18);
  animation: chipCompute 2.4s ease-in-out infinite;
}
.chip-body::before { content: ''; position: absolute; inset: 10px; border-radius: 16px; border: 1px solid rgba(155,180,255,0.18); pointer-events: none; }
.chip-body::after { content: ''; position: absolute; left: -40%; top: 0; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, rgba(130,190,255,0.20), transparent); animation: chipScan 2.8s ease-in-out infinite; }
@keyframes chipCompute {
  0%, 100% { transform: scale(1); box-shadow: 0 0 38px rgba(84,126,255,0.42), 0 0 90px rgba(56,199,255,0.18), inset 0 1px 0 rgba(255,255,255,0.22); }
  50% { transform: scale(1.025); box-shadow: 0 0 52px rgba(84,126,255,0.62), 0 0 120px rgba(56,199,255,0.30), inset 0 1px 0 rgba(255,255,255,0.28); }
}
@keyframes chipScan { 0% { left: -42%; opacity: 0; } 20% { opacity: 1; } 60%, 100% { left: 110%; opacity: 0; } }
.chip-label {
  position: absolute; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%);
  color: #ffffff; font-size: 18px; font-weight: 900; letter-spacing: -0.4px;
  text-shadow: 0 0 14px rgba(120,180,255,0.9), 0 0 28px rgba(109,93,246,0.55);
}
.chip-circuits { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; opacity: 0.95; }
.circuit {
  fill: none; stroke: rgba(132,210,255,0.34); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 10 18; animation: circuitFlow 1.8s linear infinite; filter: drop-shadow(0 0 8px rgba(96,190,255,0.7));
}
.circuit-1 { animation-delay: 0s; }
.circuit-2 { animation-delay: 0.25s; }
.circuit-3 { animation-delay: 0.5s; }
.circuit-4 { animation-delay: 0.75s; }
@keyframes circuitFlow { from { stroke-dashoffset: 0; stroke: rgba(132,210,255,0.30); } 50% { stroke: rgba(132,210,255,0.95); } to { stroke-dashoffset: -56; stroke: rgba(132,210,255,0.30); } }
.chip-dot { fill: #8bdcff; opacity: 0.75; filter: drop-shadow(0 0 8px rgba(139,220,255,0.95)); animation: chipDotPulse 1.6s ease-in-out infinite; }
.dot-a { animation-delay: 0s; }
.dot-b { animation-delay: 0.35s; }
.dot-c { animation-delay: 0.7s; }
.dot-d { animation-delay: 1.05s; }
@keyframes chipDotPulse { 0%, 100% { opacity: 0.35; transform: scale(1); } 50% { opacity: 1; transform: scale(1.35); } }
.chip-pins { position: absolute; z-index: 1; opacity: 0.62; }
.pin-top, .pin-bottom { left: 16px; right: 16px; height: 8px; background: repeating-linear-gradient(90deg, rgba(130,160,255,0.42) 0, rgba(130,160,255,0.42) 5px, transparent 5px, transparent 13px); }
.pin-top { top: -8px; }
.pin-bottom { bottom: -8px; }
.pin-left, .pin-right { top: 16px; bottom: 16px; width: 8px; background: repeating-linear-gradient(180deg, rgba(130,160,255,0.42) 0, rgba(130,160,255,0.42) 5px, transparent 5px, transparent 13px); }
.pin-left { left: -8px; }
.pin-right { right: -8px; }
.compute-badge {
  position: absolute; left: 50%; top: calc(50% + 84px); transform: translateX(-50%);
  height: 24px; padding: 0 10px; border-radius: 999px; display: flex; align-items: center; gap: 7px;
  background: rgba(8,12,24,0.72); border: 1px solid rgba(132,210,255,0.18);
  color: rgba(215,230,255,0.54); font-size: 10px; letter-spacing: 1px; z-index: 6; backdrop-filter: blur(10px);
}
.compute-badge span { width: 6px; height: 6px; border-radius: 999px; background: #6ee7b7; box-shadow: 0 0 12px rgba(110,231,183,0.8); animation: computeDot 1.1s ease-in-out infinite; }
@keyframes computeDot { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.model-node { position: absolute; z-index: 4; transition: transform 1.6s cubic-bezier(.2,.8,.2,1); }
.model-node span {
  min-width: 68px; height: 34px; padding: 0 14px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(19,24,40,0.94), rgba(8,12,24,0.96));
  border: 1px solid rgba(150,165,255,0.26); color: rgba(244,247,255,0.88);
  font-size: 13px; font-weight: 800;
  box-shadow: 0 14px 34px rgba(0,0,0,0.34), 0 0 24px rgba(109,93,246,0.16), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
}
.model-node span::before { content: ''; width: 6px; height: 6px; margin-right: 7px; border-radius: 999px; background: #8bdcff; box-shadow: 0 0 12px rgba(139,220,255,0.95); }
.node-gpt { left: 58px; top: 74px; }
.node-claude { right: 38px; top: 78px; }
.node-gemini { left: 50%; top: 22px; transform: translateX(-50%); }
.node-qwen { left: 24px; bottom: 82px; }
.node-deepseek { right: 20px; bottom: 84px; }
.node-kimi { left: 50%; bottom: 22px; transform: translateX(-50%); }
/* ── Empty meta row ── */
.empty-meta-row {
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
}

.empty-state h1 {
  margin: 0;
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 950;
  letter-spacing: -0.8px;
  line-height: 1.18;
  text-align: center;
  color: #333;
}
.empty-subtitle {
  margin: 0;
  font-size: 15px;
  text-align: center;
  color: #8a8e98;
}
.empty-status-capsule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(109, 93, 251, 0.06);
  font-size: 12px;
  color: #6b7280;
}
.capsule-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}
.capsule-sep {
  color: #d1d5db;
}
.model-group-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #8A8F9C;
}
.model-group-status .group-label {
  font-weight: 700;
  color: #8A8F9C;
}
.model-group-status .group-sep {
  color: #d1d5db;
}
.model-group-status .group-models {
  color: #8A8F9C;
}
body.business-mode .model-group-status .group-label {
  color: var(--gold);
}
body.business-mode .model-group-status .group-sep {
  color: #3a3830;
}
body.business-mode .model-group-status .group-models {
  color: #7a7870;
}
.quick-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 32px;
  width: 100%;
  max-width: 880px;
}
.quick-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: auto;
  min-height: 96px;
  padding: 16px 18px;
  border: 1px solid #EEF0F6;
  border-radius: 16px;
  background: #fff;
  font-size: 13px;
  color: #555a64;
  cursor: pointer;
  transition: all .25s cubic-bezier(.4, .0, .2, 1);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
  text-align: left;
}
.quick-card:hover {
  border-color: rgba(109, 93, 246, 0.24);
  box-shadow: 0 14px 34px rgba(109, 93, 246, 0.10);
  transform: translateY(-2px);
}
.quick-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(109, 93, 251, 0.1);
  color: var(--brand);
  flex-shrink: 0;
}
.quick-card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.quick-card-text strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.quick-card-text small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.quick-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 6px;
  margin-top: 4px;
}
.quick-hint .hint-label {
  font-weight: 600;
  color: #6d5df6;
}
.quick-hint .hint-items {
  color: #9ca3af;
}
body.business-mode .quick-hint .hint-label {
  color: var(--gold);
}
body.business-mode .quick-hint .hint-items {
  color: #5a5850;
}
.conversation.has-messages + .composer-wrap .empty-state { display: none; }

/* ── Topbar status ── */
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: #8a8e98;
  background: #f4f4f5;
  transition: all .2s ease;
  white-space: nowrap;
  min-width: max-content;
  height: 32px;
}
.status-dot-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ccc;
  transition: all .3s ease;
}
.status-dot.connected .status-dot-indicator {
  background: var(--brand);
  box-shadow: 0 0 8px var(--brand-glow);
}
.status-dot.connected { color: var(--brand); }
.composer {
  display: flex;
  flex-direction: column;
  width: min(100%, 880px);
  border: 1px solid #E7E8F0;
  border-radius: 24px;
  background: #ffffff;
  box-shadow:
    0 18px 50px rgba(15, 23, 42, 0.10),
    0 0 0 4px rgba(109, 93, 246, 0.04);
  transition: border-color .3s ease, box-shadow .3s ease, background .3s ease;
  position: relative;
}
.composer-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 8px 6px 6px;
}
.image-preview,
.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px;
}
.composer:focus-within {
  border-color: rgba(109, 93, 251, 0.35);
  background: rgba(255, 255, 255, 0.98);
  box-shadow:
    0 18px 50px rgba(15, 23, 42, 0.12),
    0 0 0 4px rgba(109, 93, 246, 0.08);
}

/* ── Model Capsule ── */
.model-capsule {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: all .2s ease;
  flex-shrink: 0;
}
.model-capsule:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-glow);
}
.model-capsule svg {
  opacity: 0.5;
}

/* ── Composer Tools ── */
.composer-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* ── Command & Model Palette ── */
.command-palette,
.model-palette {
  position: fixed;
  width: 360px;
  max-height: min(460px, calc(100vh - 180px));
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(109, 93, 246, 0.04);
  backdrop-filter: blur(18px);
  padding: 4px;
  z-index: 9999;
  transform-origin: bottom left;
  animation: popup-in .15s ease;
}
.command-item,
.model-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease;
}
.command-item:hover,
.model-palette-item:hover {
  background: var(--hover);
}
.command-item .command-icon { display: inline-flex; width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.command-item .command-icon svg { width: 100%; height: 100%; }
.command-item .command-name {
  font-weight: 600;
  font-family: monospace;
  color: var(--text);
  min-width: 90px;
}
.command-item .command-desc {
  color: var(--muted);
  font-size: 12px;
}
.command-item.palette-active {
  background: rgba(109, 93, 251, 0.08);
  border-left: 2px solid var(--brand);
  padding-left: 10px;
}
.command-item.palette-active .command-icon { color: var(--brand); }
.command-item.palette-active .command-name { color: var(--brand); }
.command-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 2px;
}
.command-hint kbd {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 10px;
  font-family: inherit;
  color: var(--muted);
  background: var(--hover);
}
.model-palette-item .model-palette-logo {
  width: 20px;
  height: 20px;
}
.model-palette-item .model-palette-name {
  font-weight: 500;
}
.model-palette-item .model-palette-provider {
  color: var(--muted);
  font-size: 11px;
}
.model-palette-group {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.model-palette-item.palette-active {
  background: var(--hover);
}
.composer textarea {
  width: 100%;
  max-height: 160px;
  min-height: 28px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 15px;
  line-height: 1.45;
}
.composer textarea::placeholder { color: #9297a1; }

/* ── Quote Chip ── */
.quote-chip {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin: 6px 8px 0;
  border-radius: 8px;
  background: var(--brand-glow);
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  font-size: 12px;
  max-height: 36px;
  overflow: hidden;
  position: relative;
  z-index: 10;
  cursor: pointer;
}
.quote-chip:not([hidden]) {
  display: flex;
}
.quote-chip:hover {
  background: rgba(109, 93, 251, 0.15);
}
.quote-chip-icon {
  color: var(--brand);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}
.quote-chip-text {
  flex: 1;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quote-chip-remove {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.quote-chip-remove:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}
body.business-mode .quote-chip {
  background: rgba(201, 169, 110, 0.04);
  border-left: 2px solid;
  border-image: linear-gradient(to bottom, #F2D98C, #C9A96E, #7B6426) 1;
}
body.business-mode .quote-chip-text { color: #7a7870; }
.send-button, .icon-button { display: inline-grid; place-items: center; border-radius: 50%; transition: background .15s ease, transform .1s ease; }
.icon-button { width: 32px; height: 32px; }
.send-button {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  color: #fff;
  background: var(--brand-gradient);
  border: none;
  box-shadow: 0 2px 8px rgba(109, 93, 251, 0.3);
}
.send-button:not(.ready) {
  color: #bbb;
  background: #eee;
  box-shadow: none;
}
.send-button.ready:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(109, 93, 251, 0.4);
}
.send-button.ready:active { transform: scale(0.96); }
.send-button[hidden] { display: none !important; }
.send-button svg { position: relative; z-index: 1; }

.stop-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
  border: none;
  position: relative;
  isolation: isolate;
  transition: background .15s ease, transform .1s ease;
}
.stop-button:hover { background: var(--brand-dark); transform: scale(1.04); }
.stop-button:active { transform: scale(0.96); }
.stop-button[hidden] { display: none !important; }
.stop-button svg { position: relative; z-index: 1; }

.stop-button::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0%, var(--brand) 30%, transparent 60%);
  opacity: 0;
  z-index: -1;
  animation: none;
}

/* ── Generating state ── */
.composer.generating {
  position: relative;
}
.composer.generating textarea {
  border-color: #3b82f6;
}
.composer.generating .stop-button::before {
  opacity: 1;
  background: conic-gradient(from 0deg, transparent 0%, #60a5fa 30%, transparent 60%);
  animation: spin-glow 1.2s linear infinite;
}
@keyframes spin-glow {
  to { transform: rotate(360deg); }
}
body.business-mode .composer.generating textarea {
  border-color: rgba(212, 175, 55, 0.4);
}
body.business-mode .composer.generating .stop-button::before {
  background: conic-gradient(from 0deg, transparent 0%, var(--gold) 30%, transparent 60%);
}

/* ── Image Preview ── */
.image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 10px;
}
.image-preview:empty { display: none; }
.image-preview-chip {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.image-preview-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-preview-chip button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  cursor: pointer;
}
.image-preview-chip button:hover { background: rgba(220,38,38,.8); }

/* ── File preview ── */
.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 10px;
}
.file-preview:empty { display: none; }
.file-preview-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 12px;
  max-width: 180px;
}
.file-preview-chip .file-icon {
  font-size: 10px;
  font-weight: 700;
  color: #6366f1;
  flex-shrink: 0;
}
.file-preview-chip .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.file-preview-chip .file-remove {
  background: none;
  border: 0;
  color: #9ca3af;
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
}
.file-preview-chip .file-remove:hover { color: #ef4444; }
body.business-mode .file-preview-chip { background: #15151c; }

.attach-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #666;
  transition: background .15s ease, color .15s ease;
  flex-shrink: 0;
}
.attach-button:hover { background: var(--soft); color: #333; }
body.business-mode .attach-button { color: #5a5850; }
body.business-mode .attach-button:hover { color: var(--gold); }

/* ── Message Images ── */
.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.message.user .message-images {
  justify-content: flex-end;
  max-width: min(560px, 100%);
  margin: 0 0 8px;
}
.message-images img {
  max-width: 240px;
  max-height: 200px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  cursor: pointer;
}
.message.user .message-images img {
  width: min(560px, 58vw);
  max-width: 100%;
  max-height: 450px;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  border: none;
  box-shadow: none;
}
.message-images img:hover { opacity: 0.85; }

.message-files {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(560px, 100%);
  margin: 0 0 8px;
}
.message-file-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, 100%);
  padding: 10px 12px;
  border-radius: 14px;
  background: #f3f4f6;
  color: #111827;
}
.message-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #fff;
  color: #374151;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 auto;
}
.message-file-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.message-file-info strong {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}
.message-file-info small {
  color: #6b7280;
  font-size: 12px;
}

/* ── Conversation Search ── */
.conversation-search {
  padding: 0 8px;
  margin-bottom: 6px;
  flex: 0 0 auto;
}
.conversation-search input {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.conversation-search input:focus {
  border-color: rgba(109, 93, 251, 0.3);
  box-shadow: 0 0 0 3px rgba(109, 93, 251, 0.06);
}

/* ── Conversation Rename ── */
.conversation-rename-input {
  width: 100%;
  border: 1px solid rgba(109, 93, 251, 0.3);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  box-shadow: 0 0 0 3px rgba(109, 93, 251, 0.06);
}

/* ── Code block dark mode ── */
.inline-code {
  background: rgba(255, 182, 193, 0.3);
  padding: 2px 4px;
  border-radius: 3px;
}
body.business-mode .inline-code {
  background: rgba(201, 169, 110, .06);
  color: var(--gold);
}

/* ── Markdown spacing ── */
.bubble p { margin: 2px 0; line-height: 1.6; }
.bubble h1, .bubble h2, .bubble h3 { margin: 6px 0 2px; }
.bubble pre { margin: 4px 0; }
.bubble blockquote { margin: 2px 0; }
.bubble .katex-display { margin: 2px 0 !important; padding: 0 !important; }
.bubble .katex { font-size: 1.05em; }
.bubble ul, .bubble ol { margin: 2px 0; padding-left: 20px; }
.bubble li { margin: 1px 0; }
.bubble hr { margin: 4px 0; }

/* ── Markdown tables ── */
.bubble table {
  border-collapse: collapse;
  margin: 4px 0;
  font-size: 14px;
  width: 100%;
}
.bubble th, .bubble td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
}
.bubble th {
  background: var(--soft);
  font-weight: 600;
}
body.business-mode .bubble th {
  background: #15151c;
}

/* ── Dark mode table — premium feel ── */
body.business-mode .bubble table,
body.business-mode .synthesis-body table {
  border-collapse: separate !important;
  border-spacing: 0;
  background: rgba(18, 18, 24, 0.96);
  border: 1px solid rgba(212, 175, 55, 0.32) !important;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0,0,0,0.32), 0 0 28px rgba(212,175,55,0.06);
}
body.business-mode .bubble th,
body.business-mode .bubble td,
body.business-mode .synthesis-body th,
body.business-mode .synthesis-body td {
  border: none !important;
  border-bottom: 1px solid rgba(212, 175, 55, 0.14) !important;
  border-right: 1px solid rgba(212, 175, 55, 0.12) !important;
  padding: 16px 22px;
  text-align: left;
  line-height: 1.6;
}
body.business-mode .bubble th:last-child,
body.business-mode .bubble td:last-child,
body.business-mode .synthesis-body th:last-child,
body.business-mode .synthesis-body td:last-child { border-right: none !important; }
body.business-mode .bubble tr:last-child td,
body.business-mode .synthesis-body tr:last-child td { border-bottom: none !important; }
body.business-mode .bubble th,
body.business-mode .synthesis-body th {
  background: rgba(212, 175, 55, 0.08) !important;
  color: #f0d98c;
  font-weight: 700;
  border-bottom: 1px solid rgba(212, 175, 55, 0.26) !important;
}
body.business-mode .bubble td,
body.business-mode .synthesis-body td { color: #e8e2d2; }
body.business-mode .bubble td:first-child,
body.business-mode .synthesis-body td:first-child {
  color: #f0d98c;
  font-weight: 700;
  background: rgba(212, 175, 55, 0.035);
}
body.business-mode .bubble tr:hover td,
body.business-mode .synthesis-body tr:hover td { background: rgba(212, 175, 55, 0.055); }

/* Streaming math — hide incomplete blocks until \] arrives */
.streaming-math { display: none; }

/* ── Task list checkboxes ── */
.bubble input[type="checkbox"] {
  margin-right: 6px;
  vertical-align: middle;
}

/* ── Settings Drawer ── */
.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(17, 19, 24, .2);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade-in .2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 21;
  display: flex;
  width: min(580px, 100vw);
  height: 100vh;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(104%);
  transition: transform .28s cubic-bezier(.32, .72, 0, 1);
}
.settings-drawer.open { transform: translateX(0); }
.settings-drawer header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.settings-drawer h2, .settings-drawer p { margin: 0; }
.settings-drawer header p { color: #177245; font-size: 13px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.settings-drawer h2 { margin-top: 4px; font-size: 22px; font-weight: 600; }
.settings-drawer header small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.connection-card { display: grid; gap: 12px; }
.detected-card { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfbfc; }
.detected-card p { margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-grid label, .full-label { display: grid; gap: 6px; color: #555963; font-size: 13px; font-weight: 600; }
.settings-grid input, .settings-grid select { height: 40px; padding: 0 12px; font-size: 14px; }
.settings-grid label:nth-child(3), .settings-grid label:nth-child(4), .settings-grid label:nth-child(6) { grid-column: 1 / -1; }
.full-label textarea { min-height: 72px; padding: 10px 12px; font-size: 13px; resize: vertical; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.text-button, .primary-button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line); background: var(--soft); font-weight: 600; font-size: 13px; border-radius: 8px; transition: background .15s ease; }
.text-button:hover { background: #e8e8ec; }
.primary-button { color: #fff; border-color: var(--brand); background: var(--brand); }
.primary-button:hover { background: var(--brand-dark); }
.fetched-panel { display: grid; gap: 8px; min-height: 0; }
.fetched-models { display: grid; gap: 2px; max-height: 220px; overflow-y: auto; padding: 2px 0; }
.api-help {
  margin-top: auto;
  padding: 14px;
  color: #4a6b5a;
  background: #f2f8f5;
  border: 1px solid #d4ede4;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
}
.api-help strong { font-size: 12px; letter-spacing: 0.02em; }
.api-help p { margin-top: 4px; }

/* ── Icon base ── */
[data-icon] { display: inline-block; width: 1.12em; height: 1.12em; flex: 0 0 auto; background: currentColor; vertical-align: -0.16em; mask: var(--icon) center / contain no-repeat; -webkit-mask: var(--icon) center / contain no-repeat; }

/* ── Dark mode: Obsidian + Champagne Gold ── */
body.business-mode {
  color-scheme: dark;
  --bg: #08090C;
  --sidebar: #0e0f14;
  --hover: #1a1b22;
  --surface: #08090C;
  --soft: #15151c;
  --text: #e8e6e1;
  --muted: #7a7870;
  --line: #1e1f27;
  --brand: #C9A96E;
  --brand-light: #D4B97A;
  --brand-dark: #B8944F;
  --brand-glow: rgba(201, 169, 110, 0.12);
  --gold: #C9A96E;
  --gold-light: #D4B97A;
  --gold-bright: #F2D98C;
  --gold-dim: rgba(201, 169, 110, 0.08);
}
body.business-mode .sidebar {
  background: rgba(14, 15, 20, 0.92);
  border-right-color: rgba(30, 31, 39, 0.7);
}
body.business-mode .brand {
  background: linear-gradient(135deg, rgba(201, 169, 110, 0.08) 0%, rgba(201, 169, 110, 0.03) 100%);
  border-bottom-color: rgba(30, 31, 39, 0.6);
}
body.business-mode .brand-text small { color: #5a5850; }
body.business-mode .new-chat-btn {
  background: linear-gradient(135deg, #C9A96E 0%, #D4B97A 100%);
  color: #08090C;
  border: none;
  box-shadow: 0 8px 20px rgba(201, 169, 110, 0.2);
}
body.business-mode .new-chat-btn:hover {
  box-shadow: 0 12px 28px rgba(201, 169, 110, 0.3);
}
body.business-mode .model-status-summary { color: #5a5850; }
body.business-mode .tiny-icon-btn { color: #5a5850; }
body.business-mode .tiny-icon-btn:hover { background: rgba(201, 169, 110, 0.06); color: #b0aea6; }
body.business-mode .model-more-menu {
  background: #15151c;
  border-color: rgba(212, 175, 55, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
body.business-mode .model-more-item { color: #b0aea6; }
body.business-mode .model-more-item:hover { background: rgba(201, 169, 110, 0.06); color: var(--gold-light); }
body.business-mode .model-search input {
  background: #111116;
  border-color: transparent;
  color: #e8e6e1;
}
body.business-mode .model-search input:focus { border-color: rgba(212, 175, 55, 0.4); background: #15151c; }
body.business-mode .model-search input::placeholder { color: #5a5850; }
body.business-mode .sidebar-bottom-row .nav-item { color: #b0aea6; }
body.business-mode .nav-item, body.business-mode .ghost-button { color: #b0aea6; }
body.business-mode .conversation-section { border-top-color: rgba(212, 175, 55, 0.08); }
body.business-mode .sidebar-bottom { border-top-color: rgba(212, 175, 55, 0.08); }
body.business-mode .topbar-mode { color: #e8e6e1; }
body.business-mode .topbar-mode-dot { background: var(--gold); }
body.business-mode .topbar-chip {
  border-color: rgba(212, 175, 55, 0.15);
  background: rgba(201, 169, 110, 0.06);
  color: #b0aea6;
}
body.business-mode .topbar-chip-more {
  border-color: rgba(212, 175, 55, 0.15);
  color: #5a5850;
}
body.business-mode .topbar-chip-more:hover {
  border-color: rgba(212, 175, 55, 0.4);
  color: var(--gold);
}
body.business-mode .topbar-api-status {
  background: rgba(201, 169, 110, 0.06);
  color: #5a5850;
}
body.business-mode .topbar-api-dot { background: #333; }
body.business-mode .topbar-api-status.connected .topbar-api-dot {
  background: var(--gold);
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.4);
}
body.business-mode .topbar-api-status.connected { color: var(--gold); }
body.business-mode .topbar-more-menu {
  background: #111116;
  border-color: rgba(212, 175, 55, 0.24);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
body.business-mode .topbar-more-item { color: #b0aea6; }
body.business-mode .topbar-more-item:hover { background: rgba(201, 169, 110, 0.08); }
body.business-mode .menu-sep { background: rgba(212, 175, 55, 0.1); }
body.business-mode .danger-item { color: rgba(255, 120, 120, 0.85); }
body.business-mode .danger-item:hover { background: rgba(255, 80, 80, 0.08); }
body.business-mode .model-item { color: #a8a69e; }
body.business-mode .settings-entry {
  border-color: rgba(212, 175, 55, 0.32);
  background: rgba(201, 169, 110, 0.06);
  color: var(--gold);
}
body.business-mode .settings-entry:hover { background: rgba(201, 169, 110, 0.1); border-color: rgba(212, 175, 55, 0.48); }
body.business-mode .detected-card, body.business-mode .settings-grid input, body.business-mode .settings-grid select, body.business-mode .full-label textarea { background: #111116; }
body.business-mode .composer {
  background: #111116;
  border: 1px solid rgba(212, 175, 55, 0.28);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.3),
    0 0 0 4px rgba(212, 175, 55, 0.04);
}
body.business-mode .composer:focus-within {
  border-color: rgba(212, 175, 55, 0.55);
  background: #111116;
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.35),
    0 0 0 4px rgba(212, 175, 55, 0.08);
}
body.business-mode .model-capsule {
  border-color: rgba(212, 175, 55, 0.2);
  background: rgba(201, 169, 110, 0.06);
  color: #7a7870;
}
body.business-mode .model-capsule:hover {
  border-color: rgba(212, 175, 55, 0.4);
  color: var(--gold);
  background: rgba(201, 169, 110, 0.1);
}
body.business-mode .command-palette,
body.business-mode .model-palette {
  background: radial-gradient(circle at 50% 0%, rgba(212,175,55,0.10), transparent 42%), rgba(18,18,24,0.96);
  border: 1px solid rgba(212, 175, 55, 0.18);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45), 0 0 50px rgba(212, 175, 55, 0.08);
  backdrop-filter: blur(18px);
  color: #f3efe3;
}
body.business-mode .command-item:hover,
body.business-mode .model-palette-item:hover {
  background: rgba(201, 169, 110, 0.06);
}
body.business-mode .command-item.palette-active {
  background: rgba(201, 169, 110, 0.08);
  border-left-color: #C9A96E;
}
body.business-mode .command-item.palette-active .command-icon { color: var(--gold); }
body.business-mode .command-item.palette-active .command-name { color: var(--gold); }
body.business-mode .command-hint { border-top-color: rgba(212, 175, 55, 0.1); }
body.business-mode .command-hint kbd { border-color: rgba(212, 175, 55, 0.15); background: rgba(201, 169, 110, 0.05); }
body.business-mode .bubble {
  background: #18181f;
  border: 1px solid rgba(201, 169, 110, 0.18);
  border-left: 3px solid #C9A96E;
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.25),
    0 0 20px rgba(212, 175, 55, 0.05);
}
body.business-mode .message:not(.user) .bubble:hover {
  border-color: rgba(201, 169, 110, 0.32);
  border-left-color: #F2D98C;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 28px rgba(212, 175, 55, 0.07);
}
body.business-mode .message.user .bubble {
  color: #f5f4f0;
  background: #24242b;
  border: none;
  box-shadow: none;
}
body.business-mode .message.user .bubble:hover {
  border: none;
  box-shadow: none;
}
body.business-mode .message.user .message-actions button:hover {
  color: #f5f4f0;
  background: rgba(255, 255, 255, 0.08);
}
body.business-mode .message-file-card {
  background: #24242b;
  color: #f5f4f0;
}
body.business-mode .message-file-icon {
  background: #18181f;
  color: #d7c28a;
}
body.business-mode .message-file-info small {
  color: rgba(232, 226, 210, 0.58);
}
body.business-mode .bubble, body.business-mode .composer textarea { color: #e8e6e1; }
body.business-mode .composer-wrap h1 { color: #5a5850; }
body.business-mode .model-item:hover { background: rgba(201, 169, 110, 0.04); }
body.business-mode .model-item.active {
  background: rgba(201, 169, 110, 0.04);
  border-left-color: #C9A96E;
  color: var(--gold-light);
}
body.business-mode .nav-item.active {
  background: rgba(201, 169, 110, 0.04);
  color: var(--gold-light);
}
body.business-mode ::-webkit-scrollbar-thumb { background: rgba(212, 175, 55, 0.22); }
body.business-mode ::-webkit-scrollbar-thumb:hover { background: rgba(212, 175, 55, 0.35); }
body.business-mode .settings-backdrop { background: rgba(0,0,0,.55); }
body.business-mode .api-help { background: rgba(201, 169, 110, 0.04); border-color: rgba(212, 175, 55, 0.2); color: var(--gold); }
body.business-mode .multi-select-bar { background: #111116; }
body.business-mode .model-checkbox { border-color: #2a2b33; }
body.business-mode .model-checkbox.checked { background: var(--gold); border-color: var(--gold); }
body.business-mode .conversation-item { color: #b0aea6; }
body.business-mode .conversation-item:hover { background: rgba(201, 169, 110, 0.04); }
body.business-mode .conversation-item.active { background: rgba(201, 169, 110, 0.05); color: var(--gold-light); }
body.business-mode .conversation-item-time { color: #5a5850; }
body.business-mode .send-button {
  background: linear-gradient(135deg, #F2D98C 0%, #C9A96E 50%, #B8944F 100%);
  color: #08090C;
  border: none;
  box-shadow: 0 2px 12px rgba(212, 175, 55, 0.3);
}
body.business-mode .send-button:not(.ready) { color: #555; background: #15151c; box-shadow: none; }
body.business-mode .send-button.ready:hover { box-shadow: 0 4px 18px rgba(212, 175, 55, 0.4); }
body.business-mode .mobile-header {
  background: rgba(14, 15, 20, 0.92);
  border-bottom-color: rgba(30, 31, 39, 0.6);
}
body.business-mode .stop-button { background: rgba(201, 169, 110, 0.12); color: var(--gold); border: 1px solid rgba(212, 175, 55, 0.28); }
body.business-mode .stop-button:hover { background: rgba(201, 169, 110, 0.2); border-color: rgba(212, 175, 55, 0.48); }
body.business-mode .empty-state h1 { color: #e8e6e1; }
body.business-mode .empty-subtitle { color: #7a7870; }
body.business-mode .empty-status-capsule {
  background: rgba(201, 169, 110, 0.06);
  color: #7a7870;
}
body.business-mode .capsule-dot {
  background: var(--gold);
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.4);
}
body.business-mode .capsule-sep { color: #3a3830; }
body.business-mode .quick-card {
  border-color: rgba(212, 175, 55, 0.20);
  background: #111116;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
body.business-mode .quick-card:hover {
  border-color: rgba(212, 175, 55, 0.35);
  box-shadow: 0 14px 34px rgba(212, 175, 55, 0.10);
  transform: translateY(-2px);
}
body.business-mode .quick-card-icon {
  background: rgba(201, 169, 110, 0.1);
  color: var(--gold);
}
body.business-mode .quick-card-text strong { color: #F4EFE3; }
body.business-mode .quick-card-text small { color: rgba(232, 226, 210, 0.54); }
body.business-mode .status-dot {
  background: #111116;
  color: #5a5850;
}
body.business-mode .status-dot-indicator { background: #333; }
body.business-mode .status-dot.connected .status-dot-indicator { background: var(--gold); box-shadow: 0 0 8px rgba(212, 175, 55, 0.4); }
body.business-mode .status-dot.connected { color: var(--gold); }

/* ── Synthesis ── */
.synthesis-wrap { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 820px; padding: 12px 0; animation: fade-in-up .3s ease; }
.synthesis-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border: 1px solid rgba(109,93,251,0.2); border-radius: 24px; background: rgba(109,93,251,0.06); color: var(--brand); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s ease; white-space: nowrap; }
.synthesis-btn:hover { background: rgba(109,93,251,0.12); border-color: rgba(109,93,251,0.35); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(109,93,251,0.1); }
.synthesis-btn .synthesis-icon { font-size: 14px; }
.synthesis-select { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 12px; outline: none; max-width: 180px; }
.synthesis-select:focus { border-color: var(--brand); }
.synthesis-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.synthesis-card { width: 100%; max-width: 820px; border: 1px solid rgba(109,93,251,0.18); border-left: 3px solid var(--brand); border-radius: 14px; background: rgba(109,93,251,0.02); flex-shrink: 0; align-self: center; }
.synthesis-header { padding: 16px 20px 12px; border-bottom: 1px solid rgba(109,93,251,0.08); }
.synthesis-title { font-size: 15px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.synthesis-title .synthesis-icon { font-size: 16px; }
.synthesis-subtitle { font-size: 12px; color: var(--muted); margin-top: 4px; }
.synthesis-body { padding: 16px 20px; font-size: 14px; line-height: 1.7; color: var(--text); transition: max-height .3s ease; }
.synthesis-body p { margin: 2px 0; }
.synthesis-body h1, .synthesis-body h2, .synthesis-body h3 { margin: 8px 0 4px; }
.synthesis-body ul, .synthesis-body ol { margin: 4px 0; padding-left: 20px; }
.synthesis-body li { margin: 2px 0; }
.synthesis-body strong { font-weight: 600; }
.synthesis-body hr { margin: 8px 0; border: none; border-top: 1px solid var(--line); }
.synthesis-body.collapsed::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 2.5em; background: linear-gradient(transparent, var(--surface, #fff)); pointer-events: none; }
body.business-mode .synthesis-body.collapsed::after { background: linear-gradient(transparent, var(--surface, #08090C)); }
.synthesis-actions { display: flex; gap: 4px; padding: 10px 20px; border-top: 1px solid rgba(109,93,251,0.06); }
.synthesis-actions button { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 6px; font-size: 12px; color: var(--muted); transition: all .15s ease; }
.synthesis-actions button:hover { color: var(--brand); background: var(--brand-glow); }
.synthesis-actions button [data-icon] { width: 13px; height: 13px; }
.synthesis-actions .synthesis-select { height: 28px; max-width: 160px; font-size: 11px; padding: 0 6px; }
body.business-mode .synthesis-btn { background: rgba(201,169,110,0.06); border-color: rgba(212,175,55,0.2); color: var(--gold); }
body.business-mode .synthesis-btn:hover { background: rgba(201,169,110,0.12); border-color: rgba(212,175,55,0.4); box-shadow: 0 4px 12px rgba(212,175,55,0.08); }
body.business-mode .synthesis-select { background: #111116; border-color: rgba(212,175,55,0.2); color: #e8e6e1; }
body.business-mode .synthesis-card { border: 1px solid rgba(201,169,110,0.2); border-left: 3px solid #C9A96E; background: rgba(201,169,110,0.02); }
body.business-mode .synthesis-header { border-bottom-color: rgba(201,169,110,0.08); }
body.business-mode .synthesis-title { color: #e8e6e1; }
body.business-mode .synthesis-subtitle { color: #7a7870; }
body.business-mode .synthesis-body { color: #e8e6e1; }
body.business-mode .synthesis-body hr { border-top-color: #1e1f27; }
body.business-mode .synthesis-actions { border-top-color: rgba(201,169,110,0.06); }
body.business-mode .synthesis-actions button { color: #7a7870; }
body.business-mode .synthesis-actions button:hover { color: var(--gold); background: rgba(201,169,110,0.06); }

/* ── Theme Picker ── */
.theme-picker-popup {
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 4px;
  animation: popup-in .15s ease;
}
.theme-option {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  transition: background .15s ease;
  border: 1px solid transparent;
}
.theme-option:hover { background: var(--hover); }
.theme-option.active {
  background: var(--brand-glow);
  border-color: rgba(109, 93, 251, 0.2);
}
.theme-option-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.theme-option-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
body.business-mode .theme-picker-popup {
  background: #15151c;
  border-color: rgba(212, 175, 55, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
body.business-mode .theme-option:hover { background: rgba(201, 169, 110, 0.06); }
body.business-mode .theme-option.active {
  background: rgba(201, 169, 110, 0.08);
  border-color: rgba(212, 175, 55, 0.2);
}

/* ── Mobile Header ── */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(249, 249, 251, 0.85);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid rgba(232, 232, 236, 0.5);
}
.mobile-header .icon-button { width: 36px; height: 36px; }
.mobile-title { font-size: 16px; font-weight: 700; }
.sidebar-close-btn { display: none; margin-left: auto; }

@media (max-width: 760px) {
  .mobile-header { display: flex; }
  .app-shell { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .sidebar {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: var(--sidebar);
  }
  .sidebar.mobile-open { display: flex; }
  .sidebar-close-btn { display: inline-grid; }
  .topbar { padding: 8px 12px; }
  .ghost-button { display: none; }
  .conversation { padding: 16px 14px 120px; }
  .message.user .message-images img {
    width: min(100%, 78vw);
    max-height: 320px;
  }
  .composer-wrap { right: 10px; bottom: 12px; left: 10px; gap: 14px; }
  .composer { border-radius: 20px; }
  .composer-inner { min-height: 46px; padding: 6px 6px 6px 4px; }
  .model-capsule { display: none; }
  .composer textarea { font-size: 15px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid label:nth-child(3), .settings-grid label:nth-child(4), .settings-grid label:nth-child(6) { grid-column: auto; }
  .settings-drawer { width: 100vw; }
  .quick-cards { grid-template-columns: 1fr; }
  .quick-card { max-width: none; }
  .model-palette { width: min(360px, calc(100vw - 20px)); }
}

/* ── Selection Popup ── */
.selection-popup {
  position: fixed;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid rgba(229, 231, 235, 0.6);
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.04), 0 10px 30px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  padding: 0;
  max-width: 360px;
  min-width: 220px;
  animation: popup-in .2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
@keyframes popup-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Preview */
.selection-preview { padding: 0; border-bottom: 1px solid var(--line, #e5e7eb); }
.selection-preview-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted, #6b7280); padding: 8px 12px 0; }
.selection-preview-text {
  font-size: 12px;
  color: var(--text, #111);
  line-height: 1.5;
  max-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  padding: 4px 12px 8px;
  word-break: break-all;
}

/* Operation buttons */
.selection-ops {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.selection-op {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  background: var(--surface, #fff);
  color: var(--text, #111);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.selection-op:hover { color: var(--brand, #6d5dfb); border-color: var(--brand, #6d5dfb); background: rgba(109,93,251,0.06); }

/* Model bar */
.selection-model-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text, #111);
  transition: background .15s ease;
}
.selection-model-bar:hover { background: var(--hover, rgba(0,0,0,0.03)); }
.selection-model-label { color: var(--muted, #6b7280); }
.selection-model-name { font-weight: 500; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection-model-arrow { color: var(--muted, #6b7280); font-size: 10px; margin-left: auto; }

/* Model menu */
.selection-model-menu {
  max-height: 280px;
  overflow-y: auto;
  border-top: 1px solid var(--line, #e5e7eb);
  padding: 4px 0;
}
.selection-model-section {
  padding: 6px 12px 2px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted, #6b7280);
}
.selection-model-item {
  padding: 6px 12px;
  cursor: pointer;
  transition: background .12s ease;
  position: relative;
  min-height: 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.selection-model-item:hover { background: var(--hover, rgba(0,0,0,0.04)); }
.selection-model-item.active {
  background: rgba(109,93,251,0.06);
  border-left: 2px solid var(--brand, #6d5dfb);
  padding-left: 10px;
}
.selection-model-item.active::after {
  content: "✓";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand, #6d5dfb);
  font-size: 13px;
  font-weight: 600;
}
.selection-model-item-name { font-size: 13px; font-weight: 500; color: var(--text, #111); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection-model-family { flex-direction: row !important; align-items: center; gap: 8px; }
.selection-model-family .selection-model-item-name { flex: 1; min-width: 0; }
.selection-model-family-count { font-size: 11px; color: var(--muted, #6b7280); flex-shrink: 0; }
.selection-model-family-count::after { content: " ›"; }
.selection-model-item.current-model { min-height: 36px; padding: 4px 12px; }
.selection-model-item-sub { font-size: 11px; color: var(--muted, #6b7280); margin-top: 1px; }

/* Model header with back */
.selection-model-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line, #e5e7eb); }
.selection-model-back { font-size: 12px; color: var(--brand, #6d5dfb); cursor: pointer; flex-shrink: 0; }
.selection-model-back:hover { text-decoration: underline; }
.selection-model-header-title { font-size: 12px; font-weight: 500; color: var(--text, #111); }

/* Search trigger / input */
.selection-model-search-trigger {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--brand, #6d5dfb);
  cursor: pointer;
  border-top: 1px solid var(--line, #e5e7eb);
  margin-top: 4px;
}
.selection-model-search-trigger:hover { background: rgba(109,93,251,0.04); }
.selection-model-search-input {
  width: 100%;
  height: 28px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 12px;
  background: var(--surface, #fff);
  color: var(--text, #111);
  outline: none;
}
.selection-model-search-input:focus { border-color: var(--brand, #6d5dfb); }

/* ── Dark mode ── */
body.business-mode .selection-popup {
  background: rgba(17, 17, 22, 0.96);
  border-color: rgba(212, 175, 55, 0.2);
  box-shadow: 0 4px 6px rgba(0,0,0,0.2), 0 10px 30px rgba(0,0,0,0.35), 0 0 20px rgba(212,175,55,0.04);
}
body.business-mode .selection-preview { border-color: #23242c; }
body.business-mode .selection-preview-label { color: #7a7870; }
body.business-mode .selection-preview-text { color: #e8e6e1; }
body.business-mode .selection-ops { border-color: #23242c; }
body.business-mode .selection-op { background: #111116; border-color: rgba(212,175,55,0.15); color: #e8e6e1; }
body.business-mode .selection-op:hover { color: var(--gold); border-color: var(--gold); background: rgba(201,169,110,0.06); }
body.business-mode .selection-model-bar { color: #e8e6e1; }
body.business-mode .selection-model-bar:hover { background: rgba(201,169,110,0.04); }
body.business-mode .selection-model-label { color: #7a7870; }
body.business-mode .selection-model-arrow { color: #7a7870; }
body.business-mode .selection-model-menu { border-color: #23242c; }
body.business-mode .selection-model-section { color: #7a7870; }
body.business-mode .selection-model-item:hover { background: rgba(201,169,110,0.06); }
body.business-mode .selection-model-item.active {
  background: rgba(201,169,110,0.06);
  border-left-color: var(--gold);
}
body.business-mode .selection-model-item.active::after { color: var(--gold); }
body.business-mode .selection-model-item-name { color: #e8e6e1; }
body.business-mode .selection-model-item-sub { color: #7a7870; }
body.business-mode .selection-model-family-count { color: #7a7870; }
body.business-mode .selection-model-family-count::after { color: #7a7870; }
body.business-mode .selection-model-item.current-model { background: rgba(201,169,110,0.04); }
body.business-mode .selection-model-item { min-height: 44px; }
body.business-mode .selection-model-header { border-color: #23242c; }
body.business-mode .selection-model-back { color: var(--gold); }
body.business-mode .selection-model-header-title { color: #e8e6e1; }
body.business-mode .selection-model-search-trigger { color: var(--gold); border-color: #23242c; }
body.business-mode .selection-model-search-trigger:hover { background: rgba(201,169,110,0.04); }
body.business-mode .selection-model-search-input { background: #111116; border-color: rgba(212,175,55,0.2); color: #e8e6e1; }
body.business-mode .selection-model-search-input:focus { border-color: var(--gold); }

/* ── Translation Panel ── */
.selection-popup:has(.tp-panel) { max-width: 420px; min-width: 320px; }
.tp-header { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line, #e5e7eb); }
.tp-back { background: none; border: none; color: var(--brand, #6d5dfb); font-size: 13px; cursor: pointer; padding: 0; font-weight: 500; }
.tp-back:hover { opacity: 0.8; }
.tp-title { font-size: 14px; font-weight: 600; color: var(--text, #111); }

.tp-source { padding: 10px 14px; }
.tp-label { font-size: 11px; color: var(--muted, #9ca3af); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.tp-source-text {
  font-size: 13px; color: var(--muted, #6b7280); line-height: 1.6;
  background: #f8f7ff; border-left: 3px solid var(--brand, #6d5dfb);
  border-radius: 0 8px 8px 0; padding: 10px 12px;
  max-height: 72px; overflow-y: auto; word-break: break-all;
}
.tp-expand { background: none; border: none; color: var(--brand, #6d5dfb); font-size: 12px; cursor: pointer; padding: 4px 0 0; }
.tp-expand:hover { text-decoration: underline; }

.tp-result-section { padding: 0 14px 8px; }
.tp-result {
  font-size: 13px; color: var(--text, #111); line-height: 1.7;
  background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  padding: 14px 16px; max-height: 180px; overflow-y: auto; min-height: 44px;
  word-break: break-word;
}
.tp-loading { color: var(--muted, #9ca3af); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.tp-loading::before {
  content: ""; width: 14px; height: 14px; border: 2px solid var(--line, #e5e7eb);
  border-top-color: var(--brand, #6d5dfb); border-radius: 50%;
  animation: tp-spin 0.8s linear infinite;
}
@keyframes tp-spin { to { transform: rotate(360deg); } }
.tp-error { color: #ef4444; font-size: 13px; }
.tp-error-detail { color: var(--muted, #9ca3af); font-size: 12px; margin-top: 4px; }

.tp-actions { display: flex; gap: 6px; padding: 8px 14px; align-items: center; }
.tp-btn {
  height: 30px; padding: 0 14px; border-radius: 8px; font-size: 12px;
  cursor: pointer; transition: all 0.15s; font-weight: 500; border: none;
}
.tp-btn:disabled { opacity: 0.4; cursor: default; }
.tp-btn-primary { background: var(--brand, #6d5dfb); color: #fff; }
.tp-btn-primary:hover:not(:disabled) { background: #5a4bd6; }
.tp-btn-text { background: none; color: var(--muted, #6b7280); }
.tp-btn-text:hover:not(:disabled) { color: var(--text, #111); }

.tp-model-info { padding: 6px 14px 10px; font-size: 11px; color: var(--muted, #9ca3af); }

/* ── Translation Panel — Dark Mode ── */
body.business-mode .tp-header { border-color: rgba(212,175,55,0.15); }
body.business-mode .tp-back { color: var(--gold); }
body.business-mode .tp-title { color: #e8e6e1; }
body.business-mode .tp-source-text { background: #16171d; border-left-color: var(--gold); color: #b0aca4; }
body.business-mode .tp-expand { color: var(--gold); }
body.business-mode .tp-result { background: #121218; border-color: rgba(212,175,55,0.25); color: #e8e6e1; }
body.business-mode .tp-loading::before { border-color: #23242c; border-top-color: var(--gold); }
body.business-mode .tp-btn-primary { background: transparent; border: 1px solid rgba(212,175,55,0.45); color: var(--gold); }
body.business-mode .tp-btn-primary:hover:not(:disabled) { background: rgba(201,169,110,0.1); border-color: rgba(212,175,55,0.6); }
body.business-mode .tp-btn-text { color: #b0aca4; }
body.business-mode .tp-btn-text:hover:not(:disabled) { color: #e8e6e1; }
body.business-mode .tp-model-info { color: #6b6660; }

/* ── Send Target Panel ── */
.send-target-panel {
  position: fixed;
  max-height: 420px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px; box-shadow: 0 8px 28px rgba(0,0,0,0.12);
  padding: 6px; z-index: 9999; animation: popup-in .15s ease;
  width: 360px;
}
.st-section-title {
  padding: 10px 10px 4px; font-size: 11px; font-weight: 600;
  color: var(--muted, #9ca3af); text-transform: uppercase; letter-spacing: 0.04em;
}
.st-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; transition: background 0.12s;
}
.st-item:hover { background: #f3f0ff; }
.st-item-active { background: #f8f6ff; border-left: 3px solid var(--brand, #6d5dfb); padding-left: 9px; }
.st-check { color: var(--brand, #6d5dfb); font-weight: 700; font-size: 14px; flex-shrink: 0; }
.st-item-text { flex: 1; min-width: 0; }
.st-item-name { font-size: 13px; font-weight: 600; color: var(--text, #111); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-item-desc { font-size: 11px; color: var(--muted, #9ca3af); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-item-model { gap: 8px; }
.st-model-logo { width: 22px; height: 22px; flex-shrink: 0; display: flex; align-items: center; }
.st-model-logo .model-logo { width: 22px; height: 22px; }
.st-model-name { font-size: 13px; font-weight: 500; color: var(--text, #111); }
.st-manage-link {
  padding: 10px 12px; font-size: 12px; color: var(--brand, #6d5dfb);
  cursor: pointer; border-top: 1px solid var(--line, #e5e7eb);
  margin-top: 4px; text-align: center; font-weight: 500;
}
.st-manage-link:hover { background: #f3f0ff; border-radius: 0 0 10px 10px; }

/* Toast */
.app-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 13px; z-index: 9999; opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
.app-toast.show { opacity: 1; }

/* Dark mode — Send Target Panel */
body.business-mode .send-target-panel { background: #16171d; border-color: rgba(212,175,55,0.2); box-shadow: 0 8px 28px rgba(0,0,0,0.35), 0 0 20px rgba(212,175,55,0.04); }
body.business-mode .st-section-title { color: #6b6660; }
body.business-mode .st-item:hover { background: rgba(201,169,110,0.06); }
body.business-mode .st-item-active { background: rgba(201,169,110,0.08); border-left-color: var(--gold); }
body.business-mode .st-check { color: var(--gold); }
body.business-mode .st-item-name { color: #e8e6e1; }
body.business-mode .st-item-desc { color: #6b6660; }
body.business-mode .st-model-name { color: #e8e6e1; }
body.business-mode .st-manage-link { color: var(--gold); border-color: rgba(212,175,55,0.15); }
body.business-mode .st-manage-link:hover { background: rgba(201,169,110,0.06); }

/* ── Mention Tags ── */
.mention-tags { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 8px 0; }
.mention-tag {
  display: inline-flex; align-items: center; gap: 4px; height: 26px;
  padding: 0 8px 0 4px; border-radius: 13px; font-size: 12px;
  background: #f3f0ff; border: 1px solid #e8e0f6; color: var(--text, #111);
}
.mention-tag-logo { width: 16px; height: 16px; display: flex; align-items: center; }
.mention-tag-logo .model-logo, .mention-tag-logo .logo-fallback { width: 16px; height: 16px; font-size: 7px; }
.mention-tag-name { font-weight: 500; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-tag-remove {
  width: 14px; height: 14px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 11px; color: var(--muted, #9ca3af); cursor: pointer;
  margin-left: 2px;
}
.mention-tag-remove:hover { background: #e8e0f6; color: var(--text, #111); }

/* ── @ Palette ── */
.at-palette {
  position: absolute; bottom: calc(100% + 10px); left: 0;
  max-width: 320px; max-height: 360px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 4px; z-index: 20; animation: popup-in .15s ease;
}
.at-section-title {
  padding: 8px 10px 3px; font-size: 11px; font-weight: 600;
  color: var(--muted, #9ca3af); text-transform: uppercase; letter-spacing: 0.04em;
}
.at-model-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer; transition: background 0.12s;
}
.at-model-item:hover { background: #f3f0ff; }
.at-model-item.palette-active { background: #f3f0ff; }
.at-model-logo { width: 22px; height: 22px; flex-shrink: 0; display: flex; align-items: center; }
.at-model-logo .model-logo { width: 22px; height: 22px; }
.at-model-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.at-model-name { font-size: 13px; font-weight: 600; color: var(--text, #111); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-model-provider { font-size: 11px; color: var(--muted, #9ca3af); }
.at-search-hint { padding: 8px 10px; font-size: 12px; color: var(--muted, #9ca3af); cursor: default; }
.at-empty { padding: 12px; text-align: center; font-size: 13px; color: var(--muted, #9ca3af); }

/* Dark mode — Mention Tags & @ Palette */
body.business-mode .mention-tag { background: rgba(201,169,110,0.08); border-color: rgba(212,175,55,0.2); color: #e8e6e1; }
body.business-mode .mention-tag-remove:hover { background: rgba(201,169,110,0.15); color: #e8e6e1; }
body.business-mode .at-palette { background: #16171d; border-color: rgba(212,175,55,0.2); box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
body.business-mode .at-model-item:hover, body.business-mode .at-model-item.palette-active { background: rgba(201,169,110,0.06); }
body.business-mode .at-model-name { color: #e8e6e1; }
body.business-mode .at-model-provider { color: #6b6660; }
body.business-mode .at-section-title { color: #6b6660; }
body.business-mode .at-search-hint { color: #6b6660; }

/* ── Synthesis Model Selector ── */
.syn-model-selector { position: relative; display: inline-block; }
.syn-model-btn {
  height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px;
  font-weight: 500; cursor: pointer; transition: all 0.15s;
  background: #fff; border: 1px solid var(--line, #e5e7eb); color: var(--text, #111);
  white-space: nowrap; display: inline-flex; align-items: center; gap: 4px;
}
.syn-model-btn:hover { border-color: var(--brand, #6d5dfb); background: #f8f6ff; }
.syn-model-popover {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  min-width: 200px; max-height: 320px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 4px 0; z-index: 20; animation: popup-in .15s ease;
}
.syn-model-popover-title {
  padding: 10px 14px 6px; font-size: 11px; font-weight: 600;
  color: var(--muted, #9ca3af); text-transform: uppercase; letter-spacing: 0.04em;
}
.syn-model-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  cursor: pointer; transition: background 0.12s; position: relative;
}
.syn-model-item:hover { background: #f3f0ff; }
.syn-model-item.active {
  background: rgba(109,93,251,0.06);
  border-left: 2px solid var(--brand, #6d5dfb);
  padding-left: 12px;
}
.syn-model-item-info { flex: 1; min-width: 0; }
.syn-model-item-name {
  font-size: 13px; font-weight: 500; color: var(--text, #111);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.syn-model-item-check {
  color: var(--brand, #6d5dfb); font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.syn-model-hint {
  padding: 8px 14px; font-size: 11px; color: var(--muted, #9ca3af);
  border-top: 1px solid var(--line, #e5e7eb); margin-top: 4px;
}

/* Dark mode — Synthesis Model Selector */
body.business-mode .syn-model-btn { background: #16171d; border-color: rgba(212,175,55,0.2); color: #e8e6e1; }
body.business-mode .syn-model-btn:hover { border-color: var(--gold); background: rgba(201,169,110,0.06); }
body.business-mode .syn-model-popover { background: #16171d; border-color: rgba(212,175,55,0.2); box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 20px rgba(212,175,55,0.04); }
body.business-mode .syn-model-popover-title { color: #6b6660; }
body.business-mode .syn-model-item:hover { background: rgba(201,169,110,0.06); }
body.business-mode .syn-model-item.active { background: rgba(201,169,110,0.08); border-left-color: var(--gold); }
body.business-mode .syn-model-item-name { color: #e8e6e1; }
body.business-mode .syn-model-item-check { color: var(--gold); }
body.business-mode .syn-model-hint { color: #6b6660; border-color: rgba(212,175,55,0.15); }

/* ── Account Drawer ── */
.account-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: flex-end;
  animation: fade-in .2s ease;
}
.account-drawer {
  width: 420px;
  height: calc(100vh - 24px);
  margin: 12px;
  padding: 24px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% 0%, rgba(109, 93, 246, 0.18), transparent 36%),
    linear-gradient(180deg, #151827 0%, #10131f 100%);
  border: 1px solid rgba(160, 170, 255, 0.16);
  box-shadow:
    0 30px 100px rgba(0, 0, 0, 0.36),
    0 0 60px rgba(109, 93, 246, 0.12);
  color: #f4f7ff;
  overflow-y: auto;
  animation: drawer-slide-in .28s cubic-bezier(.32, .72, 0, 1);
}
@keyframes drawer-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.account-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}
.account-kicker {
  color: rgba(159, 184, 255, 0.55);
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 800;
}
.account-header h2 {
  margin: 6px 0 0;
  font-size: 28px;
  font-weight: 900;
}
.account-close {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(244,247,255,0.62);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.account-close:hover {
  background: rgba(255,255,255,0.10);
  color: #f4f7ff;
}
.account-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.07);
  margin-bottom: 18px;
}
.account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6d5df6, #38c7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 0 28px rgba(109, 93, 246, 0.35);
  flex-shrink: 0;
}
.account-email {
  font-size: 14px;
  font-weight: 800;
}
.account-role {
  margin-top: 4px;
  display: flex;
  gap: 8px;
  color: rgba(220,226,255,0.45);
  font-size: 12px;
}
.account-role span:first-child {
  color: #9fb8ff;
}
.balance-card {
  padding: 20px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 80% 20%, rgba(212, 175, 55, 0.16), transparent 40%),
    rgba(255,255,255,0.045);
  border: 1px solid rgba(212, 175, 55, 0.18);
  margin-bottom: 22px;
}
.balance-label {
  color: rgba(232, 226, 210, 0.55);
  font-size: 13px;
}
.balance-value {
  margin-top: 6px;
  color: #e8cc82;
  font-size: 48px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -1px;
  text-shadow: 0 0 30px rgba(212, 175, 55, 0.16);
}
.balance-desc {
  margin-top: 10px;
  color: rgba(232, 226, 210, 0.42);
  font-size: 12px;
}
.balance-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.balance-actions a,
.balance-actions button {
  flex: 1;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.24);
  background: rgba(212, 175, 55, 0.08);
  color: #e8cc82;
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.15s;
}
.balance-actions a:hover,
.balance-actions button:hover {
  background: rgba(212, 175, 55, 0.16);
  border-color: rgba(212, 175, 55, 0.40);
}
.account-section-title {
  color: rgba(220,226,255,0.46);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
}
.account-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.account-action-grid button {
  height: 88px;
  padding: 12px;
  border-radius: 18px;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.075);
  background: rgba(255,255,255,0.04);
  color: #f4f7ff;
  cursor: pointer;
  transition: all 0.15s;
}
.account-action-grid button:hover {
  border-color: rgba(109, 93, 246, 0.28);
  background: rgba(109, 93, 246, 0.09);
  transform: translateY(-1px);
}
.account-action-grid span {
  color: #9fb8ff;
  font-size: 18px;
}
.account-action-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}
.account-action-grid em {
  display: block;
  margin-top: 3px;
  color: rgba(220,226,255,0.38);
  font-size: 11px;
  font-style: normal;
}
.account-security {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(110, 231, 183, 0.06);
  border: 1px solid rgba(110, 231, 183, 0.12);
  color: rgba(180, 235, 210, 0.62);
  font-size: 12px;
}
.account-security span {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 999px;
  background: #6ee7b7;
  box-shadow: 0 0 12px rgba(110,231,183,0.8);
}
.logout-btn {
  width: 100%;
  height: 44px;
  margin-top: 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 95, 95, 0.22);
  background: rgba(255, 95, 95, 0.08);
  color: #ff7b7b;
  font-weight: 800;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.logout-btn:hover {
  background: rgba(255, 95, 95, 0.14);
  border-color: rgba(255, 95, 95, 0.38);
}

/* Dark mode — Account Drawer */
body.business-mode .account-overlay { background: rgba(0, 0, 0, 0.45); }

/* ── Ledger Panel (Credits History) ── */
.ledger-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in .2s ease;
}
.ledger-panel {
  width: 760px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 72px);
  border-radius: 26px;
  padding: 26px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ledger-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
  flex-shrink: 0;
}
.ledger-kicker {
  font-size: 11px;
  letter-spacing: 1.6px;
  font-weight: 900;
}
.ledger-title {
  margin: 6px 0 0;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.15;
}
.ledger-desc {
  margin-top: 8px;
  font-size: 13px;
}
.ledger-close {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.ledger-balance-card {
  padding: 20px;
  border-radius: 22px;
  margin-bottom: 18px;
  flex-shrink: 0;
}
.ledger-balance-label {
  font-size: 13px;
}
.ledger-balance-value {
  margin-top: 6px;
  font-size: 46px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -1px;
}
.ledger-balance-desc {
  margin-top: 10px;
  font-size: 12px;
}
.ledger-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-shrink: 0;
}
.ledger-tab {
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}
.ledger-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}
.ledger-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  margin-bottom: 10px;
  transition: all 0.15s;
}
.ledger-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
}
.ledger-item-main {
  flex: 1;
  min-width: 0;
}
.ledger-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.ledger-item-top strong {
  font-size: 14px;
}
.ledger-amount {
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}
.ledger-item-meta {
  margin-top: 5px;
  font-size: 12px;
}
.ledger-item-bottom {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}
.ledger-empty {
  height: 240px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px dashed;
}
.ledger-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 20px;
}
.ledger-empty strong {
  font-size: 15px;
}
.ledger-empty p {
  margin: 6px 0 0;
  font-size: 12px;
}

/* Normal mode — Ledger (body:not(.business-mode) = default fallback) */
.normal-mode .ledger-overlay,
body:not(.business-mode) .ledger-overlay {
  background: rgba(248, 250, 255, 0.72);
}
.normal-mode .ledger-panel,
body:not(.business-mode) .ledger-panel {
  background:
    radial-gradient(circle at 50% 0%, rgba(109, 93, 246, 0.10), transparent 36%),
    #ffffff;
  border: 1px solid #eef0f6;
  color: #1f2937;
  box-shadow:
    0 32px 100px rgba(15, 23, 42, 0.16),
    0 0 0 1px rgba(109, 93, 246, 0.03);
}
.normal-mode .ledger-kicker,
body:not(.business-mode) .ledger-kicker { color: #6d5df6; }
.normal-mode .ledger-title,
body:not(.business-mode) .ledger-title { color: #1f2937; }
.normal-mode .ledger-desc,
body:not(.business-mode) .ledger-desc { color: #8a8f9c; }
.normal-mode .ledger-close,
body:not(.business-mode) .ledger-close {
  background: #f5f3ff;
  color: #6d5df6;
  border: 1px solid rgba(109, 93, 246, 0.12);
}
.normal-mode .ledger-close:hover,
body:not(.business-mode) .ledger-close:hover {
  background: #ede9ff;
}
.normal-mode .ledger-balance-card,
body:not(.business-mode) .ledger-balance-card {
  background:
    radial-gradient(circle at 82% 20%, rgba(109, 93, 246, 0.12), transparent 42%),
    #f8f7ff;
  border: 1px solid rgba(109, 93, 246, 0.12);
}
.normal-mode .ledger-balance-label,
body:not(.business-mode) .ledger-balance-label,
.normal-mode .ledger-balance-desc,
body:not(.business-mode) .ledger-balance-desc { color: #8a8f9c; }
.normal-mode .ledger-balance-value,
body:not(.business-mode) .ledger-balance-value { color: #6d5df6; }
.normal-mode .ledger-tab,
body:not(.business-mode) .ledger-tab {
  border: 1px solid #eef0f6;
  background: #ffffff;
  color: #8a8f9c;
}
.normal-mode .ledger-tab.active,
body:not(.business-mode) .ledger-tab.active {
  background: #f1efff;
  border-color: rgba(109, 93, 246, 0.20);
  color: #6d5df6;
}
.normal-mode .ledger-item,
body:not(.business-mode) .ledger-item {
  background: #ffffff;
  border: 1px solid #eef0f6;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.normal-mode .ledger-item:hover,
body:not(.business-mode) .ledger-item:hover {
  border-color: rgba(109, 93, 246, 0.18);
  box-shadow: 0 12px 28px rgba(109, 93, 246, 0.08);
}
.normal-mode .ledger-item-icon,
body:not(.business-mode) .ledger-item-icon {
  background: #f1efff;
  color: #6d5df6;
}
.normal-mode .ledger-item-top strong,
body:not(.business-mode) .ledger-item-top strong { color: #1f2937; }
.normal-mode .ledger-amount.income,
body:not(.business-mode) .ledger-amount.income { color: #16a06a; }
.normal-mode .ledger-amount.expense,
body:not(.business-mode) .ledger-amount.expense { color: #6d5df6; }
.normal-mode .ledger-item-meta,
body:not(.business-mode) .ledger-item-meta { color: #8a8f9c; }
.normal-mode .ledger-item-bottom,
body:not(.business-mode) .ledger-item-bottom { color: #a0a6b4; }
.normal-mode .ledger-empty,
body:not(.business-mode) .ledger-empty {
  border-color: #dfe3f0;
  color: #8a8f9c;
  background: #fafaff;
}
.normal-mode .ledger-empty-icon,
body:not(.business-mode) .ledger-empty-icon {
  background: #f1efff;
  color: #6d5df6;
}

/* Business mode — Ledger */
.business-mode .ledger-overlay {
  background: rgba(0, 0, 0, 0.52);
}
.business-mode .ledger-panel {
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.12), transparent 36%),
    linear-gradient(180deg, #171822 0%, #101119 100%);
  border: 1px solid rgba(212, 175, 55, 0.16);
  color: #f3efe3;
  box-shadow:
    0 32px 100px rgba(0, 0, 0, 0.42),
    0 0 60px rgba(212, 175, 55, 0.08);
}
.business-mode .ledger-kicker { color: rgba(212, 175, 55, 0.72); }
.business-mode .ledger-title { color: #f3efe3; }
.business-mode .ledger-desc { color: rgba(232, 226, 210, 0.48); }
.business-mode .ledger-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.16);
  color: rgba(232, 226, 210, 0.62);
}
.business-mode .ledger-close:hover {
  background: rgba(212, 175, 55, 0.08);
  color: #e6c875;
}
.business-mode .ledger-balance-card {
  background:
    radial-gradient(circle at 82% 20%, rgba(212, 175, 55, 0.16), transparent 42%),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(212, 175, 55, 0.18);
}
.business-mode .ledger-balance-label,
.business-mode .ledger-balance-desc { color: rgba(232, 226, 210, 0.44); }
.business-mode .ledger-balance-value {
  color: #e6c875;
  text-shadow: 0 0 28px rgba(212, 175, 55, 0.16);
}
.business-mode .ledger-tab {
  border: 1px solid rgba(212, 175, 55, 0.10);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(232, 226, 210, 0.52);
}
.business-mode .ledger-tab.active {
  background: rgba(212, 175, 55, 0.14);
  border-color: rgba(212, 175, 55, 0.24);
  color: #e6c875;
}
.business-mode .ledger-item {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.business-mode .ledger-item:hover {
  background: rgba(255, 255, 255, 0.052);
  border-color: rgba(212, 175, 55, 0.18);
}
.business-mode .ledger-item-icon {
  background: rgba(212, 175, 55, 0.10);
  color: #e6c875;
}
.business-mode .ledger-item-top strong { color: #f3efe3; }
.business-mode .ledger-amount.income { color: #6ee7b7; }
.business-mode .ledger-amount.expense { color: #e6c875; }
.business-mode .ledger-item-meta { color: rgba(232, 226, 210, 0.48); }
.business-mode .ledger-item-bottom { color: rgba(232, 226, 210, 0.34); }
.business-mode .ledger-empty {
  border-color: rgba(212, 175, 55, 0.16);
  color: rgba(232, 226, 210, 0.44);
  background: rgba(255, 255, 255, 0.025);
}
.business-mode .ledger-empty-icon {
  background: rgba(212, 175, 55, 0.10);
  color: #e6c875;
}

/* ============================================================
   Password Panel
   ============================================================ */
.password-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  animation: fade-in .2s ease;
}
.password-panel {
  width: 560px;
  max-width: calc(100vw - 40px);
  border-radius: 26px;
  padding: 26px;
  overflow: hidden;
  position: relative;
}
.password-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.password-kicker {
  font-size: 11px;
  letter-spacing: 1.6px;
  font-weight: 900;
}
.password-title {
  margin: 6px 0 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 900;
}
.password-desc {
  margin-top: 8px;
  font-size: 13px;
}
.password-close {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.password-security-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  margin-bottom: 20px;
}
.security-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  flex-shrink: 0;
}
.password-security-card strong {
  font-size: 14px;
  display: block;
}
.password-security-card p {
  margin: 4px 0 0;
  font-size: 12px;
}
.password-form {
  display: grid;
  gap: 16px;
}
.password-field span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
}
.password-field input {
  width: 100%;
  height: 52px;
  border-radius: 15px;
  padding: 0 15px;
  outline: none;
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.password-strength {
  margin-top: 18px;
}
.strength-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 8px;
}
.strength-bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
}
.strength-bar i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  transition: width .2s ease;
}
.password-strength.weak .strength-bar i { width: 33%; }
.password-strength.medium .strength-bar i { width: 66%; }
.password-strength.strong .strength-bar i { width: 100%; }
.password-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}
.password-btn {
  height: 46px;
  padding: 0 22px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: all .18s ease;
}
.password-success {
  text-align: center;
  padding: 24px 0 8px;
}
.password-success-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.password-success h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.password-success p {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.7;
}

/* Normal mode — Password */
.normal-mode .password-overlay,
body:not(.business-mode) .password-overlay {
  background: rgba(248, 250, 255, 0.72);
}
.normal-mode .password-panel,
body:not(.business-mode) .password-panel {
  background:
    radial-gradient(circle at 50% 0%, rgba(109, 93, 246, 0.10), transparent 36%),
    #ffffff;
  border: 1px solid #eef0f6;
  color: #1f2937;
  box-shadow:
    0 32px 100px rgba(15, 23, 42, 0.16),
    0 0 0 1px rgba(109, 93, 246, 0.03);
}
.normal-mode .password-kicker,
body:not(.business-mode) .password-kicker { color: #6d5df6; }
.normal-mode .password-title,
body:not(.business-mode) .password-title { color: #1f2937; }
.normal-mode .password-desc,
body:not(.business-mode) .password-desc { color: #8a8f9c; }
.normal-mode .password-close,
body:not(.business-mode) .password-close {
  background: #f5f3ff;
  color: #6d5df6;
  border: 1px solid rgba(109, 93, 246, 0.12);
}
.normal-mode .password-close:hover,
body:not(.business-mode) .password-close:hover { background: #ede9ff; }
.normal-mode .password-security-card,
body:not(.business-mode) .password-security-card {
  background: #f8f7ff;
  border: 1px solid rgba(109, 93, 246, 0.12);
}
.normal-mode .security-icon,
body:not(.business-mode) .security-icon {
  background: #f1efff;
  color: #6d5df6;
}
.normal-mode .password-security-card strong,
body:not(.business-mode) .password-security-card strong { color: #1f2937; }
.normal-mode .password-security-card p,
body:not(.business-mode) .password-security-card p { color: #8a8f9c; }
.normal-mode .password-field span,
body:not(.business-mode) .password-field span { color: #606775; }
.normal-mode .password-field input,
body:not(.business-mode) .password-field input {
  background: #f8f9fc;
  border: 1px solid #e5e7ef;
  color: #1f2937;
}
.normal-mode .password-field input:focus,
body:not(.business-mode) .password-field input:focus {
  background: #ffffff;
  border-color: rgba(109, 93, 246, 0.55);
  box-shadow:
    0 0 0 4px rgba(109, 93, 246, 0.10),
    0 10px 28px rgba(109, 93, 246, 0.08);
}
.normal-mode .password-field input::placeholder,
body:not(.business-mode) .password-field input::placeholder { color: #a0a6b4; }
.normal-mode .strength-label,
body:not(.business-mode) .strength-label { color: #8a8f9c; }
.normal-mode .strength-bar,
body:not(.business-mode) .strength-bar { background: #eef0f6; }
.normal-mode .strength-bar i,
body:not(.business-mode) .strength-bar i { background: linear-gradient(135deg, #6d5df6, #38c7ff); }
.normal-mode .password-strength.weak .strength-bar i,
body:not(.business-mode) .password-strength.weak .strength-bar i { background: #f87171; }
.normal-mode .password-strength.medium .strength-bar i,
body:not(.business-mode) .password-strength.medium .strength-bar i { background: #f59e0b; }
.normal-mode .password-strength.strong .strength-bar i,
body:not(.business-mode) .password-strength.strong .strength-bar i { background: linear-gradient(135deg, #6d5df6, #38c7ff); }
.normal-mode .password-btn.secondary,
body:not(.business-mode) .password-btn.secondary {
  background: #ffffff;
  border: 1px solid #e5e7ef;
  color: #606775;
}
.normal-mode .password-btn.secondary:hover,
body:not(.business-mode) .password-btn.secondary:hover { background: #f8f9fc; }
.normal-mode .password-btn.primary,
body:not(.business-mode) .password-btn.primary {
  background: linear-gradient(135deg, #6d5df6, #8b7dff);
  border: none;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(109, 93, 246, 0.22);
}
.normal-mode .password-btn.primary:hover,
body:not(.business-mode) .password-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(109, 93, 246, 0.30);
}
.normal-mode .password-success-icon,
body:not(.business-mode) .password-success-icon {
  background: rgba(110, 231, 183, 0.12);
  border: 1px solid rgba(110, 231, 183, 0.26);
  color: #16a06a;
}
.normal-mode .password-success h3,
body:not(.business-mode) .password-success h3 { color: #1f2937; }
.normal-mode .password-success p,
body:not(.business-mode) .password-success p { color: #8a8f9c; }

/* Business mode — Password */
.business-mode .password-overlay {
  background: rgba(0, 0, 0, 0.52);
}
.business-mode .password-panel {
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.12), transparent 36%),
    linear-gradient(180deg, #171822 0%, #101119 100%);
  border: 1px solid rgba(212, 175, 55, 0.16);
  color: #f3efe3;
  box-shadow:
    0 32px 100px rgba(0, 0, 0, 0.42),
    0 0 60px rgba(212, 175, 55, 0.08);
}
.business-mode .password-kicker { color: rgba(212, 175, 55, 0.72); }
.business-mode .password-title { color: #f3efe3; }
.business-mode .password-desc { color: rgba(232, 226, 210, 0.48); }
.business-mode .password-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.16);
  color: rgba(232, 226, 210, 0.62);
}
.business-mode .password-close:hover {
  background: rgba(212, 175, 55, 0.10);
}
.business-mode .password-security-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(212, 175, 55, 0.14);
}
.business-mode .security-icon {
  background: rgba(212, 175, 55, 0.10);
  color: #e6c875;
}
.business-mode .password-security-card strong { color: #f3efe3; }
.business-mode .password-security-card p { color: rgba(232, 226, 210, 0.42); }
.business-mode .password-field span { color: rgba(232, 226, 210, 0.56); }
.business-mode .password-field input {
  background: rgba(5, 6, 10, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f3efe3;
}
.business-mode .password-field input:focus {
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow:
    0 0 0 4px rgba(212, 175, 55, 0.08),
    0 0 28px rgba(212, 175, 55, 0.08);
}
.business-mode .password-field input::placeholder { color: rgba(232, 226, 210, 0.34); }
.business-mode .strength-label { color: rgba(232, 226, 210, 0.42); }
.business-mode .strength-bar { background: rgba(255, 255, 255, 0.08); }
.business-mode .strength-bar i { background: linear-gradient(135deg, #d4af37, #e6c875); }
.business-mode .password-strength.weak .strength-bar i { background: #ff7b7b; }
.business-mode .password-strength.medium .strength-bar i { background: #d4af37; }
.business-mode .password-strength.strong .strength-bar i { background: linear-gradient(135deg, #d4af37, #e6c875); }
.business-mode .password-btn.secondary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(232, 226, 210, 0.62);
}
.business-mode .password-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}
.business-mode .password-btn.primary {
  background: linear-gradient(135deg, #d4af37, #e6c875);
  border: none;
  color: #0b0d12;
  box-shadow: 0 12px 30px rgba(212, 175, 55, 0.18);
}
.business-mode .password-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 38px rgba(212, 175, 55, 0.26);
}
.business-mode .password-success-icon {
  background: rgba(110, 231, 183, 0.12);
  border: 1px solid rgba(110, 231, 183, 0.26);
  color: #6ee7b7;
}
.business-mode .password-success h3 { color: #f3efe3; }
.business-mode .password-success p { color: rgba(232, 226, 210, 0.48); }

/* ============================================================
   Feedback Modal
   ============================================================ */
.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  animation: fade-in .2s ease;
}
.feedback-panel {
  width: 520px;
  max-width: calc(100vw - 40px);
  border-radius: 26px;
  padding: 28px;
  overflow: hidden;
  position: relative;
}
.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.feedback-kicker {
  font-size: 11px;
  letter-spacing: 1.6px;
  font-weight: 900;
}
.feedback-header h2 {
  margin: 6px 0 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 900;
}
.feedback-header p {
  margin-top: 6px;
  font-size: 13px;
}
.feedback-close {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.feedback-type-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.feedback-type {
  flex: 1;
  height: 42px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all .18s ease;
}
.feedback-field {
  display: block;
  margin-bottom: 16px;
}
.feedback-field span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
}
.feedback-field input,
.feedback-field textarea {
  width: 100%;
  border-radius: 15px;
  padding: 12px 15px;
  outline: none;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
  font-family: inherit;
  resize: vertical;
}
.feedback-field input {
  height: 48px;
}
.feedback-field textarea {
  min-height: 120px;
}
.feedback-field input[type="file"] {
  height: auto;
  padding: 10px 12px;
}
.feedback-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: -4px;
}
.feedback-image-preview:empty { display: none; }
.feedback-image-chip,
.feedback-image-hint {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: rgba(232,226,210,0.66);
  font-size: 12px;
}
.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}
.feedback-btn {
  height: 46px;
  padding: 0 22px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: all .18s ease;
}
.feedback-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Normal mode — Feedback */
body:not(.business-mode) .feedback-overlay {
  background: rgba(248, 250, 255, 0.72);
}
body:not(.business-mode) .feedback-panel {
  background:
    radial-gradient(circle at 50% 0%, rgba(109, 93, 246, 0.10), transparent 36%),
    #ffffff;
  border: 1px solid #eef0f6;
  color: #1f2937;
  box-shadow:
    0 32px 100px rgba(15, 23, 42, 0.16),
    0 0 0 1px rgba(109, 93, 246, 0.03);
}
body:not(.business-mode) .feedback-kicker { color: #6d5df6; }
body:not(.business-mode) .feedback-header h2 { color: #1f2937; }
body:not(.business-mode) .feedback-header p { color: #8a8f9c; }
body:not(.business-mode) .feedback-close {
  background: #f5f3ff;
  color: #6d5df6;
  border: 1px solid rgba(109, 93, 246, 0.12);
}
body:not(.business-mode) .feedback-close:hover { background: #ede9ff; }
body:not(.business-mode) .feedback-type {
  background: #f5f3ff;
  color: #6d5df6;
  border: 1px solid rgba(109, 93, 246, 0.12);
}
body:not(.business-mode) .feedback-type.active {
  background: linear-gradient(135deg, #6d5df6, #8b7dff);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(109, 93, 246, 0.22);
}
body:not(.business-mode) .feedback-type:hover:not(.active) { background: #ede9ff; }
body:not(.business-mode) .feedback-field span { color: #606775; }
body:not(.business-mode) .feedback-field input,
body:not(.business-mode) .feedback-field textarea {
  background: #f8f9fc;
  border: 1px solid #e5e7ef;
  color: #1f2937;
}
body:not(.business-mode) .feedback-field input:focus,
body:not(.business-mode) .feedback-field textarea:focus {
  background: #ffffff;
  border-color: rgba(109, 93, 246, 0.55);
  box-shadow:
    0 0 0 4px rgba(109, 93, 246, 0.10),
    0 10px 28px rgba(109, 93, 246, 0.08);
}
body:not(.business-mode) .feedback-field input::placeholder,
body:not(.business-mode) .feedback-field textarea::placeholder { color: #a0a6b4; }
body:not(.business-mode) .feedback-btn.secondary {
  background: #ffffff;
  border: 1px solid #e5e7ef;
  color: #606775;
}
body:not(.business-mode) .feedback-btn.secondary:hover { background: #f8f9fc; }
body:not(.business-mode) .feedback-btn.primary {
  background: linear-gradient(135deg, #6d5df6, #8b7dff);
  border: none;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(109, 93, 246, 0.22);
}
body:not(.business-mode) .feedback-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(109, 93, 246, 0.30);
}

/* Business mode — Feedback */
.business-mode .feedback-overlay {
  background: rgba(0, 0, 0, 0.52);
}
.business-mode .feedback-panel {
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.12), transparent 36%),
    linear-gradient(180deg, #171822 0%, #101119 100%);
  border: 1px solid rgba(212, 175, 55, 0.16);
  color: #f3efe3;
  box-shadow:
    0 32px 100px rgba(0, 0, 0, 0.42),
    0 0 60px rgba(212, 175, 55, 0.08);
}
.business-mode .feedback-kicker { color: rgba(212, 175, 55, 0.72); }
.business-mode .feedback-header h2 { color: #f3efe3; }
.business-mode .feedback-header p { color: rgba(232, 226, 210, 0.48); }
.business-mode .feedback-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.16);
  color: rgba(232, 226, 210, 0.62);
}
.business-mode .feedback-close:hover {
  background: rgba(212, 175, 55, 0.10);
}
.business-mode .feedback-type {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(232, 226, 210, 0.62);
}
.business-mode .feedback-type.active {
  background: linear-gradient(135deg, #d4af37, #e6c875);
  color: #0b0d12;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.18);
}
.business-mode .feedback-type:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
}
.business-mode .feedback-field span { color: rgba(232, 226, 210, 0.56); }
.business-mode .feedback-field input,
.business-mode .feedback-field textarea {
  background: rgba(5, 6, 10, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f3efe3;
}
.business-mode .feedback-field input:focus,
.business-mode .feedback-field textarea:focus {
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow:
    0 0 0 4px rgba(212, 175, 55, 0.08),
    0 0 28px rgba(212, 175, 55, 0.08);
}
.business-mode .feedback-field input::placeholder,
.business-mode .feedback-field textarea::placeholder { color: rgba(232, 226, 210, 0.34); }
.business-mode .feedback-btn.secondary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(232, 226, 210, 0.62);
}
.business-mode .feedback-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}
.business-mode .feedback-btn.primary {
  background: linear-gradient(135deg, #d4af37, #e6c875);
  border: none;
  color: #0b0d12;
  box-shadow: 0 12px 30px rgba(212, 175, 55, 0.18);
}
.business-mode .feedback-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 38px rgba(212, 175, 55, 0.26);
}

.conv-bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 8px;
  flex: 0 0 auto;
}
.conv-bulk-toolbar[hidden] { display: none; }
.conv-bulk-count {
  flex: 1;
  min-width: 0;
  color: var(--muted, #9ca3af);
  font-size: 12px;
}
.conv-bulk-btn {
  height: 28px;
  padding: 0 9px;
  border-radius: 7px;
  color: var(--muted, #9ca3af);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease, opacity .15s ease;
}
.conv-bulk-btn:hover { background: var(--hover, rgba(0,0,0,0.04)); color: var(--text, #111); }
.conv-bulk-btn.danger { color: #dc2626; }
.conv-bulk-btn.danger:hover { background: rgba(220, 38, 38, 0.08); color: #b91c1c; }
.conv-bulk-btn:disabled { opacity: .45; cursor: not-allowed; }
.conversation-item.selecting .conv-item-actions { display: none; }
.conversation-item.selected { background: rgba(109,93,251,0.08); }
.conv-select-check {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  accent-color: var(--brand, #6d5dfb);
  cursor: pointer;
}

.brand-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  padding: 3px;
  border: 1px solid rgba(109, 93, 246, 0.16);
  border-radius: 999px;
  background: rgba(109, 93, 246, 0.055);
}

.brand-mode-switch button {
  min-width: 48px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-mode-switch button:hover {
  color: var(--text);
  background: rgba(109, 93, 246, 0.08);
}

.brand-mode-switch button.active {
  color: #fff;
  background: var(--brand-gradient);
}

/* Image mode visual system */
body.image-mode {
  --image-bg: #030713;
  --image-bg-2: #071427;
  --image-panel: rgba(19, 27, 48, 0.82);
  --image-panel-deep: rgba(7, 11, 24, 0.86);
  --image-panel-soft: rgba(255, 255, 255, 0.052);
  --image-line: rgba(150, 166, 255, 0.18);
  --image-line-strong: rgba(139, 220, 255, 0.38);
  --image-text: #f7faff;
  --image-muted: rgba(226, 234, 255, 0.62);
  --image-faint: rgba(226, 234, 255, 0.38);
  --image-blue: #38c7ff;
  --image-indigo: #6d5df6;
  --image-lavender: #a5b4fc;
  --image-green: #6ee7b7;
  --image-shadow: 0 30px 90px rgba(0, 0, 0, 0.42), 0 0 70px rgba(79, 140, 255, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.055);
  color-scheme: dark;
  color: var(--image-text);
  background:
    linear-gradient(115deg, rgba(109, 93, 246, 0.22) 0%, rgba(109, 93, 246, 0) 34%),
    linear-gradient(245deg, rgba(56, 199, 255, 0.16) 0%, rgba(56, 199, 255, 0) 36%),
    linear-gradient(180deg, #030713 0%, #081126 48%, #061421 100%);
}

body.image-mode .app-shell,
body.image-mode .workspace,
.image-mode.image-workspace,
.image-mode .image-workspace {
  background:
    linear-gradient(115deg, rgba(109, 93, 246, 0.22) 0%, rgba(109, 93, 246, 0) 34%),
    linear-gradient(245deg, rgba(56, 199, 255, 0.15) 0%, rgba(56, 199, 255, 0) 36%),
    linear-gradient(180deg, #030713 0%, #081126 50%, #061421 100%);
}

body.image-mode .workspace::before,
.image-mode.image-workspace::before,
.image-mode .image-workspace::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.13;
  background-image:
    linear-gradient(rgba(150, 166, 255, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 166, 255, 0.15) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, transparent 0%, black 16%, black 82%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 16%, black 82%, transparent 100%);
}

body.image-mode .workspace::after,
.image-mode.image-workspace::after,
.image-mode .image-workspace::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0%, rgba(139, 220, 255, 0.18) 50%, transparent 100%) 50% 0 / 62% 1px no-repeat,
    linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0%, transparent 24%, transparent 100%);
}

body.image-mode .topbar,
body.image-mode .sidebar,
.image-mode .glass-panel,
.image-mode .image-studio-main,
.image-mode .image-input-bar,
.image-mode .image-result-card,
.image-mode .image-preview-panel {
  background: linear-gradient(180deg, rgba(22, 30, 48, 0.88), rgba(9, 14, 27, 0.84));
  border-color: var(--image-line);
  box-shadow: var(--image-shadow);
  backdrop-filter: blur(18px) saturate(1.16);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
}

body.image-mode .topbar {
  position: relative;
  z-index: 3;
  border-bottom-color: rgba(150, 166, 255, 0.14);
  color: var(--image-text);
}

body.image-mode .topbar-mode {
  color: var(--image-text);
  font-weight: 800;
}

body.image-mode .topbar-mode-dot {
  background: var(--image-green);
  box-shadow: 0 0 14px rgba(110, 231, 183, 0.78);
}

body.image-mode .topbar-selected {
  background: rgba(24, 32, 68, .72);
  border: 1px solid rgba(120, 145, 255, .22);
  color: rgba(220, 230, 255, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.image-mode .sidebar {
  border-right: 1px solid rgba(150, 166, 255, 0.14);
  color: var(--image-text);
}

body.image-mode .brand,
.image-mode .image-brand {
  background: linear-gradient(135deg, rgba(109, 93, 246, 0.16), rgba(56, 199, 255, 0.07));
  border-bottom-color: rgba(150, 166, 255, 0.14);
  color: var(--image-text);
}

body.image-mode .brand-text small {
  color: var(--image-faint);
}

.image-mode .brand-mode-switch,
body.image-mode .brand-mode-switch,
.image-mode .mode-switch,
body.image-mode .mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 32px;
  padding: 3px;
  margin-left: auto;
  border: 1px solid rgba(150, 166, 255, 0.18);
  border-radius: 999px;
  background: rgba(5, 9, 18, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.image-mode .brand-mode-switch button,
body.image-mode .brand-mode-switch button,
.image-mode .mode-switch button,
body.image-mode .mode-switch button,
.image-mode .mode-switch-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  max-width: 86px;
  height: 24px;
  padding: 0 10px;
  overflow: hidden;
  border-radius: 999px;
  color: var(--image-muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.image-mode .brand-mode-switch button:hover,
body.image-mode .brand-mode-switch button:hover,
.image-mode .mode-switch button:hover,
body.image-mode .mode-switch button:hover,
.image-mode .mode-switch-item:hover {
  color: var(--image-text);
  background: rgba(255, 255, 255, 0.06);
}

.image-mode .brand-mode-switch button.active,
body.image-mode .brand-mode-switch button.active,
.image-mode .mode-switch button.active,
body.image-mode .mode-switch button.active,
.image-mode .mode-switch-item.active {
  color: #fff;
  background: linear-gradient(135deg, #6d5df6 0%, #4f8cff 54%, #38c7ff 100%);
  box-shadow: 0 10px 26px rgba(79, 140, 255, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

body.image-mode .image-mode-section {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  overflow: hidden;
}

.image-mode .image-task-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  overflow: hidden;
  border: 1px solid rgba(150, 166, 255, 0.20);
  border-radius: 8px;
  background: linear-gradient(135deg, #6d5df6 0%, #4f8cff 52%, #38c7ff 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(79, 140, 255, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform .18s ease, box-shadow .18s ease;
}

.image-mode .image-task-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 44px rgba(79, 140, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.image-mode .image-task-button span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-mode .image-task-button [data-icon] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.image-mode .section-title {
  flex: 0 0 auto;
  color: rgba(226, 234, 255, 0.48);
  letter-spacing: .06em;
}

.image-mode .image-history-list {
  display: grid;
  align-content: start;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.image-mode .image-history-list .empty-models {
  display: grid;
  min-height: 128px;
  place-items: center;
  padding: 18px 12px;
  border: 1px solid rgba(150, 166, 255, 0.12);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  color: var(--image-faint);
  font-size: 12px;
  text-align: center;
}

.image-mode .image-history-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid rgba(150, 166, 255, 0.12);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  color: var(--image-muted);
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.image-mode .image-history-item:hover,
.image-mode .image-history-item.active {
  transform: translateY(-1px);
  border-color: var(--image-line-strong);
  background: linear-gradient(135deg, rgba(109, 93, 246, 0.16), rgba(56, 199, 255, 0.06));
  color: var(--image-text);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.image-mode .image-history-thumb {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(150, 166, 255, 0.16);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(109, 93, 246, 0.20), rgba(56, 199, 255, 0.10)), #070b17;
  object-fit: cover;
}

.image-mode .image-history-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.image-mode .image-history-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-mode .image-history-time {
  display: block;
  overflow: hidden;
  color: var(--image-faint);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-mode .image-studio-host {
  position: relative;
  z-index: 2;
  flex: 1;
  align-items: stretch;
  gap: 0;
  padding: 20px clamp(18px, 4vw, 56px) 132px;
}

.image-mode .image-studio-main,
.image-mode .image-main {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(100%, 1180px);
  min-width: 0;
  min-height: min(680px, calc(100vh - 220px));
  gap: 18px;
  align-self: stretch;
  justify-self: center;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--image-line);
  border-radius: 8px;
}

.image-mode .image-studio-main::before,
.image-mode .image-main::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: 8px;
  background: linear-gradient(120deg, transparent 0%, rgba(123, 109, 255, 0.72) 35%, rgba(56, 199, 255, 0.52) 50%, transparent 70%);
  background-size: 220% 220%;
  opacity: 0.40;
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderFlow 5s ease-in-out infinite;
}

@keyframes borderFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.image-mode .image-studio-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding-bottom: 2px;
}

.image-mode .image-studio-kicker {
  color: rgba(139, 220, 255, 0.78);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.image-mode .image-studio-title {
  margin-top: 7px;
  color: var(--image-text);
  font-size: 32px;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.image-mode .image-studio-subtitle {
  max-width: 620px;
  margin-top: 8px;
  color: var(--image-muted);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.image-mode .image-studio-badge {
  flex: 0 0 auto;
  max-width: 220px;
  padding: 7px 10px;
  overflow: hidden;
  border: 1px solid rgba(139, 220, 255, 0.18);
  border-radius: 999px;
  background: rgba(3, 7, 17, 0.48);
  color: rgba(226, 234, 255, 0.72);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-mode .scene-preset-grid,
.image-mode .preset-grid,
.image-mode .image-presets {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.image-mode .scene-preset-card,
.image-mode .preset-card,
.image-mode .image-preset-card {
  position: relative;
  min-width: 0;
  min-height: 104px;
  padding: 13px;
  overflow: hidden;
  border: 1px solid rgba(150, 166, 255, 0.15);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(109, 93, 246, 0.12), rgba(56, 199, 255, 0.055) 52%, rgba(255, 255, 255, 0.035)),
    rgba(5, 9, 18, 0.48);
  color: var(--image-text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.image-mode .scene-preset-media {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 10px;
  overflow: hidden;
  border: 1px solid rgba(150, 166, 255, 0.12);
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(109, 93, 246, 0.20), rgba(56, 199, 255, 0.10)), #070b17;
}

.image-mode .scene-preset-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-mode .scene-preset-copy {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
}

.image-mode .scene-preset-card::after,
.image-mode .preset-card::after,
.image-mode .image-preset-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.055) 50%, transparent 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.image-mode .scene-preset-card:hover,
.image-mode .scene-preset-card.active,
.image-mode .preset-card:hover,
.image-mode .preset-card.active,
.image-mode .image-preset-card:hover,
.image-mode .image-preset-card.active {
  transform: translateY(-2px);
  border-color: var(--image-line-strong);
  background:
    linear-gradient(135deg, rgba(109, 93, 246, 0.22), rgba(56, 199, 255, 0.10) 58%, rgba(110, 231, 183, 0.045)),
    rgba(7, 12, 24, 0.76);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.24), 0 0 34px rgba(79, 140, 255, 0.12);
}

.image-mode .scene-preset-card:hover::after,
.image-mode .scene-preset-card.active::after,
.image-mode .preset-card:hover::after,
.image-mode .preset-card.active::after,
.image-mode .image-preset-card:hover::after,
.image-mode .image-preset-card.active::after {
  opacity: 1;
}

.image-mode .preset-card-title,
.image-mode .scene-preset-title,
.image-mode .image-preset-title {
  position: relative;
  z-index: 1;
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-mode .preset-card-desc,
.image-mode .scene-preset-desc,
.image-mode .image-preset-desc {
  position: relative;
  z-index: 1;
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  color: var(--image-muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.image-mode .image-results,
.image-mode .image-result-grid,
.image-mode .result-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
}

.image-mode .image-results > .image-result-grid {
  display: contents;
}

.image-mode .image-result-card,
.image-mode .image-card {
  position: relative;
  display: grid;
  gap: 11px;
  min-width: 0;
  margin: 0;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--image-line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(22, 30, 48, 0.78), rgba(8, 13, 26, 0.86));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.image-mode .image-card-media,
.image-mode .image-result-card img,
.image-mode .image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(150, 166, 255, 0.12);
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(109, 93, 246, 0.20), rgba(56, 199, 255, 0.09)),
    #070b17;
  object-fit: cover;
}

.image-mode .image-card-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 8px;
  min-width: 0;
  align-items: center;
}

.image-mode .image-card-title {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-mode .image-card-subtitle,
.image-mode .image-card-time {
  color: var(--image-faint);
  font-size: 11px;
  font-weight: 800;
}

.image-mode .image-card-actions,
.image-mode .image-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 7px;
}

.image-mode .image-action-btn,
.image-mode .preview-btn,
.image-mode .download-btn,
.image-mode .delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid rgba(150, 166, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--image-muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.image-mode .image-action-btn:hover,
.image-mode .preview-btn:hover,
.image-mode .download-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 220, 255, 0.42);
  background: rgba(56, 199, 255, 0.11);
  color: #fff;
}

.image-mode .delete-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

.image-mode .image-empty-panel,
.image-mode .image-loading-panel,
.image-mode .image-error-panel {
  grid-column: 1 / -1;
  display: grid;
  min-height: 320px;
  place-items: center;
  padding: 28px;
  border: 1px solid rgba(150, 166, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.016)),
    rgba(5, 9, 18, 0.42);
  color: var(--image-muted);
  text-align: center;
}

.image-mode .image-empty-panel > div,
.image-mode .image-loading-panel > div,
.image-mode .image-error-panel > div {
  display: grid;
  gap: 8px;
  max-width: 420px;
}

.image-mode .image-empty-panel strong,
.image-mode .image-loading-panel strong,
.image-mode .image-error-panel strong {
  color: var(--image-text);
  font-size: 18px;
  line-height: 1.25;
}

.image-mode .image-empty-panel span,
.image-mode .image-loading-panel span,
.image-mode .image-error-panel span {
  color: var(--image-muted);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.image-mode .image-loading-panel strong::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 999px;
  background: var(--image-green);
  box-shadow: 0 0 14px rgba(110, 231, 183, 0.78);
  vertical-align: 2px;
}

.image-mode .image-error-panel {
  border-color: rgba(248, 113, 113, 0.24);
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.075), rgba(255, 255, 255, 0.016));
}

.image-mode .image-error-panel strong {
  color: #fecaca;
}

body.image-mode .composer-wrap {
  z-index: 4;
  right: max(24px, calc((100vw - 1180px) / 2));
  bottom: 28px;
  left: max(24px, calc(280px + (100vw - 280px - 1180px) / 2));
}

body.image-mode .composer {
  width: min(100%, 920px);
  border: 1px solid rgba(150, 166, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(22, 30, 48, 0.90), rgba(9, 14, 27, 0.92));
  box-shadow: 0 26px 72px rgba(0, 0, 0, 0.42), 0 0 58px rgba(79, 140, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(18px) saturate(1.16);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
}

body.image-mode .composer:focus-within {
  border-color: rgba(139, 220, 255, 0.42);
  background: linear-gradient(180deg, rgba(24, 34, 56, 0.94), rgba(9, 14, 27, 0.95));
  box-shadow: 0 30px 86px rgba(0, 0, 0, 0.46), 0 0 0 4px rgba(79, 140, 255, 0.10), 0 0 36px rgba(56, 199, 255, 0.12);
}

.image-mode .image-input-bar,
.image-mode .image-composer,
.image-mode .image-prompt-bar {
  align-items: end;
  gap: 10px;
  min-height: 62px;
  padding: 9px;
  border-radius: 8px;
}

.image-mode .image-input-bar textarea,
.image-mode .image-input-bar input,
.image-mode .image-composer textarea,
.image-mode .image-composer input,
.image-mode .image-prompt-input {
  width: 100%;
  min-height: 42px;
  max-height: 150px;
  padding: 10px 12px;
  resize: none;
  outline: none;
  border: 1px solid rgba(150, 166, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 9, 18, 0.72);
  color: #f7faff;
  font-size: 14px;
  line-height: 1.5;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.image-mode .image-input-bar textarea::placeholder,
.image-mode .image-input-bar input::placeholder,
.image-mode .image-composer textarea::placeholder,
.image-mode .image-composer input::placeholder,
.image-mode .image-prompt-input::placeholder {
  color: rgba(226, 234, 255, 0.34);
}

.image-mode .image-input-bar textarea:focus,
.image-mode .image-input-bar input:focus,
.image-mode .image-composer textarea:focus,
.image-mode .image-composer input:focus,
.image-mode .image-prompt-input:focus {
  border-color: rgba(100, 128, 255, 0.95);
  background: rgba(5, 9, 18, 0.84);
  box-shadow: 0 0 0 4px rgba(100, 128, 255, 0.12), 0 0 30px rgba(56, 199, 255, 0.16);
}

body.image-mode .send-button {
  width: auto;
  height: 42px;
  padding: 0 22px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6d5df6 0%, #4f8cff 52%, #38c7ff 100%);
  color: #fff;
  box-shadow: 0 14px 34px rgba(79, 140, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

body.image-mode .send-button:not(.ready) {
  color: rgba(226, 234, 255, 0.55);
  background: linear-gradient(135deg, rgba(115, 87, 255, 0.3), rgba(95, 199, 255, 0.2));
  box-shadow: none;
}

body.image-mode .send-button.ready:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 18px 44px rgba(79, 140, 255, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

body.image-mode .send-button .send-button-text {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

body.image-mode .stop-button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(248, 113, 113, 0.26);
  border-radius: 8px;
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

body.image-mode .stop-button:hover {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.40);
}

body.image-mode .image-preview {
  padding: 0 12px 8px;
}

body.image-mode .image-preview-chip {
  border-color: rgba(150, 166, 255, 0.18);
  background: rgba(5, 9, 18, 0.72);
}

/* Image mode first-screen wall */
.image-mode .image-hero-wall,
.image-mode .image-showcase-wall,
.image-mode .image-gallery-wall,
.image-mode .image-first-screen-wall,
.image-mode .image-wall {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 4px 0;
  border-radius: 8px;
  mask-image: linear-gradient(90deg, transparent 0%, black 8%, black 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 8%, black 92%, transparent 100%);
}

.image-mode .image-hero-wall::before,
.image-mode .image-showcase-wall::before,
.image-mode .image-gallery-wall::before,
.image-mode .image-first-screen-wall::before,
.image-mode .image-wall::before,
.image-mode .image-hero-wall::after,
.image-mode .image-showcase-wall::after,
.image-mode .image-gallery-wall::after,
.image-mode .image-first-screen-wall::after,
.image-mode .image-wall::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: min(72px, 16vw);
  pointer-events: none;
}

.image-mode .image-hero-wall::before,
.image-mode .image-showcase-wall::before,
.image-mode .image-gallery-wall::before,
.image-mode .image-first-screen-wall::before,
.image-mode .image-wall::before {
  left: 0;
  width: 48px;
  background: linear-gradient(90deg, rgba(14, 22, 48, 0.72), transparent);
}

.image-mode .image-hero-wall::after,
.image-mode .image-showcase-wall::after,
.image-mode .image-gallery-wall::after,
.image-mode .image-first-screen-wall::after,
.image-mode .image-wall::after {
  right: 0;
  width: 48px;
  background: linear-gradient(270deg, rgba(14, 22, 48, 0.72), transparent);
}

.image-mode .image-wall-row,
.image-mode .image-marquee-row,
.image-mode .image-stream-row,
.image-mode .image-hero-wall-row {
  display: flex;
  min-width: 0;
  overflow: visible;
}

.image-mode .image-wall-track,
.image-mode .image-marquee-track,
.image-mode .image-stream-track,
.image-mode .image-hero-wall-track {
  display: flex;
  width: max-content;
  min-width: 100%;
  gap: 12px;
  will-change: transform;
}

.image-mode .image-wall-row:nth-child(odd) .image-wall-track,
.image-mode .image-marquee-row:nth-child(odd) .image-marquee-track,
.image-mode .image-stream-row:nth-child(odd) .image-stream-track,
.image-mode .image-hero-wall-row:nth-child(odd) .image-hero-wall-track {
  animation: imageWallLeft 34s linear infinite;
}

.image-mode .image-wall-row:nth-child(even) .image-wall-track,
.image-mode .image-marquee-row:nth-child(even) .image-marquee-track,
.image-mode .image-stream-row:nth-child(even) .image-stream-track,
.image-mode .image-hero-wall-row:nth-child(even) .image-hero-wall-track {
  animation: imageWallRight 34s linear infinite;
}

.image-mode .image-hero-wall:hover .image-wall-track,
.image-mode .image-showcase-wall:hover .image-wall-track,
.image-mode .image-gallery-wall:hover .image-wall-track,
.image-mode .image-first-screen-wall:hover .image-wall-track,
.image-mode .image-wall:hover .image-wall-track,
.image-mode .image-hero-wall:hover .image-marquee-track,
.image-mode .image-showcase-wall:hover .image-marquee-track,
.image-mode .image-gallery-wall:hover .image-marquee-track,
.image-mode .image-first-screen-wall:hover .image-marquee-track,
.image-mode .image-wall:hover .image-marquee-track,
.image-mode .image-hero-wall:hover .image-stream-track,
.image-mode .image-showcase-wall:hover .image-stream-track,
.image-mode .image-gallery-wall:hover .image-stream-track,
.image-mode .image-first-screen-wall:hover .image-stream-track,
.image-mode .image-wall:hover .image-stream-track,
.image-mode .image-hero-wall:hover .image-hero-wall-track,
.image-mode .image-showcase-wall:hover .image-hero-wall-track,
.image-mode .image-gallery-wall:hover .image-hero-wall-track,
.image-mode .image-first-screen-wall:hover .image-hero-wall-track,
.image-mode .image-wall:hover .image-hero-wall-track {
  animation-play-state: paused;
}

.image-mode .image-wall-card,
.image-mode .image-wall-item,
.image-mode .image-marquee-card,
.image-mode .image-showcase-card,
.image-mode .image-stream-card {
  position: relative;
  flex: 0 0 clamp(180px, 20vw, 220px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid rgba(150, 166, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(109, 93, 246, 0.20), rgba(56, 199, 255, 0.08)),
    #070b17;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.image-mode .image-wall-card img,
.image-mode .image-wall-item img,
.image-mode .image-marquee-card img,
.image-mode .image-showcase-card img,
.image-mode .image-stream-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s ease, filter .45s ease;
}

.image-mode .image-wall-card:hover img,
.image-mode .image-wall-item:hover img,
.image-mode .image-marquee-card:hover img,
.image-mode .image-showcase-card:hover img,
.image-mode .image-stream-card:hover img {
  transform: scale(1.045);
  filter: saturate(1.08) contrast(1.04);
}

.image-mode .image-studio-main:has(.image-empty-panel) {
  grid-template-rows: auto minmax(210px, 0.62fr) minmax(180px, 0.38fr);
}

.image-mode .image-studio-main:has(.image-empty-panel) .scene-preset-grid,
.image-mode .image-main:has(.image-empty-panel) .scene-preset-grid {
  grid-auto-flow: column;
  grid-auto-columns: minmax(176px, 245px);
  grid-template-columns: none;
  grid-template-rows: repeat(2, minmax(126px, 1fr));
  align-content: center;
  gap: 12px;
  overflow: hidden;
  padding: 2px 0 4px;
  mask-image: linear-gradient(90deg, transparent 0%, black 8%, black 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 8%, black 92%, transparent 100%);
}

.image-mode .image-studio-main:has(.image-empty-panel) .scene-preset-card,
.image-mode .image-main:has(.image-empty-panel) .scene-preset-card {
  min-height: 126px;
  animation: imagePresetDriftLeft 22s ease-in-out infinite alternate;
}

.image-mode .image-studio-main:has(.image-empty-panel) .scene-preset-card:nth-child(even),
.image-mode .image-main:has(.image-empty-panel) .scene-preset-card:nth-child(even) {
  animation-name: imagePresetDriftRight;
}

.image-mode .image-studio-main:has(.image-empty-panel) .scene-preset-grid:hover .scene-preset-card,
.image-mode .image-main:has(.image-empty-panel) .scene-preset-grid:hover .scene-preset-card {
  animation-play-state: paused;
}

@keyframes imageWallLeft {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(calc(-50% - 6px), 0, 0); }
}

@keyframes imageWallRight {
  from { transform: translate3d(calc(-50% - 6px), 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}

@keyframes imagePresetDriftLeft {
  from { transform: translate3d(18px, 0, 0); }
  to { transform: translate3d(-18px, 0, 0); }
}

@keyframes imagePresetDriftRight {
  from { transform: translate3d(-18px, 0, 0); }
  to { transform: translate3d(18px, 0, 0); }
}

/* Image mode dialog */
.image-mode .image-dialog,
.image-mode .image-chat,
.image-mode .image-conversation,
.image-mode .image-dialog-thread {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(100%, 940px);
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  justify-self: center;
  overflow: auto;
  padding: 4px 2px 14px;
}

.image-mode .image-dialog .message,
.image-mode .image-chat .message,
.image-mode .image-conversation .message,
.image-mode .image-dialog-message,
.image-mode .image-message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  max-width: none;
  align-items: start;
}

.image-mode .image-dialog .message.user,
.image-mode .image-chat .message.user,
.image-mode .image-conversation .message.user,
.image-mode .image-dialog-message.user,
.image-mode .image-message.user {
  grid-template-columns: minmax(0, 1fr);
  justify-items: end;
}

.image-mode .image-dialog .message-body,
.image-mode .image-chat .message-body,
.image-mode .image-conversation .message-body,
.image-mode .image-dialog-body,
.image-mode .image-message-body {
  display: flex;
  min-width: 0;
  max-width: min(720px, 100%);
  flex-direction: column;
  gap: 8px;
}

.image-mode .image-dialog .message.user .message-body,
.image-mode .image-chat .message.user .message-body,
.image-mode .image-conversation .message.user .message-body,
.image-mode .image-dialog-message.user .image-dialog-body,
.image-mode .image-message.user .image-message-body {
  align-items: flex-end;
}

.image-mode .image-dialog .bubble,
.image-mode .image-chat .bubble,
.image-mode .image-conversation .bubble,
.image-mode .image-dialog-bubble,
.image-mode .image-message-bubble {
  width: fit-content;
  max-width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(150, 166, 255, 0.10);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  background: rgba(22, 30, 48, 0.72);
  color: var(--image-text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.image-mode .image-dialog .message.user .bubble,
.image-mode .image-chat .message.user .bubble,
.image-mode .image-conversation .message.user .bubble,
.image-mode .image-dialog-message.user .image-dialog-bubble,
.image-mode .image-message.user .image-message-bubble {
  border-color: rgba(139, 220, 255, 0.18);
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 16px;
  background: linear-gradient(135deg, rgba(109, 93, 246, 0.82), rgba(56, 199, 255, 0.72));
  color: #fff;
}

.image-mode .image-dialog .message-meta,
.image-mode .image-chat .message-meta,
.image-mode .image-conversation .message-meta,
.image-mode .image-dialog-meta,
.image-mode .image-message-meta {
  color: var(--image-faint);
  font-size: 11px;
  font-weight: 750;
}

.image-mode .image-message {
  grid-template-columns: minmax(0, 1fr);
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.image-mode .image-message.assistant {
  justify-items: start;
}

.image-mode .image-message-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 4px;
}

.image-mode .image-message.user .image-message-meta {
  justify-content: flex-end;
}

.image-mode .image-message-bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.image-mode .image-message-card {
  margin: 0;
}

.image-mode .image-message-card button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.image-mode .image-message-card figcaption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  color: var(--image-faint);
  font-size: 12px;
}

.image-mode .image-showcase-card {
  padding: 0;
  border: 1px solid rgba(150, 166, 255, 0.16);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.image-mode .image-showcase-card > span {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 1;
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(5, 9, 18, 0.58);
  color: #fff;
  backdrop-filter: blur(10px);
}

.image-mode .image-showcase-card small {
  overflow: hidden;
  color: rgba(255,255,255,0.72);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-mode .image-dialog .message-images,
.image-mode .image-chat .message-images,
.image-mode .image-conversation .message-images,
.image-mode .image-dialog-images,
.image-mode .image-message-images,
.image-mode .image-generated-grid {
  display: grid;
  width: min(100%, 720px);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.image-mode .image-dialog .message-images img,
.image-mode .image-chat .message-images img,
.image-mode .image-conversation .message-images img,
.image-mode .image-dialog-images img,
.image-mode .image-message-images img,
.image-mode .image-generated-grid img {
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: auto;
  height: auto;
  max-height: 520px;
  border: 1px solid rgba(150, 166, 255, 0.16);
  border-radius: 8px;
  background: #070b17;
  object-fit: contain;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
}

.image-mode .image-dialog .image-result-grid,
.image-mode .image-chat .image-result-grid,
.image-mode .image-conversation .image-result-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  width: min(100%, 720px);
  gap: 10px;
  overflow: visible;
}

.image-mode .image-dialog .image-result-card,
.image-mode .image-chat .image-result-card,
.image-mode .image-conversation .image-result-card {
  padding: 8px;
  border-radius: 8px;
}

.image-mode .image-dialog .image-result-card img,
.image-mode .image-chat .image-result-card img,
.image-mode .image-conversation .image-result-card img {
  max-width: 720px;
  max-height: 520px;
  object-fit: contain;
}

@media (max-width: 900px) {
  .image-mode .image-studio-host {
    padding: 14px 12px 124px;
  }

  .image-mode .image-studio-main,
  .image-mode .image-main {
    min-height: calc(100vh - 190px);
    padding: 16px;
  }

  .image-mode .scene-preset-grid,
  .image-mode .preset-grid,
  .image-mode .image-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-mode .image-studio-main:has(.image-empty-panel) .scene-preset-grid,
  .image-mode .image-main:has(.image-empty-panel) .scene-preset-grid {
    grid-auto-columns: minmax(150px, 210px);
    grid-template-columns: none;
    grid-template-rows: repeat(2, minmax(112px, 1fr));
  }
}

@media (max-width: 760px) {
  body.image-mode .sidebar.mobile-open {
    background:
      linear-gradient(115deg, rgba(109, 93, 246, 0.18) 0%, rgba(109, 93, 246, 0) 34%),
      linear-gradient(180deg, #030713 0%, #081126 100%);
  }

  body.image-mode .mobile-header {
    background: linear-gradient(180deg, rgba(22, 30, 48, 0.92), rgba(9, 14, 27, 0.90));
    border-bottom-color: rgba(150, 166, 255, 0.14);
    color: var(--image-text);
  }

  .image-mode .image-dialog,
  .image-mode .image-chat,
  .image-mode .image-conversation,
  .image-mode .image-dialog-thread {
    width: 100%;
    gap: 12px;
    padding-bottom: 10px;
  }

  .image-mode .image-dialog .message,
  .image-mode .image-chat .message,
  .image-mode .image-conversation .message,
  .image-mode .image-dialog-message,
  .image-mode .image-message {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .image-mode .image-dialog .message-body,
  .image-mode .image-chat .message-body,
  .image-mode .image-conversation .message-body,
  .image-mode .image-dialog-body,
  .image-mode .image-message-body {
    max-width: 100%;
  }
}

@media (max-width: 560px) {
  .image-mode .brand-mode-switch,
  body.image-mode .brand-mode-switch,
  .image-mode .mode-switch,
  body.image-mode .mode-switch {
    width: 100%;
    margin: 8px 0 0;
  }

  .image-mode .brand-mode-switch button,
  body.image-mode .brand-mode-switch button,
  .image-mode .mode-switch button,
  body.image-mode .mode-switch button,
  .image-mode .mode-switch-item {
    flex: 1;
    min-width: 0;
    max-width: none;
  }

  .image-mode .image-studio-host {
    padding: 12px 10px 116px;
  }

  .image-mode .image-studio-main,
  .image-mode .image-main {
    gap: 14px;
    min-height: calc(100vh - 170px);
    padding: 12px;
  }

  .image-mode .image-studio-main:has(.image-empty-panel) {
    grid-template-rows: auto minmax(180px, auto) minmax(160px, auto);
  }

  .image-mode .image-studio-header {
    display: grid;
    gap: 10px;
    min-height: 0;
  }

  .image-mode .image-studio-title {
    font-size: 26px;
  }

  .image-mode .scene-preset-grid,
  .image-mode .preset-grid,
  .image-mode .image-presets,
  .image-mode .image-results,
  .image-mode .image-result-grid,
  .image-mode .result-grid {
    grid-template-columns: 1fr;
  }

  .image-mode .scene-preset-card,
  .image-mode .preset-card,
  .image-mode .image-preset-card {
    min-height: 86px;
  }

  .image-mode .image-card-actions,
  .image-mode .image-actions {
    grid-template-columns: 1fr;
  }

  .image-mode .image-hero-wall,
  .image-mode .image-showcase-wall,
  .image-mode .image-gallery-wall,
  .image-mode .image-first-screen-wall,
  .image-mode .image-wall {
    gap: 9px;
  }

  .image-mode .image-wall-track,
  .image-mode .image-marquee-track,
  .image-mode .image-stream-track,
  .image-mode .image-hero-wall-track {
    gap: 9px;
  }

  .image-mode .image-wall-card,
  .image-mode .image-wall-item,
  .image-mode .image-marquee-card,
  .image-mode .image-showcase-card,
  .image-mode .image-stream-card {
    flex-basis: 160px;
    aspect-ratio: 4 / 3;
  }

  .image-mode .image-studio-main:has(.image-empty-panel) .scene-preset-grid,
  .image-mode .image-main:has(.image-empty-panel) .scene-preset-grid {
    grid-auto-columns: minmax(136px, 168px);
    grid-template-columns: none;
    grid-template-rows: repeat(2, minmax(104px, 1fr));
    gap: 9px;
  }

  .image-mode .image-dialog .bubble,
  .image-mode .image-chat .bubble,
  .image-mode .image-conversation .bubble,
  .image-mode .image-dialog-bubble,
  .image-mode .image-message-bubble {
    padding: 10px 12px;
    font-size: 14px;
  }

  .image-mode .image-dialog .message-images,
  .image-mode .image-chat .message-images,
  .image-mode .image-conversation .message-images,
  .image-mode .image-dialog-images,
  .image-mode .image-message-images,
  .image-mode .image-generated-grid,
  .image-mode .image-dialog .image-result-grid,
  .image-mode .image-chat .image-result-grid,
  .image-mode .image-conversation .image-result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .image-mode .image-dialog .message-images img,
  .image-mode .image-chat .message-images img,
  .image-mode .image-conversation .message-images img,
  .image-mode .image-dialog-images img,
  .image-mode .image-message-images img,
  .image-mode .image-generated-grid img {
    max-height: 60vh;
  }

  body.image-mode .composer-wrap {
    right: 10px;
    bottom: 12px;
    left: 10px;
  }

  .image-mode .image-input-bar,
  .image-mode .image-composer,
  .image-mode .image-prompt-bar {
    gap: 8px;
    min-height: 56px;
    padding: 7px;
  }

  body.image-mode .send-button {
    width: auto;
    height: 40px;
    padding: 0 16px;
    font-size: 13px;
  }
  body.image-mode .stop-button {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 380px) {
  .image-mode .image-dialog .message-images,
  .image-mode .image-chat .message-images,
  .image-mode .image-conversation .message-images,
  .image-mode .image-dialog-images,
  .image-mode .image-message-images,
  .image-mode .image-generated-grid,
  .image-mode .image-dialog .image-result-grid,
  .image-mode .image-chat .image-result-grid,
  .image-mode .image-conversation .image-result-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== 图片模式全面优化 ===== */

body.image-mode {
  --image-bg: #070d1b;
  --image-panel: rgba(10, 16, 32, 0.72);
  --image-panel-2: rgba(14, 22, 43, 0.86);
  --image-line: rgba(126, 157, 255, 0.18);
  --image-line-strong: rgba(103, 149, 255, 0.42);
  --image-text: #eef4ff;
  --image-muted: rgba(221, 230, 255, 0.58);
  --image-faint: rgba(221, 230, 255, 0.38);
  --image-accent: #6d73ff;
  --image-cyan: #4db7ff;
}

.image-mode .image-studio-host {
  padding: 24px 36px 132px;
  background:
    radial-gradient(circle at 12% 0%, rgba(109, 93, 246, .18), transparent 34%),
    radial-gradient(circle at 90% 100%, rgba(56, 199, 255, .12), transparent 38%),
    var(--image-bg);
}

.image-mode .image-studio-main,
.image-mode .image-main {
  max-width: 1280px;
  min-height: calc(100vh - 190px);
  margin: 0 auto;
  padding: 18px 24px 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.image-mode .image-studio-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 22px;
}

.image-mode .image-studio-kicker {
  color: rgba(116, 190, 255, .78);
  font-size: 13px;
  font-weight: 800;
}

.image-mode .image-studio-title {
  margin-top: 6px;
  color: var(--image-text);
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.05;
  letter-spacing: 0;
}

.image-mode .image-studio-subtitle {
  margin-top: 10px;
  color: var(--image-muted);
  font-size: 15px;
}

.image-mode .image-studio-badge {
  padding: 8px 14px;
  border: 1px solid var(--image-line);
  border-radius: 999px;
  background: rgba(8, 13, 27, .72);
  color: rgba(235, 240, 255, .72);
  font-size: 14px;
  font-weight: 800;
}

/* 首屏展示图：只显示图片，不显示文字 */
.image-mode .image-showcase-shell {
  display: grid;
  gap: 28px;
}

.image-mode .image-showcase-stage {
  display: grid;
  grid-template-rows: repeat(2, 155px);
  gap: 18px;
  overflow: hidden;
  padding: 2px 0;
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.image-mode .image-showcase-row {
  display: flex;
  overflow: visible;
}

.image-mode .image-showcase-track {
  display: flex;
  width: max-content;
  gap: 18px;
  will-change: transform;
}

.image-mode .image-showcase-row-top .image-showcase-track {
  animation: imageWallLeft 38s linear infinite;
}

.image-mode .image-showcase-row-bottom .image-showcase-track {
  animation: imageWallRight 42s linear infinite;
}

.image-mode .image-showcase-stage:hover .image-showcase-track {
  animation-play-state: running;
}

.image-mode .image-showcase-card {
  position: relative;
  flex: 0 0 220px;
  width: 220px;
  height: 155px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(137, 166, 255, .18);
  border-radius: 10px;
  background: rgba(12, 19, 38, .82);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .24);
}

.image-mode .image-showcase-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .32s ease, filter .32s ease;
}

.image-mode .image-showcase-card:hover img {
  transform: scale(1.045);
  filter: saturate(1.08);
}

.image-mode .image-showcase-card > span,
.image-mode .image-showcase-card strong,
.image-mode .image-showcase-card small {
  display: none !important;
}

/* 专业风格选择器 */
.image-mode .image-style-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 34px;
}

.image-mode .image-style-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 84px;
  padding: 16px;
  border: 1px solid rgba(126, 157, 255, .16);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.045), rgba(255,255,255,.012)),
    rgba(10, 16, 32, .62);
  color: var(--image-text);
  text-align: left;
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.image-mode .image-style-option:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 171, 255, .38);
  background: rgba(18, 28, 52, .74);
}

.image-mode .image-style-option.active {
  border-color: rgba(88, 171, 255, .72);
  background:
    linear-gradient(135deg, rgba(109, 115, 255, .22), rgba(77, 183, 255, .10)),
    rgba(12, 20, 40, .82);
  box-shadow: 0 16px 38px rgba(49, 102, 255, .18);
}

.image-mode .image-style-mark {
  width: 9px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--image-accent), var(--image-cyan));
  opacity: .42;
  flex-shrink: 0;
}

.image-mode .image-style-option.active .image-style-mark {
  opacity: 1;
}

.image-mode .image-style-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.image-mode .image-style-copy strong {
  color: var(--image-text);
  font-size: 16px;
  font-weight: 850;
}

.image-mode .image-style-copy small {
  color: var(--image-muted);
  font-size: 13px;
  line-height: 1.35;
}

/* 聊天流 */
.image-mode .image-thread,
.image-mode .image-dialog,
.image-mode .image-chat,
.image-mode .image-conversation {
  width: min(100%, 980px);
  margin: 20px auto 0;
  padding: 0 0 28px;
  overflow: visible;
  gap: 18px;
}

.image-mode .image-message {
  display: grid;
  gap: 7px;
  width: 100%;
}

.image-mode .image-message.user {
  justify-items: end;
}

.image-mode .image-message.assistant {
  justify-items: start;
}

.image-mode .image-message-meta {
  display: flex;
  gap: 8px;
  padding: 0 4px;
  color: var(--image-faint);
  font-size: 12px;
  font-weight: 750;
}

.image-mode .image-message.user .image-message-meta {
  justify-content: flex-end;
}

.image-mode .image-message-bubble {
  max-width: min(760px, 86%);
  padding: 12px 15px;
  border: 1px solid rgba(126, 157, 255, .14);
  border-radius: 18px;
  border-bottom-left-radius: 7px;
  background: rgba(12, 19, 36, .76);
  color: var(--image-text);
  box-shadow: none;
}

.image-mode .image-message.user .image-message-bubble {
  border-color: rgba(95, 168, 255, .34);
  border-bottom-right-radius: 7px;
  border-bottom-left-radius: 18px;
  background: linear-gradient(135deg, rgba(109, 115, 255, .92), rgba(77, 183, 255, .82));
  color: #fff;
}

.image-mode .image-message-bubble p {
  margin: 0;
  white-space: pre-wrap;
}

/* 生成图片结果 */
.image-mode .image-generated-grid {
  display: grid;
  gap: 12px;
  width: min(760px, 100%);
}

.image-mode .image-result-figure {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(126, 157, 255, .13);
  border-radius: 14px;
  background: rgba(8, 13, 27, .64);
}

.image-mode .image-result-figure img {
  display: block;
  max-width: min(720px, 100%);
  max-height: 58vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(0,0,0,.18);
}

.image-mode .image-result-tools {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease;
}

.image-mode .image-result-figure:hover .image-result-tools,
.image-mode .image-result-figure:focus-within .image-result-tools {
  opacity: 1;
  transform: translateY(0);
}

.image-mode .image-result-tools button,
.image-mode .image-result-tools a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(6, 10, 20, .72);
  color: #fff;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 26px rgba(0,0,0,.28);
  text-decoration: none;
  cursor: pointer;
  transition: background .16s ease;
}

.image-mode .image-result-tools button:hover,
.image-mode .image-result-tools a:hover {
  background: linear-gradient(135deg, rgba(109,115,255,.94), rgba(77,183,255,.88));
  border-color: rgba(255,255,255,.26);
}

.image-mode .image-result-tools [data-icon] {
  width: 17px;
  height: 17px;
}

/* 底部输入框 */
body.image-mode .composer-wrap {
  right: max(24px, calc((100vw - 1180px) / 2));
  bottom: 22px;
  left: max(24px, calc(280px + (100vw - 280px - 1180px) / 2));
  z-index: 30;
}

.image-mode .image-input-bar,
body.image-mode .composer-inner {
  min-height: 68px;
  padding: 9px 10px 9px 16px;
  border: 1px solid rgba(126, 157, 255, .22);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(20, 30, 56, .88), rgba(8, 13, 26, .92));
  box-shadow:
    0 18px 54px rgba(0,0,0,.34),
    0 0 0 1px rgba(255,255,255,.035) inset;
  backdrop-filter: blur(18px);
}

body.image-mode .composer-inner:focus-within {
  border-color: rgba(97, 161, 255, .74);
  box-shadow:
    0 22px 64px rgba(0,0,0,.38),
    0 0 0 3px rgba(77, 183, 255, .12),
    0 0 0 1px rgba(255,255,255,.05) inset;
}

body.image-mode #prompt,
body.image-mode textarea {
  color: var(--image-text);
  font-size: 15px;
  line-height: 1.55;
}

body.image-mode #prompt::placeholder {
  color: rgba(225, 233, 255, .42);
}

body.image-mode .send-button {
  width: auto;
  height: 46px;
  padding: 0 22px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(115, 87, 255, 0.3), rgba(95, 199, 255, 0.2));
  color: rgba(235,240,255,.55);
}

body.image-mode .send-button.ready {
  background: linear-gradient(135deg, #6d73ff, #4db7ff);
  color: white;
  box-shadow: 0 12px 28px rgba(77, 183, 255, .28);
}

body.image-mode .send-button.ready:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(77, 183, 255, .36);
}

/* 响应式 */
@media (max-width: 900px) {
  .image-mode .image-style-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-mode .image-showcase-card {
    flex-basis: 176px;
    width: 176px;
    height: 120px;
  }

  body.image-mode .composer-wrap {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }
}

@media (max-width: 560px) {
  .image-mode .image-studio-host {
    padding: 16px 14px 118px;
  }

  .image-mode .image-studio-main,
  .image-mode .image-main {
    padding: 4px 0 18px;
  }

  .image-mode .image-studio-header {
    grid-template-columns: 1fr;
  }

  .image-mode .image-style-strip {
    grid-template-columns: 1fr;
  }

  .image-mode .image-message-bubble {
    max-width: 92%;
  }

  .image-mode .image-result-figure img {
    max-width: 100%;
    max-height: 52vh;
  }
}

/* Image mode scroll/composer corrections */
body.image-mode .conversation.image-studio-host,
body.image-mode .image-studio-host {
  min-height: 0;
  flex: 1;
  align-items: stretch;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body.image-mode .conversation.image-studio-host {
  flex: 1;
  min-height: 0;
}

body.image-mode .image-studio-main,
body.image-mode .image-main {
  grid-template-rows: none;
  grid-auto-rows: auto;
  align-content: start;
  min-height: clamp(500px, calc(100dvh - 240px), 620px);
  height: auto;
  overflow: visible;
}

body.image-mode .image-main.has-messages {
  display: block;
  min-height: auto;
}

body.image-mode .image-main.has-messages .image-thread {
  height: auto;
  min-height: 0;
  padding-bottom: clamp(116px, 16vh, 168px);
}

body.image-mode .image-studio-main:has(.image-empty-panel),
body.image-mode .image-main:has(.image-empty-panel),
body.image-mode .image-studio-main:has(.image-showcase-shell),
body.image-mode .image-main:has(.image-showcase-shell) {
  min-height: clamp(440px, calc(100dvh - 300px), 580px);
  gap: 16px;
}

body.image-mode .image-studio-main:has(.image-empty-panel) {
  grid-template-rows: none;
}

body.image-mode .image-studio-main:has(.image-empty-panel) .scene-preset-grid,
body.image-mode .image-main:has(.image-empty-panel) .scene-preset-grid {
  align-content: start;
  grid-template-rows: repeat(2, minmax(104px, auto));
}

body.image-mode .image-studio-main:has(.image-empty-panel) .scene-preset-card,
body.image-mode .image-main:has(.image-empty-panel) .scene-preset-card {
  min-height: 104px;
}

body.image-mode .image-thread,
body.image-mode .image-dialog,
body.image-mode .image-chat,
body.image-mode .image-conversation,
body.image-mode .image-dialog-thread {
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
}

body.image-mode .image-results,
body.image-mode .image-result-grid,
body.image-mode .result-grid {
  max-height: none;
  overflow: visible;
}

body.image-mode .image-result-figure img,
body.image-mode .image-generated-grid img,
body.image-mode .image-conversation .image-result-card img {
  max-height: min(70vh, 760px);
}

body.image-mode .composer-wrap {
  pointer-events: none;
}

body.image-mode .composer {
  pointer-events: auto;
  width: min(100%, 920px);
  border: 1px solid rgba(126, 157, 255, .20);
  border-radius: 18px;
  background: rgba(10, 16, 32, .92);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .34);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
}

body.image-mode .composer:focus-within {
  border-color: rgba(100, 176, 255, .48);
  background: rgba(12, 20, 38, .96);
  box-shadow: 0 20px 54px rgba(0, 0, 0, .38), 0 0 0 3px rgba(77, 183, 255, .10);
}

body.image-mode .composer-inner,
body.image-mode .image-input-bar,
body.image-mode .image-composer,
body.image-mode .image-prompt-bar {
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 7px 8px 7px 14px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.image-mode .composer-inner:focus-within,
body.image-mode .image-input-bar:focus-within {
  border-color: transparent;
  box-shadow: none;
}

body.image-mode .composer textarea,
body.image-mode .image-input-bar textarea,
body.image-mode .image-input-bar input,
body.image-mode .image-composer textarea,
body.image-mode .image-composer input,
body.image-mode .image-prompt-input {
  min-height: 40px;
  max-height: 150px;
  padding: 8px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--image-text);
  font-size: 15px;
  line-height: 1.5;
}

body.image-mode .composer textarea:focus,
body.image-mode .image-input-bar textarea:focus,
body.image-mode .image-input-bar input:focus,
body.image-mode .image-composer textarea:focus,
body.image-mode .image-composer input:focus,
body.image-mode .image-prompt-input:focus {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

body.image-mode .send-button,
body.image-mode .stop-button {
  height: 42px;
  align-self: center;
  border-radius: 12px;
}

body.image-mode .send-button {
  flex: 0 0 auto;
  width: auto;
  padding: 0 22px;
  background: linear-gradient(135deg, rgba(115, 87, 255, 0.3), rgba(95, 199, 255, 0.2));
  color: rgba(235, 240, 255, .55);
  box-shadow: none;
}

body.image-mode .stop-button {
  flex: 0 0 42px;
  width: 42px;
}

body.image-mode .send-button.ready {
  background: linear-gradient(135deg, #6d73ff, #4db7ff);
  color: #fff;
  box-shadow: 0 10px 24px rgba(77, 183, 255, .24);
}

body.image-mode .send-button.ready:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(77, 183, 255, .32);
}

body.image-mode .main-nav {
  display: none;
}

body.image-mode .image-task-button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  align-items: center;
  justify-items: center;
  column-gap: 8px;
}

body.image-mode .image-task-button > span:nth-child(2) {
  min-width: 0;
  text-align: center;
}

body.image-mode .image-task-spacer {
  width: 24px;
  height: 1px;
}

body.image-mode .image-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(150, 166, 255, 0.12);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

body.image-mode .image-history-row:hover,
body.image-mode .image-history-row.active {
  transform: translateY(-1px);
  border-color: var(--image-line-strong);
  background: linear-gradient(135deg, rgba(109, 93, 246, 0.16), rgba(56, 199, 255, 0.06));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

body.image-mode .image-history-row .image-history-item {
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.image-mode .image-history-row .image-history-item:hover,
body.image-mode .image-history-row .image-history-item.active {
  transform: none;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

body.image-mode .image-history-delete {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 110, 130, .18);
  border-radius: 10px;
  background: rgba(255, 90, 110, .06);
  color: rgba(255, 165, 175, .72);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, background .16s ease, color .16s ease, border-color .16s ease;
}

body.image-mode .image-history-row:hover .image-history-delete,
body.image-mode .image-history-delete:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

body.image-mode .image-history-delete:hover {
  background: rgba(255, 90, 110, .16);
  border-color: rgba(255, 120, 140, .45);
  color: #ffd6dc;
}

body.image-mode .image-history-delete [data-icon] {
  width: 15px;
  height: 15px;
}

body.image-mode .image-result-tools {
  visibility: hidden;
  pointer-events: none;
}

body.image-mode .image-result-figure:hover .image-result-tools,
body.image-mode .image-result-figure:focus-within .image-result-tools {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

body.image-mode .image-result-tools button,
body.image-mode .image-result-tools a {
  width: auto;
  min-width: 74px;
  height: 34px;
  grid-auto-flow: column;
  gap: 6px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(8, 13, 26, .82);
  font-size: 12px;
  font-weight: 800;
}

body.image-mode .composer-wrap {
  left: var(--sidebar-width, 280px);
  right: 0;
  bottom: 20px;
  display: grid;
  justify-items: center;
}

body.image-mode .composer {
  width: min(920px, calc(100vw - var(--sidebar-width, 280px) - 56px));
  border-radius: 16px;
}

body.image-mode .attach-button {
  display: grid;
}

@media (max-width: 900px) {
  body.image-mode .composer-wrap {
    left: 14px;
    right: 14px;
    justify-items: stretch;
  }

  body.image-mode .composer {
    width: 100%;
  }

  body.image-mode .conversation.image-studio-host,
  body.image-mode .image-studio-host {
    padding-bottom: 0;
  }

  body.image-mode .image-studio-main,
  body.image-mode .image-main {
    min-height: clamp(420px, calc(100dvh - 196px), 560px);
  }
}

@media (max-width: 560px) {
  body.image-mode .conversation.image-studio-host,
  body.image-mode .image-studio-host {
    padding-bottom: 0;
  }

  body.image-mode .image-studio-main,
  body.image-mode .image-main {
    min-height: auto;
  }

  body.image-mode .composer-inner,
  body.image-mode .image-input-bar {
    min-height: 54px;
    padding: 6px 7px 6px 12px;
  }

  body.image-mode .send-button,
  body.image-mode .stop-button {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
  }
}

/* ===== 星空 Image Studio ===== */

.image-mode .image-studio-host {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 !important;
  background: linear-gradient(180deg, #060b18 0%, #07122b 48%, #040813 100%);
}

/* cosmic background layers */
.cosmic-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.stars-layer {
  position: absolute;
  inset: 0;
  opacity: .7;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.9) 1px, transparent 1px),
    radial-gradient(circle, rgba(130,170,255,.72) 1px, transparent 1px),
    radial-gradient(circle, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 90px 90px, 140px 140px, 220px 220px;
  background-position: 0 0, 35px 60px, 90px 120px;
  animation: starDrift 28s linear infinite;
}

.nebula-layer {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 38% 28%, rgba(110, 82, 255, .32), transparent 26%),
    radial-gradient(circle at 55% 58%, rgba(67, 191, 255, .14), transparent 30%),
    radial-gradient(circle at 25% 70%, rgba(150, 75, 255, .18), transparent 24%);
  filter: blur(28px);
  opacity: .8;
}

.horizon-glow {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 180px;
  background:
    radial-gradient(ellipse at center, rgba(125, 82, 255, .42), transparent 62%),
    linear-gradient(180deg, transparent, rgba(32, 20, 88, .5));
  filter: blur(16px);
}

@keyframes starDrift {
  from { transform: translateY(0); }
  to { transform: translateY(90px); }
}

/* 流星 */
.meteor {
  position: absolute;
  width: 180px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,.96), rgba(125,150,255,.75), rgba(125,150,255,.2), transparent);
  filter: drop-shadow(0 0 10px rgba(132, 151, 255, .9));
  transform: rotate(-28deg);
  opacity: 0;
  animation: meteorFly 5.6s linear infinite;
  pointer-events: none;
}

.meteor::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 0 10px #fff, 0 0 22px rgba(130, 160, 255, .95);
}

.meteor-1 { top: 70px; left: 55%; animation-delay: 0s; }
.meteor-2 { top: 150px; left: 86%; animation-delay: 1.7s; animation-duration: 6.4s; }
.meteor-3 { top: 250px; left: 96%; animation-delay: 3.4s; animation-duration: 7s; }

@keyframes meteorFly {
  0% { opacity: 0; transform: translate(0, 0) rotate(-28deg); }
  8% { opacity: 1; }
  70% { opacity: .9; }
  100% { opacity: 0; transform: translate(-560px, 320px) rotate(-28deg); }
}

/* 主创作面板 */
.main-create-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: min(1220px, calc(100% - 48px));
  margin: 28px auto 40px;
  padding: 30px 48px 52px;
  min-height: 820px;
  border-radius: 28px;
  overflow: visible;
  background:
    radial-gradient(circle at 50% 22%, rgba(100, 84, 255, .16), transparent 34%),
    linear-gradient(180deg, rgba(10, 16, 38, .76), rgba(5, 9, 24, .9));
  border: 1px solid rgba(120, 145, 255, .16);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 30px 90px rgba(0,0,0,.26);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ── 图片对话页 ── */
.image-chat-page {
  position: relative;
  min-height: calc(100vh - 56px);
  overflow-y: auto;
  padding-bottom: 150px;
  background:
    radial-gradient(circle at 50% -10%, rgba(90, 105, 255, .2), transparent 34%),
    radial-gradient(circle at 18% 38%, rgba(140, 80, 255, .12), transparent 28%),
    radial-gradient(circle at 82% 28%, rgba(70, 210, 255, .1), transparent 26%),
    linear-gradient(180deg, #040814 0%, #071126 50%, #030711 100%);
}

/* 科幻背景容器 */
.sci-fi-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* 网格透视层 */
.sci-fi-bg .grid-layer {
  position: absolute;
  left: -20%; right: -20%;
  bottom: -12%;
  height: 42%;
  opacity: .22;
  background-image:
    linear-gradient(rgba(105, 135, 255, .28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(105, 135, 255, .28) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(700px) rotateX(62deg);
  transform-origin: bottom center;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.6) 38%, rgba(0,0,0,1) 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.6) 38%, rgba(0,0,0,1) 100%);
}

/* 星点层 */
.sci-fi-bg .stars-layer {
  position: absolute;
  inset: 0;
  opacity: .34;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.8) 1px, transparent 1.4px),
    radial-gradient(circle, rgba(120,170,255,.55) 1px, transparent 1.4px),
    radial-gradient(circle, rgba(255,255,255,.3) 1px, transparent 1.4px);
  background-size: 160px 160px, 240px 240px, 360px 360px;
  background-position: 0 0, 60px 80px, 140px 160px;
  animation: chatStarDrift 42s linear infinite;
}

@keyframes chatStarDrift {
  from { transform: translateY(0); }
  to { transform: translateY(120px); }
}

/* 星云光晕 */
.sci-fi-bg .nebula-layer {
  position: absolute;
  inset: -20%;
  opacity: .7;
  filter: blur(36px);
  background:
    radial-gradient(circle at 45% 24%, rgba(112, 88, 255, .24), transparent 26%),
    radial-gradient(circle at 62% 50%, rgba(64, 190, 255, .14), transparent 24%),
    radial-gradient(circle at 30% 75%, rgba(150, 72, 255, .16), transparent 26%);
}

/* 流星 */
.sci-fi-bg .meteor {
  position: absolute;
  width: 130px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,.95), rgba(120,165,255,.6), transparent);
  filter: drop-shadow(0 0 6px rgba(255,255,255,.55)) drop-shadow(0 0 14px rgba(100,140,255,.55));
  opacity: 0;
  transform: rotate(-28deg);
  animation: chatMeteorFly 7s linear infinite;
}

.sci-fi-bg .meteor::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 5px; height: 5px;
  border-radius: 999px;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 0 14px rgba(255,255,255,.9);
}

.sci-fi-bg .meteor-1 { top: 120px; left: 86%; }
.sci-fi-bg .meteor-2 { top: 360px; left: 96%; animation-delay: 3.6s; animation-duration: 8.5s; }

@keyframes chatMeteorFly {
  0% { opacity: 0; transform: translate(0, 0) rotate(-28deg); }
  10% { opacity: .78; }
  100% { opacity: 0; transform: translate(-420px, 240px) rotate(-28deg); }
}

/* 聊天内容区 */
.image-chat-content {
  position: relative;
  z-index: 2;
  width: min(980px, calc(100% - 64px));
  margin: 44px auto 0;
  padding-bottom: 150px;
}

/* 聊天标题 */
.chat-title-block {
  text-align: center;
  margin-bottom: 28px;
}
.chat-title-block h1 {
  margin: 0;
  font-size: clamp(26px, 3.5vw, 38px);
  font-weight: 900;
  color: #eef4ff;
  text-shadow: 0 0 22px rgba(110, 130, 255, .18);
}
.chat-title-block p {
  margin: 8px 0 0;
  font-size: 14px;
  color: rgba(210, 224, 255, .58);
}

/* 聊天页输入栏 */
.chat-input-dock {
  position: fixed;
  left: calc(280px + (100vw - 280px) / 2);
  bottom: 24px;
  z-index: 50;
  width: min(980px, calc(100vw - 280px - 96px));
  transform: translateX(-50%);
  height: 68px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(15, 22, 46, .92), rgba(7, 11, 26, .94));
  border: 1px solid rgba(125, 150, 255, .34);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 20px 60px rgba(0,0,0,.45),
    0 0 38px rgba(95,130,255,.22);
}

/* 输入栏底部渐隐遮罩 */
.chat-input-dock::after {
  content: "";
  position: absolute;
  left: -24px; right: -24px;
  bottom: -24px;
  height: 120px;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4,7,17,0), rgba(4,7,17,.86) 42%, rgba(4,7,17,.96));
  border-radius: 28px;
}

.chat-input-dock textarea {
  flex: 1;
  height: 44px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f5f8ff;
  font-size: 15px;
  line-height: 44px;
  overflow: hidden;
}

.chat-input-dock textarea::placeholder {
  color: rgba(198, 214, 255, .52);
}

/* 聊天详情页 - 结果区布局 */
.image-thread-overlay {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 0 120px;
}

/* 聊天详情页 - 用户消息气泡 */
body.image-mode .image-message.user .image-message-bubble {
  margin-left: auto;
  width: fit-content;
  max-width: 520px;
  padding: 12px 18px;
  border-radius: 16px 16px 4px 16px;
  color: #f5f8ff;
  font-weight: 600;
  background: linear-gradient(135deg, #6d5cff, #58bfff);
  box-shadow: 0 12px 32px rgba(90, 130, 255, .24);
  border: none;
}

/* 聊天详情页 - 结果图片：裸展示 */
body.image-mode .image-message.assistant .image-message-bubble:has(.image-generated-grid) {
  max-width: min(820px, 88vw);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 36px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.image-mode .image-message.assistant .image-result-figure {
  position: relative;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  margin-bottom: 90px;
}

body.image-mode .image-message.assistant .image-result-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  object-fit: contain;
  border: 1px solid rgba(130, 160, 255, .18);
  box-shadow:
    0 28px 90px rgba(0,0,0,.46),
    0 0 36px rgba(80,130,255,.16);
}

/* 图片操作按钮 */
.image-result-tools {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: flex;
  gap: 8px;
}

.image-result-tools button,
.image-result-tools a {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(180, 205, 255, .18);
  color: #f5f8ff;
  font-size: 13px;
  font-weight: 800;
  background: rgba(4, 8, 20, .58);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.image-result-tools button:hover,
.image-result-tools a:hover {
  background: rgba(90, 120, 255, .24);
  border-color: rgba(130, 165, 255, .5);
}

/* 面板内星点层 - 稀疏、上密下疏 */
.main-create-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: .18;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.72) 1px, transparent 1.4px),
    radial-gradient(circle, rgba(125,160,255,.42) 1px, transparent 1.5px);
  background-size: 120px 120px, 190px 190px;
  background-position: 12px 20px, 58px 72px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,1) 0%, rgba(0,0,0,.7) 42%, rgba(0,0,0,.18) 76%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,1) 0%, rgba(0,0,0,.7) 42%, rgba(0,0,0,.18) 76%, rgba(0,0,0,0) 100%);
}

/* 面板内星云光晕 - 淡化 */
.panel-glow {
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 42%;
  width: 760px;
  height: 420px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle, rgba(112, 88, 255, .22), transparent 56%),
    radial-gradient(circle at 62% 45%, rgba(78, 190, 255, .10), transparent 44%);
  filter: blur(42px);
  opacity: .55;
  pointer-events: none;
}

/* 面板内流星 - 只保留 1 条，缩短、降亮 */
.panel-meteor-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.panel-meteor {
  position: absolute;
  width: 110px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,.85), rgba(135,165,255,.55), transparent);
  filter: drop-shadow(0 0 6px rgba(255,255,255,.45)) drop-shadow(0 0 12px rgba(100,140,255,.45));
  opacity: 0;
  transform: rotate(-28deg);
  animation: panelMeteorFly 6s linear infinite;
}

.panel-meteor::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 0 6px #fff, 0 0 14px rgba(110,160,255,.7);
}

.meteor-a { top: 92px; left: 88%; animation-delay: 0s; }
.meteor-b, .meteor-c { display: none; }

@keyframes panelMeteorFly {
  0% { opacity: 0; transform: translate(0, 0) rotate(-28deg); }
  10% { opacity: .75; }
  100% { opacity: 0; transform: translate(-260px, 150px) rotate(-28deg); }
}

/* 所有内容层在流星之上 */
.panel-meta-row,
.hero-header,
.image-thread-header,
.image-flow-wrap,
.image-showcase-shell,
.image-thread,
.image-error-panel,
.image-input-bar {
  position: relative;
  z-index: 2;
}

/* meta row */
.panel-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.engine-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(15, 22, 48, .72);
  border: 1px solid rgba(130, 150, 255, .24);
  color: rgba(230, 236, 255, .78);
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(16px);
}

.cost-pill {
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(15, 22, 48, .72);
  border: 1px solid rgba(130, 150, 255, .24);
  color: rgba(230, 236, 255, .78);
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(16px);
}

/* hero header */
.hero-header {
  position: relative;
  z-index: 5;
  text-align: center;
  padding-top: 0;
  margin-top: 0;
  margin-bottom: 0;
}

.hero-orb {
  display: none;
}

.hero-title {
  margin: 0;
  font-size: 42px;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -1.2px;
  color: #f7f9ff;
  text-shadow:
    0 0 22px rgba(110, 130, 255, .22),
    0 0 46px rgba(90, 160, 255, .14);
}

.title-soft {
  background: linear-gradient(90deg, #dfe8ff 0%, #8fdcff 45%, #b894ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.title-main {
  background: linear-gradient(90deg, #5fd3ff 0%, #7c7cff 45%, #b46cff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(125, 120, 255, .35));
}

.hero-subtitle {
  margin-top: 8px;
  color: rgba(210, 224, 255, .78);
  font-size: 14px;
}

/* 对话模式的标题 */
.image-thread-header {
  text-align: center;
  margin-bottom: 16px;
}

.image-thread-title {
  color: #eef4ff;
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 900;
  line-height: 1.1;
}

.image-thread-subtitle {
  margin-top: 8px;
  color: rgba(221, 230, 255, 0.58);
  font-size: 14px;
}

/* 比例按钮组 - 已移除，保留默认 1:1 */
.ratio-list { display: none; }

/* 图片流左右渐隐遮罩 - 轻薄 */
.image-mode .image-hero-wall::before,
.image-mode .image-showcase-wall::before,
.image-mode .image-gallery-wall::before,
.image-mode .image-first-screen-wall::before,
.image-mode .image-wall::before {
  width: 76px;
  background: linear-gradient(90deg, rgba(6, 10, 24, .72), transparent) !important;
}

.image-mode .image-hero-wall::after,
.image-mode .image-showcase-wall::after,
.image-mode .image-gallery-wall::after,
.image-mode .image-first-screen-wall::after,
.image-mode .image-wall::after {
  width: 76px;
  background: linear-gradient(270deg, rgba(6, 10, 24, .72), transparent) !important;
}

/* 图片流外层包裹 */
.image-flow-wrap {
  position: relative;
  z-index: 2;
  margin-top: 30px;
  height: 430px;
  overflow: hidden;
  border-radius: 22px;
}

/* showcase-shell 不裁切 */
.image-mode .image-showcase-shell {
  overflow: visible;
  mask-image: none;
  -webkit-mask-image: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0;
}

.image-mode .image-showcase-stage {
  grid-template-rows: repeat(2, 192px);
  gap: 22px;
  overflow: hidden;
}

.image-mode .image-showcase-card {
  flex: 0 0 286px;
  width: 286px;
  height: 192px;
  border-radius: 18px;
  border: 1px solid rgba(130, 150, 255, .16);
  box-shadow: 0 18px 42px rgba(0,0,0,.3), 0 0 20px rgba(90,110,255,.08);
  transition: .22s ease;
}

.image-mode .image-showcase-card:hover {
  border-color: rgba(130, 160, 255, .7);
  box-shadow: 0 22px 58px rgba(0,0,0,.42), 0 0 30px rgba(90,130,255,.26);
}

.image-mode .image-showcase-shell:hover .image-showcase-track,
.image-mode .image-showcase-wall:hover .image-showcase-track,
.image-mode .image-gallery-wall:hover .image-showcase-track,
.image-mode .image-wall:hover .image-showcase-track,
.image-mode .image-showcase-shell:hover .image-wall-track,
.image-mode .image-showcase-wall:hover .image-wall-track,
.image-mode .image-gallery-wall:hover .image-wall-track,
.image-mode .image-wall:hover .image-wall-track {
  animation-play-state: running !important;
}

/* 提示词按钮 - 发光模板卡 */
.image-style-strip {
  margin-top: 34px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.image-style-option {
  position: relative;
  min-height: 82px;
  padding: 16px 20px 16px 48px !important;
  border-radius: 18px !important;
  background:
    linear-gradient(180deg, rgba(28, 36, 76, .82), rgba(13, 20, 48, .78)) !important;
  border: 1px solid rgba(130, 150, 255, .22) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.07),
    0 18px 40px rgba(0,0,0,.24) !important;
  color: #f5f7ff;
  cursor: pointer;
  transition: .22s ease;
  overflow: hidden;
}

.image-style-option .image-style-mark {
  position: absolute;
  left: 20px;
  top: 18px;
  width: 7px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(180deg, #7b61ff, #5ecbff);
  box-shadow:
    0 0 12px rgba(120, 120, 255, .7),
    0 0 22px rgba(90, 200, 255, .28);
}

.image-style-copy strong {
  font-size: 16px !important;
  font-weight: 800 !important;
  color: #f5f8ff !important;
  text-shadow: 0 0 12px rgba(120, 145, 255, .22);
}

.image-style-copy small {
  margin-top: 4px;
  font-size: 12px !important;
  color: rgba(188, 210, 255, .76) !important;
}

.image-style-option:hover,
.image-style-option.active {
  transform: translateY(-3px);
  border-color: rgba(125, 150, 255, .85) !important;
  box-shadow:
    0 0 0 1px rgba(125, 150, 255, .18),
    0 22px 48px rgba(0,0,0,.34),
    0 0 34px rgba(95, 120, 255, .22) !important;
}

.image-style-option.active {
  background:
    linear-gradient(135deg, rgba(36, 46, 105, .88), rgba(12, 18, 44, .88)) !important;
}

/* 提示词卡 hover 流光 */
.image-style-option::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 36%;
  height: 220%;
  transform: rotate(22deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
  opacity: 0;
  pointer-events: none;
}

.image-style-option:hover::after {
  animation: cardSweep .9s ease-in-out;
}

@keyframes cardSweep {
  0% { left: -60%; opacity: 0; }
  30% { opacity: 1; }
  100% { left: 120%; opacity: 0; }
}

/* 隐藏图片模式底部固定输入框 */
body.image-mode .composer-wrap {
  display: none !important;
}

/* 输入栏 - 紧凑横条 */
.image-input-bar {
  position: relative;
  z-index: 3;
  margin-top: 58px;
  height: 68px;
  padding: 10px 12px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(18, 27, 62, .86), rgba(8, 14, 36, .9));
  border: 1px solid rgba(115, 140, 255, .34);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 14px 38px rgba(0,0,0,.28),
    0 0 26px rgba(100,120,255,.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.image-input-bar::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(120,140,255,.7), rgba(90,210,255,.5), transparent);
  pointer-events: none;
}

/* 参考图按钮 */
.image-input-with-attachments {
  height: auto;
  min-height: 68px;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.chat-input-dock.image-input-with-attachments {
  height: auto;
  min-height: 68px;
}

.image-input-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.image-panel-preview {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  padding: 2px 4px 0;
}

.image-input-with-attachments.has-attachments .image-panel-preview {
  display: flex;
}

.image-panel-preview .image-preview-chip {
  width: 54px;
  height: 54px;
  border-color: rgba(142, 158, 212, .32);
  background: rgba(255, 255, 255, .06);
}

.image-panel-preview .image-preview-chip button {
  top: 3px;
  right: 3px;
}

.input-tool-btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(130, 150, 255, .26);
  background: rgba(255,255,255,.045);
  color: rgba(220, 230, 255, .82);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .18s ease;
}

.input-tool-btn:hover {
  border-color: rgba(120, 150, 255, .58);
  background: rgba(110, 125, 255, .12);
}

.tool-icon {
  color: #7fd5ff;
}

/* 输入文字 */
.image-prompt-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: #f5f8ff;
  font-size: 15px;
  line-height: 44px;
  padding: 0 4px;
  overflow: hidden;
  white-space: nowrap;
}

.image-prompt-input::placeholder {
  color: rgba(190, 208, 255, .5);
}

/* 生成按钮 */
.generate-btn {
  height: 46px;
  min-width: 132px;
  padding: 0 22px;
  border: none;
  border-radius: 15px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(135deg, #7357ff 0%, #58c8ff 100%);
  box-shadow:
    0 0 16px rgba(116, 95, 255, .42),
    0 0 30px rgba(92, 202, 255, .24);
  cursor: pointer;
  flex-shrink: 0;
  transition: all .22s ease;
}

.generate-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 22px rgba(116, 95, 255, .58),
    0 0 42px rgba(92, 202, 255, .34);
}

.generate-btn:disabled {
  opacity: .72;
  cursor: not-allowed;
  background: linear-gradient(135deg, #6758dc 0%, #4caee2 100%);
}

/* ====== 生成中状态 ====== */

/* 图片流生成中遮罩 */
@media (max-width: 560px) {
  .image-input-controls {
    gap: 8px;
  }

  .input-tool-btn {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .input-tool-btn .tool-label {
    display: none;
  }

  .generate-btn {
    min-width: 104px;
    padding: 0 14px;
  }

}

.main-create-panel.is-generating .image-flow-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  border-radius: 22px;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 45%, rgba(105, 120, 255, .18), transparent 38%),
    linear-gradient(180deg, rgba(5, 8, 20, .08), rgba(5, 8, 20, .18));
  backdrop-filter: blur(1px);
}

/* 图片流扫描光 */
.image-flow-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  left: -35%;
  width: 28%;
  height: 100%;
  z-index: 9;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(120, 180, 255, .18),
    rgba(255, 255, 255, .28),
    rgba(120, 180, 255, .12),
    transparent
  );
  transform: skewX(-18deg);
  opacity: 0;
  pointer-events: none;
}

.main-create-panel.is-generating .image-flow-wrap::before {
  opacity: 1;
  animation: imageScan 1.8s ease-in-out infinite;
}

@keyframes imageScan {
  0% { left: -35%; }
  100% { left: 110%; }
}

/* 生成中图片流变慢 */
.main-create-panel.is-generating .image-showcase-track {
  animation-duration: 68s !important;
  filter: saturate(.92) brightness(.92);
}

/* 生成中 badge */
.generating-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 12;
  transform: translate(-50%, -50%) scale(.96);
  opacity: 0;
  pointer-events: none;
  min-width: 220px;
  padding: 18px 22px;
  border-radius: 20px;
  text-align: center;
  background: rgba(12, 18, 42, .78);
  border: 1px solid rgba(130, 160, 255, .36);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 0 36px rgba(100, 120, 255, .28),
    inset 0 1px 0 rgba(255,255,255,.08);
}

.main-create-panel.is-generating .generating-badge {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition: all .25s ease;
}

.generating-badge strong {
  display: block;
  margin-top: 8px;
  color: #f7f9ff;
  font-size: 17px;
  font-weight: 800;
}

.generating-badge p {
  margin-top: 6px;
  color: rgba(200, 218, 255, .7);
  font-size: 13px;
}

/* 星轨旋转 */
.magic-orbit {
  position: relative;
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(120, 160, 255, .35);
  box-shadow:
    0 0 18px rgba(100, 140, 255, .4),
    inset 0 0 18px rgba(80, 120, 255, .2);
}

.magic-orbit::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border-top: 2px solid #6fd4ff;
  border-right: 2px solid transparent;
  border-bottom: 2px solid #8b6cff;
  border-left: 2px solid transparent;
  animation: orbitSpin 1.1s linear infinite;
}

.magic-orbit::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #bfefff;
  font-size: 18px;
  text-shadow: 0 0 12px rgba(120, 210, 255, .9);
}

@keyframes orbitSpin {
  to { transform: rotate(360deg); }
}

/* 生成按钮 loading 状态 */
.generate-btn.loading {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  animation: generatePulse 1.6s ease-in-out infinite;
}

.generate-btn.loading::before {
  content: "";
  position: absolute;
  top: -70%;
  left: -45%;
  width: 34%;
  height: 240%;
  transform: rotate(24deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.85), transparent);
  animation: btnSweep 1.2s ease-in-out infinite;
}

.image-stop-generation {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.image-stop-generation:hover .thinking-label {
  text-decoration: underline;
}

@keyframes btnSweep {
  from { left: -45%; }
  to { left: 120%; }
}

@keyframes generatePulse {
  0%, 100% {
    box-shadow: 0 0 18px rgba(116, 95, 255, .42), 0 0 30px rgba(92, 202, 255, .24);
  }
  50% {
    box-shadow: 0 0 30px rgba(116, 95, 255, .78), 0 0 66px rgba(92, 202, 255, .5);
  }
}

/* loading dots */
.loading-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
}

.loading-dots i {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,.9);
  animation: dotBlink 1.1s infinite ease-in-out;
  font-style: normal;
}

.loading-dots i:nth-child(2) { animation-delay: .16s; }
.loading-dots i:nth-child(3) { animation-delay: .32s; }

@keyframes dotBlink {
  0%, 100% { opacity: .35; transform: scale(.75); }
  50% { opacity: 1; transform: scale(1.25); }
}

/* 线程结果叠加层 */
.image-thread-overlay {
  margin-top: 32px;
}

/* 新图浮现动画 */
.result-card.is-new,
.image-result-figure.is-new {
  animation: resultReveal .8s ease-out both;
}

@keyframes resultReveal {
  0% {
    opacity: 0;
    transform: scale(.92) translateY(16px);
    filter: blur(10px) brightness(1.4);
    box-shadow: 0 0 0 rgba(120, 160, 255, 0);
  }
  60% {
    opacity: 1;
    filter: blur(1px) brightness(1.12);
    box-shadow: 0 0 38px rgba(120, 160, 255, .38);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0) brightness(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-mode .image-wall-track,
  .image-mode .image-marquee-track,
  .image-mode .image-stream-track,
  .image-mode .image-hero-wall-track,
  .image-mode .image-studio-main:has(.image-empty-panel) .scene-preset-card,
  .image-mode .image-main:has(.image-empty-panel) .scene-preset-card,
  .stars-layer,
  .meteor,
  .panel-meteor,
  .hero-orb {
    animation: none;
  }
}

/* Final starfield override for the image conversation composer. */
body.image-mode .chat-input-dock,
body.image-mode .chat-input-dock.image-input-with-attachments {
  border-color: rgba(125, 150, 255, .38) !important;
  background: linear-gradient(180deg, rgba(15, 22, 46, .94), rgba(7, 11, 26, .96)) !important;
  box-shadow:
    0 20px 60px rgba(0,0,0,.48),
    0 0 42px rgba(95,130,255,.24),
    inset 0 1px 0 rgba(255,255,255,.09) !important;
  color: #f5f8ff !important;
}

body.image-mode .chat-input-dock::after {
  background: linear-gradient(180deg, rgba(4,7,17,0), rgba(4,7,17,.86) 42%, rgba(4,7,17,.96)) !important;
}

body.image-mode .chat-input-dock textarea,
body.image-mode .chat-input-dock .image-prompt-input {
  color: #f5f8ff !important;
}

body.image-mode .chat-input-dock textarea::placeholder,
body.image-mode .chat-input-dock .image-prompt-input::placeholder {
  color: rgba(198, 214, 255, .52) !important;
}

body.image-mode .chat-input-dock .input-tool-btn {
  border-color: rgba(130, 150, 255, .28) !important;
  background: rgba(255,255,255,.055) !important;
  color: rgba(220, 230, 255, .86) !important;
}

body.image-mode .chat-input-dock .input-tool-btn:hover {
  border-color: rgba(120, 180, 255, .62) !important;
  background: rgba(110, 125, 255, .14) !important;
}

body.image-mode .chat-input-dock .tool-icon,
body.image-mode .chat-input-dock .image-style-toggle-btn .tool-icon {
  color: #7fd5ff !important;
}

body.image-mode .chat-input-dock .generate-btn {
  background: linear-gradient(135deg, #7357ff 0%, #58c8ff 100%) !important;
  box-shadow:
    0 0 16px rgba(116, 95, 255, .44),
    0 0 34px rgba(92, 202, 255, .28) !important;
  color: #fff !important;
}

body.image-mode .chat-input-dock .image-style-selected {
  border-color: rgba(130, 150, 255, .24) !important;
  background: rgba(255,255,255,.055) !important;
  color: rgba(221, 231, 255, .76) !important;
}

body.image-mode .chat-input-dock .image-style-selected strong {
  color: #eef4ff !important;
}

body.image-mode .chat-input-dock .image-style-selected span {
  color: rgba(210, 224, 255, .62) !important;
}

/* Image mode starfield restore: keep new controls, restore the previous space visual system. */
body.image-mode {
  --image-text: #f3f7ff;
  --image-muted: rgba(210, 224, 255, .66);
  --image-line: rgba(130, 150, 255, .22);
  --image-panel: rgba(9, 14, 31, .86);
  --image-panel-soft: rgba(15, 22, 46, .78);
  --image-blue: #5fc7ff;
  --image-violet: #7b61ff;
}

body.image-mode .conversation.image-studio-host {
  background:
    radial-gradient(circle at 50% -10%, rgba(90, 105, 255, .22), transparent 34%),
    radial-gradient(circle at 18% 38%, rgba(140, 80, 255, .14), transparent 28%),
    radial-gradient(circle at 82% 28%, rgba(70, 210, 255, .12), transparent 26%),
    linear-gradient(180deg, #040814 0%, #071126 50%, #030711 100%) !important;
}

body.image-mode .cosmic-bg,
body.image-mode .sci-fi-bg,
body.image-mode .stars-layer,
body.image-mode .nebula-layer,
body.image-mode .meteor,
body.image-mode .panel-meteor-layer {
  opacity: 1;
  filter: none;
}

body.image-mode .main-create-panel {
  color: var(--image-text);
  border: 1px solid rgba(120, 145, 255, .18);
  background:
    radial-gradient(circle at 50% 20%, rgba(110, 92, 255, .18), transparent 34%),
    radial-gradient(circle at 82% 38%, rgba(56, 199, 255, .10), transparent 28%),
    linear-gradient(180deg, rgba(10, 16, 38, .76), rgba(5, 9, 24, .91)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 30px 90px rgba(0,0,0,.30),
    0 0 74px rgba(70, 90, 255, .12);
}

body.image-mode .image-chat-content {
  color: var(--image-text);
}

body.image-mode .hero-title,
body.image-mode .chat-title-block h1 {
  color: #eef4ff;
  text-shadow:
    0 0 22px rgba(110, 130, 255, .22),
    0 0 46px rgba(90, 160, 255, .14);
}

body.image-mode .title-soft {
  background: linear-gradient(90deg, #dfe8ff 0%, #8fdcff 45%, #b894ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.image-mode .title-main {
  background: linear-gradient(90deg, #5fd3ff 0%, #7c7cff 45%, #b46cff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(125, 120, 255, .35));
}

body.image-mode .hero-subtitle,
body.image-mode .chat-title-block p {
  color: rgba(210, 224, 255, .70);
}

body.image-mode .engine-pill,
body.image-mode .cost-pill {
  border-color: rgba(130, 150, 255, .24);
  background: rgba(15, 22, 48, .72);
  color: rgba(230, 236, 255, .78);
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
}

body.image-mode .image-flow-wrap {
  height: 430px;
  margin-top: 30px;
}

body.image-mode .image-showcase-stage {
  display: grid;
  grid-template-rows: repeat(2, 192px);
  gap: 22px;
  overflow: hidden;
}

body.image-mode .image-showcase-row {
  min-height: 192px;
}

body.image-mode .image-showcase-card {
  flex: 0 0 286px;
  width: 286px;
  height: 192px;
  border-color: rgba(130, 150, 255, .20);
  background: rgba(12, 19, 38, .82);
  box-shadow: 0 18px 42px rgba(0,0,0,.32), 0 0 20px rgba(90,110,255,.10);
}

body.image-mode .image-input-bar,
body.image-mode .chat-input-dock {
  border-color: rgba(125, 150, 255, .34);
  background: linear-gradient(180deg, rgba(15, 22, 46, .92), rgba(7, 11, 26, .94)) !important;
  box-shadow:
    0 20px 60px rgba(0,0,0,.45),
    0 0 38px rgba(95,130,255,.22),
    inset 0 1px 0 rgba(255,255,255,.08);
}

body.image-mode .image-input-bar {
  margin-top: 58px;
}

body.image-mode .chat-input-dock::after {
  background: linear-gradient(180deg, rgba(4,7,17,0), rgba(4,7,17,.86) 42%, rgba(4,7,17,.96));
}

body.image-mode .image-prompt-input,
body.image-mode .chat-input-dock textarea {
  color: #f5f8ff;
}

body.image-mode .image-prompt-input::placeholder,
body.image-mode .chat-input-dock textarea::placeholder {
  color: rgba(198, 214, 255, .52);
}

body.image-mode .input-tool-btn {
  border-color: rgba(130, 150, 255, .26);
  background: rgba(255,255,255,.045);
  color: rgba(220, 230, 255, .82);
}

body.image-mode .input-tool-btn:hover {
  border-color: rgba(120, 150, 255, .58);
  background: rgba(110, 125, 255, .12);
}

body.image-mode .input-tool-btn:disabled {
  opacity: .48;
  cursor: not-allowed;
}

body.image-mode .tool-icon,
body.image-mode .image-style-toggle-btn .tool-icon {
  color: #7fd5ff;
}

body.image-mode .generate-btn {
  background: linear-gradient(135deg, #7357ff 0%, #58c8ff 100%) !important;
  box-shadow:
    0 0 16px rgba(116, 95, 255, .42),
    0 0 30px rgba(92, 202, 255, .24) !important;
  color: #fff;
}

body.image-mode .generate-btn:hover {
  box-shadow:
    0 0 22px rgba(116, 95, 255, .58),
    0 0 42px rgba(92, 202, 255, .34) !important;
}

body.image-mode .image-style-popover .image-style-panel,
body.image-mode .image-style-panel {
  border-color: rgba(125, 150, 255, .30);
  background: linear-gradient(180deg, rgba(16, 24, 52, .96), rgba(8, 12, 29, .96));
  box-shadow:
    0 24px 70px rgba(0,0,0,.45),
    0 0 42px rgba(95,130,255,.18),
    inset 0 1px 0 rgba(255,255,255,.08);
}

body.image-mode .image-style-panel-head strong,
body.image-mode .image-style-category strong,
body.image-mode .image-style-preset strong,
body.image-mode .image-style-selected strong {
  color: #eef4ff;
}

body.image-mode .image-style-panel-head span,
body.image-mode .image-style-category small,
body.image-mode .image-style-preset span,
body.image-mode .image-style-selected span {
  color: rgba(210, 224, 255, .62);
}

body.image-mode .image-style-category,
body.image-mode .image-style-preset {
  border-color: rgba(130, 150, 255, .22);
  background: rgba(255,255,255,.045);
  color: #eef4ff;
}

body.image-mode .image-style-category:hover,
body.image-mode .image-style-preset:hover {
  border-color: rgba(120, 180, 255, .58);
  background: rgba(110, 125, 255, .12);
  box-shadow: 0 14px 34px rgba(0,0,0,.24), 0 0 24px rgba(90, 140, 255, .16);
}

body.image-mode .image-style-category.active,
body.image-mode .image-style-preset.active {
  border-color: rgba(126, 213, 255, .70);
  background: linear-gradient(180deg, rgba(76, 102, 185, .34), rgba(30, 54, 102, .30));
  box-shadow: 0 0 0 3px rgba(95, 199, 255, .12), 0 0 30px rgba(95, 199, 255, .18);
}

body.image-mode .image-style-category-icon {
  background: rgba(125, 150, 255, .16);
  color: #9edfff;
}

body.image-mode .image-style-category em,
body.image-mode .image-style-preset-meta em,
body.image-mode .image-style-preset-meta i {
  border-color: rgba(130, 150, 255, .24);
  background: rgba(255,255,255,.055);
  color: rgba(221, 231, 255, .76);
}

body.image-mode .image-style-notice,
body.image-mode .image-style-selected {
  border-color: rgba(130, 150, 255, .24);
  background: rgba(255,255,255,.055);
  color: rgba(221, 231, 255, .76);
}

body.image-mode .image-style-selected button {
  border-color: rgba(126, 213, 255, .34);
  background: rgba(95, 199, 255, .10);
  color: #9edfff;
}

body.image-mode .image-message.user .image-message-bubble {
  background: linear-gradient(135deg, #6d5cff, #58bfff);
}

body.image-mode .image-message-bubble {
  border-color: rgba(130, 150, 255, .18);
  background: rgba(13, 20, 48, .76);
  color: #eef4ff;
}

/* Image style prompt library - warm sand creative workspace */
body.image-mode {
  --image-sand-bg: #f4ead8;
  --image-sand-panel: rgba(255, 252, 244, .82);
  --image-sand-panel-strong: rgba(255, 250, 238, .94);
  --image-sand-line: rgba(156, 137, 101, .24);
  --image-sand-line-blue: rgba(107, 130, 156, .24);
  --image-sand-text: #28313a;
  --image-sand-muted: #69727c;
  --image-sand-soft: #ece0cb;
  --image-accent-blue: #3d76a8;
  --image-accent-cyan: #4f9aa8;
}

body.image-mode .conversation.image-studio-host {
  background:
    linear-gradient(135deg, rgba(255, 253, 247, .86), rgba(243, 232, 211, .86)),
    radial-gradient(circle at 14% 18%, rgba(125, 157, 178, .16), transparent 30%),
    radial-gradient(circle at 86% 8%, rgba(214, 190, 135, .22), transparent 28%);
}

body.image-mode .cosmic-bg,
body.image-mode .sci-fi-bg,
body.image-mode .stars-layer,
body.image-mode .nebula-layer,
body.image-mode .meteor,
body.image-mode .panel-meteor-layer {
  opacity: .16;
  filter: saturate(.42) sepia(.18) brightness(1.45);
}

body.image-mode .main-create-panel,
body.image-mode .image-chat-content {
  color: var(--image-sand-text);
}

body.image-mode .main-create-panel {
  border: 1px solid rgba(172, 151, 111, .22);
  background:
    linear-gradient(180deg, rgba(255, 252, 244, .72), rgba(248, 241, 228, .54)),
    linear-gradient(135deg, rgba(107, 130, 156, .08), rgba(217, 196, 152, .10));
  box-shadow: 0 24px 70px rgba(128, 103, 64, .14);
}

body.image-mode .hero-title,
body.image-mode .chat-title-block h1 {
  color: #26323b;
  text-shadow: none;
}

body.image-mode .title-soft,
body.image-mode .title-main {
  background: linear-gradient(90deg, #313a42 0%, #557d91 48%, #9f8758 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: none;
}

body.image-mode .hero-subtitle,
body.image-mode .chat-title-block p {
  color: rgba(66, 76, 86, .72);
}

body.image-mode .engine-pill,
body.image-mode .cost-pill {
  border-color: var(--image-sand-line);
  background: rgba(255, 252, 244, .74);
  color: #53606a;
  box-shadow: 0 8px 24px rgba(135, 112, 74, .08);
}

.image-style-panel {
  position: relative;
  z-index: 3;
  display: grid;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--image-sand-line);
  border-radius: 18px;
  background: var(--image-sand-panel);
  box-shadow: 0 16px 44px rgba(119, 97, 62, .12), inset 0 1px 0 rgba(255,255,255,.72);
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

.image-style-panel:not(.is-expanded) {
  gap: 12px;
}

.image-style-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 12px);
  z-index: 80;
}

.image-style-popover .image-style-panel {
  max-height: min(56vh, 520px);
  overflow: hidden;
  background: rgba(255, 252, 244, .96);
  box-shadow: 0 24px 70px rgba(72, 58, 35, .22), inset 0 1px 0 rgba(255,255,255,.78);
}

.image-style-popover .image-style-presets-grid {
  max-height: min(34vh, 260px);
}

.image-style-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-style-panel-head strong {
  display: block;
  color: #28313a;
  font-size: 15px;
  font-weight: 850;
}

.image-style-panel-head span {
  display: block;
  margin-top: 2px;
  color: var(--image-sand-muted);
  font-size: 12px;
}

.image-style-categories {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  gap: 8px;
  min-width: 0;
}

.image-style-category,
.image-style-preset {
  appearance: none;
  min-width: 0;
  border: 1px solid rgba(158, 141, 107, .22);
  background: rgba(255, 254, 250, .64);
  color: #2d363f;
  cursor: pointer;
  text-align: left;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.image-style-category {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-areas:
    "icon copy"
    "count copy";
  gap: 4px 8px;
  min-height: 74px;
  padding: 10px;
  border-radius: 14px;
}

.image-style-category:hover,
.image-style-preset:hover {
  transform: translateY(-1px);
  border-color: rgba(61, 118, 168, .42);
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 10px 28px rgba(91, 116, 143, .12);
}

.image-style-category.active,
.image-style-preset.active {
  border-color: rgba(61, 118, 168, .62);
  background: linear-gradient(180deg, rgba(255, 255, 252, .92), rgba(237, 247, 249, .78));
  box-shadow: 0 0 0 3px rgba(77, 154, 168, .12), 0 12px 30px rgba(83, 118, 140, .14);
}

.image-style-category-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(232, 220, 196, .76);
  color: #637586;
  font-size: 12px;
  font-weight: 850;
}

.image-style-category-copy {
  grid-area: copy;
  min-width: 0;
}

.image-style-category strong,
.image-style-preset strong {
  display: block;
  overflow: hidden;
  color: #27323b;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-style-category small,
.image-style-preset span {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  color: #69747e;
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.image-style-category em {
  grid-area: count;
  color: #7d6b48;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.image-style-presets {
  min-width: 0;
}

.image-style-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 218px;
  overflow: auto;
  padding-right: 4px;
}

.image-style-preset {
  display: grid;
  align-content: start;
  min-height: 84px;
  padding: 10px;
  border-radius: 13px;
}

.image-style-preset-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.image-style-preset-meta em,
.image-style-preset-meta i {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(107, 130, 156, .22);
  background: rgba(246, 240, 228, .72);
  color: #6a7480;
  font-size: 10px;
  font-style: normal;
  font-weight: 750;
}

.image-style-preset-meta em {
  border-color: rgba(168, 93, 77, .20);
  color: #8b5a4d;
}

.image-style-notice,
.image-style-selected {
  border: 1px solid rgba(107, 130, 156, .22);
  background: rgba(248, 245, 236, .78);
  color: #53606a;
}

.image-style-notice {
  margin-bottom: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.image-style-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 13px;
}

.image-style-selected div {
  min-width: 0;
}

.image-style-selected strong {
  display: block;
  color: #29333d;
  font-size: 13px;
}

.image-style-selected span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #69747e;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-style-selected button {
  flex: 0 0 auto;
  border: 1px solid rgba(61, 118, 168, .28);
  border-radius: 999px;
  background: rgba(255, 255, 255, .66);
  color: var(--image-accent-blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
}

body.image-mode .image-input-bar,
body.image-mode .chat-input-dock {
  border-color: rgba(156, 137, 101, .30);
  background: rgba(255, 251, 242, .88);
  box-shadow: 0 18px 48px rgba(118, 94, 58, .15), inset 0 1px 0 rgba(255,255,255,.78);
}

body.image-mode .chat-input-dock::after {
  background: linear-gradient(180deg, rgba(244,234,216,0), rgba(244,234,216,.78) 48%, rgba(244,234,216,.94));
}

body.image-mode .image-prompt-input,
body.image-mode .chat-input-dock textarea {
  color: #26313a;
}

body.image-mode .image-prompt-input::placeholder,
body.image-mode .chat-input-dock textarea::placeholder {
  color: rgba(91, 101, 110, .58);
}

body.image-mode .input-tool-btn {
  border-color: rgba(107, 130, 156, .24);
  background: rgba(255,255,255,.58);
  color: #52606b;
}

body.image-mode .input-tool-btn:hover {
  border-color: rgba(61, 118, 168, .46);
  background: rgba(237, 247, 249, .78);
}

body.image-mode .input-tool-btn:disabled {
  opacity: .48;
  cursor: not-allowed;
  transform: none;
}

body.image-mode .image-style-toggle-btn {
  border-color: rgba(156, 137, 101, .28);
  background: rgba(248, 245, 236, .72);
}

body.image-mode .image-style-toggle-btn .tool-icon {
  color: #9b7d45;
}

body.image-mode .tool-icon {
  color: var(--image-accent-cyan);
}

body.image-mode .generate-btn {
  background: linear-gradient(135deg, #3d76a8, #4f9aa8);
  box-shadow: 0 12px 28px rgba(61, 118, 168, .22);
}

body.image-mode .image-message.user .image-message-bubble {
  background: linear-gradient(135deg, #4f8cac, #4f9aa8);
}

body.image-mode .image-message-bubble {
  border-color: rgba(156, 137, 101, .18);
  background: rgba(255, 251, 243, .80);
  color: #27313a;
}

@media (max-width: 980px) {
  .image-style-categories {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .image-style-category {
    flex: 0 0 142px;
  }

  .image-style-presets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .image-style-popover {
    bottom: calc(100% + 8px);
  }

  .image-style-panel {
    padding: 11px;
    border-radius: 15px;
  }

  .image-style-presets-grid {
    grid-template-columns: 1fr;
    max-height: 220px;
  }

  .image-style-selected {
    align-items: stretch;
    flex-direction: column;
  }

  .image-style-selected button {
    align-self: flex-start;
  }
}
    0 0 0 1px rgba(120, 145, 255, 0.25),
    0 0 32px rgba(92, 113, 255, 0.22) !important;
}

/* 生成按钮流星充能 */
body.image-mode .send-button.ready {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #7357ff 0%, #5fc7ff 100%) !important;
  box-shadow:
    0 0 18px rgba(116, 95, 255, 0.45),
    0 0 36px rgba(95, 199, 255, 0.28) !important;
  color: #fff !important;
}

body.image-mode .generating .send-button.ready,
body.image-mode .generating .send-button.ready:hover {
  pointer-events: none;
  cursor: wait;
  animation: imageGenerateGlow 1.8s infinite ease-in-out;
}

body.image-mode .generating .send-button.ready::before {
  content: "";
  position: absolute;
  top: -60%;
  left: -45%;
  width: 36%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.82), transparent);
  transform: rotate(22deg);
  animation: imageButtonMeteorSweep 1.35s infinite ease-in-out;
}

@keyframes imageButtonMeteorSweep {
  0% { left: -45%; opacity: 0; }
  20% { opacity: 1; }
  100% { left: 120%; opacity: 0; }
}

@keyframes imageGenerateGlow {
  0%, 100% {
    box-shadow:
      0 0 16px rgba(116, 95, 255, 0.45),
      0 0 30px rgba(95, 199, 255, 0.25);
  }
  50% {
    box-shadow:
      0 0 28px rgba(116, 95, 255, 0.75),
      0 0 58px rgba(95, 199, 255, 0.48);
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-mode .image-wall-track,
  .image-mode .image-marquee-track,
  .image-mode .image-stream-track,
  .image-mode .image-hero-wall-track,
  .image-mode .image-studio-main:has(.image-empty-panel) .scene-preset-card,
  .image-mode .image-main:has(.image-empty-panel) .scene-preset-card,
  .image-mode .image-meteor {
    animation: none;
  }
}

