*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
* {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.bubble,
#user-input,
textarea,
.bubble * {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}
#error-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 21000;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: min(420px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: 14px 16px;
  border: 0;
  border-radius: 15px;
  background: rgba(35, 35, 35, 0.42);
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
  opacity: 0;
  transform: translateX(-50%) translateY(-14px) !important;
  transition:
    opacity 0.22s ease,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast-visible {
  opacity: 1 !important;
  transform: translateX(-50%) translateY(0) !important;
}
#error-toast .error-toast-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#error-toast button {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: 20px/1 inherit;
  cursor: pointer;
  padding: 0;
}
#error-toast button:hover {
  background: rgba(255, 255, 255, 0.15);
}
.bubble pre,
.bubble code,
.bubble .code-header {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}
input:focus,
textarea:focus,
select:focus,
button:focus {
  outline: none !important;
  box-shadow: none !important;
}

:root {
  --bg: #111111;
  --sidebar-bg: rgba(20, 20, 20, 0.45);
  --surface: #232323;
  --surface2: #2a2a2a;
  --border: #333333;
  --text: #ececec;
  --muted: #888888;
  --subtle: #232323;
  --accent: #555555;
  --accent-primary: #1f6feb;
  --accent2: #aaaaaa;
  --accent-glow: rgba(150, 150, 150, 0.12);
  --accent-hover: #444444;
  --danger: #f85149;
  --user-bubble: #2a2a2a;
  --user-text: #ffffff;
  --ai-bubble: #1c1c1c;
  --ai-border: #333333;
  --sidebar-w: 260px;
  --sidebar-icon-w: 56px;
}

html,
body {
  height: 100%;
  font-family:
    "Manrope",
    -apple-system,
    sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  touch-action: pan-x pan-y;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  position: relative;
}

#sidebar {
  width: var(--sidebar-w);
  height: 100%;
  height: 100dvh;
  background: transparent;
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-right: none;
  display: flex;
  flex-direction: column;
  transition: width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  will-change: width;
}
#sidebar.collapsed {
  width: var(--sidebar-icon-w);
}
#sidebar:has(#settings-popup.open) {
  overflow: visible;
}

#sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 1px;
  background: var(--border);
  opacity: 0.5;
  pointer-events: none;
}
#sidebar,
.settings-sidenav {
  background: transparent !important;
}
#sidebar::after {
  background: rgba(255, 255, 255, 0.08);
}
.settings-sidenav,
.settings-detail-content {
  scrollbar-width: none;
}
.settings-sidenav::-webkit-scrollbar,
.settings-detail-content::-webkit-scrollbar {
  display: none;
}

.sb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  min-height: 52px;
  transition:
    justify-content 0s 0.16s,
    padding 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
#sidebar.collapsed .sb-top {
  justify-content: center;
  padding: 12px 0 10px;
}
.sb-top-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.sb-search-expanded-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}
.sb-search-expanded-btn:hover {
  background: var(--surface2);
  color: var(--text);
}
#sidebar.collapsed .sb-search-expanded-btn {
  display: none;
}
.sb-logo {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  transition:
    opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
    max-width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 180px;
}
.sb-logo-icon {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  flex-shrink: 0;
  object-fit: contain;
}
#sidebar.collapsed .sb-logo {
  opacity: 0;
  max-width: 0;
}
.sb-toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.sb-toggle:hover {
  background: var(--surface2);
  color: var(--text);
}
.sb-toggle-logo {
  display: none;
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 6px;
  position: absolute;
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}
.sb-toggle-icon {
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}
#sidebar.collapsed .sb-toggle {
  position: relative;
}
#sidebar.collapsed .sb-toggle-logo {
  display: block;
  opacity: 1;
  transform: scale(1);
}
#sidebar.collapsed .sb-toggle-icon {
  opacity: 0;
  transform: scale(0.86);
}
#sidebar.collapsed .sb-toggle:hover .sb-toggle-logo {
  opacity: 0;
  transform: scale(0.86);
}
#sidebar.collapsed .sb-toggle:hover .sb-toggle-icon {
  opacity: 1;
  transform: scale(1);
}

.sb-actions {
  padding: 8px 8px 4px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#sidebar.collapsed .sb-actions {
  padding: 8px 0 4px;
  justify-content: center;
}
.new-chat-btn {
  flex: 1;
  padding: 9px 14px;
  background: var(--surface);
  border: none;
  border-radius: 20px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  transition:
    background 0.18s,
    width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    gap 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  overflow: hidden;
}
.new-chat-btn:hover {
  background: var(--surface2);
}
.new-chat-btn svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}
.new-chat-btn span {
  transition:
    opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    max-width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 200px;
  overflow: hidden;
}
#sidebar.collapsed .new-chat-btn {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  gap: 0;
}
#sidebar.collapsed .new-chat-btn span {
  display: none !important;
}

.sb-search-collapsed-btn {
  display: none;
}
.sb-search {
  padding: 6px 10px;
  flex-shrink: 0;
  overflow: hidden;
  transition:
    max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.32s;
}
.sb-search input {
  width: 100%;
  padding: 9px 14px;
  background: var(--surface);
  border: none;
  border-radius: 20px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: background 0.2s;
}
.sb-search input:focus {
  background: var(--surface2);
}
.sb-search input::placeholder {
  color: var(--muted);
}
#sidebar.collapsed .sb-search {
  padding: 6px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
#sidebar.collapsed .sb-search input {
  display: none;
}
#sidebar.collapsed .sb-search-collapsed-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  background: var(--surface);
  border: none;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}
#sidebar.collapsed .sb-search-collapsed-btn:hover {
  background: #2e2e2e;
  color: var(--text);
}
#sidebar:not(.collapsed) .sb-search {
  display: none;
}
#sidebar.collapsed .sb-actions {
  align-items: center;
}
#sidebar.collapsed .sb-toggle,
#sidebar.collapsed .new-chat-btn,
#sidebar.collapsed .sb-search-collapsed-btn,
#sidebar.collapsed .sb-footer-btn {
  color: #fff;
}
#sidebar .sb-nav-btn > svg,
#settings-btn > svg {
  color: #fff;
}
body.theme-light #sidebar .sb-nav-btn > svg,
body.theme-light #settings-btn > svg,
html[data-theme="light"] #sidebar .sb-nav-btn > svg,
html[data-theme="light"] #settings-btn > svg {
  color: #1a1a1a;
}
body.theme-light #sidebar .sb-nav-btn,
html[data-theme="light"] #sidebar .sb-nav-btn {
  color: #1a1a1a;
}
.data-control-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: currentColor;
}
.data-control-icon svg {
  width: 100%;
  height: 100%;
}
.settings-sidenav-item .data-control-icon {
  width: 14px;
  height: 14px;
}
@media (min-width: 641px) {
  #error-toast {
    left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2) !important;
  }
  #sidebar.collapsed ~ #main #error-toast {
    left: calc(
      var(--sidebar-icon-w) + (100vw - var(--sidebar-icon-w)) / 2
    ) !important;
  }
}

.chat-search-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 18px;
}
.chat-search-screen.open {
  display: flex;
}
.chat-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.chat-search-box {
  position: relative;
  width: min(720px, 100%);
  min-height: 430px;
  max-height: calc(100dvh - 80px);
  overflow: auto;
  border-radius: 17px;
  background: var(--surface);
  padding: 18px 26px;
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transition:
    opacity 0.22s ease,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.chat-search-screen.visible .chat-search-backdrop {
  opacity: 1;
}
.chat-search-screen.visible .chat-search-box {
  opacity: 1;
  transform: none;
}
.chat-search-head {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.chat-search-head input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 14px inherit;
  padding: 10px 0 14px;
}
.chat-search-head input::placeholder {
  color: var(--muted);
}
.chat-search-head button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition:
    background 0.15s,
    color 0.15s;
}
.chat-search-head button:hover {
  background: var(--surface);
  color: var(--text);
}
.chat-search-label {
  margin: 26px 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.chat-search-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-search-result {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 12px 6px;
  border-radius: 8px;
  text-align: left;
  font: 500 14px inherit;
  cursor: pointer;
}
.chat-search-result:hover {
  background: var(--surface2);
}
.chat-search-result svg {
  color: #fff;
  flex-shrink: 0;
}
.chat-search-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 14px 6px;
}
.guest-feature-popover {
  position: fixed;
  z-index: 9500;
  width: min(290px, calc(100vw - 24px));
  padding: 14px 16px 12px;
  border-radius: 13px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(-5px);
  pointer-events: none;
  transition:
    opacity 0.14s ease,
    transform 0.14s ease;
}
.guest-feature-popover.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.guest-feature-popover strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}
.guest-feature-popover p {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.guest-feature-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.guest-feature-actions button {
  border-radius: 999px;
  padding: 8px 12px;
  font: 600 13px inherit;
  cursor: pointer;
}
.guest-feature-login {
  border: 0;
  background: var(--text);
  color: var(--bg);
}
.guest-login-cta {
  border: 0;
  cursor: default;
}
.guest-login-button {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: 700 12px inherit;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.guest-login-button:hover {
  background: var(--surface2);
  border-color: var(--muted);
}
.guest-login-button:focus-visible {
  outline: 1px solid var(--accent-primary, #1f6feb);
  outline-offset: 3px;
}
.chat-search-head input {
  font-size: 16px;
}
.chat-search-head input::placeholder {
  color: var(--text);
  opacity: 0.9;
}
.chat-search-label {
  display: none;
}
.chat-search-empty {
  color: var(--muted);
  font-size: 16px;
  padding: 32px 6px;
  text-align: center;
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 6px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.conv-list::-webkit-scrollbar {
  width: 3px;
  background: transparent;
}
.conv-list::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 2px;
}
#sidebar.collapsed .conv-list {
  padding: 4px 2px;
}

.conv-group-label {
  font-size: 10px;
  color: var(--muted);
  padding: 8px 8px 3px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  transition:
    opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.32s,
    padding 0.32s;
}
#sidebar.collapsed .conv-group-label {
  opacity: 0;
  height: 0;
  padding: 0;
}

.conv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.18s ease,
    padding 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  margin-bottom: 1px;
  min-height: 36px;
  overflow: hidden;
}
.conv-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.conversation-fade-in {
  animation: conversationFadeIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes conversationFadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.conv-item.active {
  background: rgba(255, 255, 255, 0.075);
}
.conv-title {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  transition:
    opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.32s;
}
#sidebar.collapsed .conv-title {
  opacity: 0;
  width: 0;
}
#sidebar.collapsed .conv-item {
  justify-content: center;
  padding: 8px;
}
.conv-item .conv-icon {
  display: none;
  flex-shrink: 0;
  color: var(--muted);
}
#sidebar.collapsed .conv-item .conv-icon {
  display: flex;
}

.conv-menu-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  visibility: hidden;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  transition: background 0.1s;
  display: flex;
}
.conv-item:hover .conv-menu-btn,
.conv-item.active .conv-menu-btn {
  visibility: visible;
}
.conv-menu-btn:hover {
  background: var(--surface2);
  color: var(--text);
}
#sidebar.collapsed .conv-menu-btn {
  display: none !important;
}

.sb-footer {
  padding: 12px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: padding 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
#sidebar.collapsed .sb-footer {
  padding: 12px 0 16px;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.sb-footer-btn {
  width: 100%;
  padding: 9px 10px;
  background: none;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  transition:
    background 0.15s,
    border-color 0.15s,
    width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    gap 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  overflow: hidden;
}
.sb-footer-btn:hover {
  background: var(--surface);
  border-color: var(--border);
}
.sb-footer-btn.settings-trigger {
  background: var(--surface);
  border: none;
  border-radius: 20px;
  height: 36px;
  padding: 0 14px;
  transition: background 0.18s;
}
.sb-footer-btn.settings-trigger:hover {
  background: var(--surface2);
}
.sb-footer-btn svg {
  flex-shrink: 0;
  color: var(--accent2);
}
.sb-footer-btn span {
  transition:
    opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    max-width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 200px;
  overflow: hidden;
}
#sidebar.collapsed .sb-footer-btn {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  margin: 0 auto;
}
#sidebar.collapsed .sb-footer-btn span {
  display: none;
}
.profile-row {
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: 9px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  transition:
    background 0.18s,
    width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    gap 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  overflow: hidden;
}
.profile-row:hover {
  background: var(--surface);
}
#sidebar.collapsed .profile-row {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  background: #252525;
  margin: 0 auto;
  gap: 0;
}
#sidebar.collapsed .profile-info {
  display: none !important;
}
#sidebar.collapsed .signout-btn {
  display: none !important;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}
.profile-info {
  flex: 1;
  overflow: hidden;
  transition:
    opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    max-width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 160px;
  text-align: left;
}
#sidebar.collapsed .profile-info {
  opacity: 0;
  max-width: 0;
}
.profile-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.signout-btn {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s;
  display: flex;
}
.signout-btn:hover {
  color: var(--danger);
}
#sidebar.collapsed .signout-btn {
  display: none;
}
.guest-login-cta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 16px);
  margin: 8px;
  padding: 4px 0 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.guest-login-cta strong {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}
.guest-login-cta span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.guest-login-cta b {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.guest-login-cta:hover b {
  background: var(--surface2);
  border-color: var(--muted);
}
.guest-login-cta:focus-visible {
  outline: 1px solid var(--accent-primary, #1f6feb);
  outline-offset: 3px;
}
#sidebar.collapsed .guest-login-cta {
  display: none !important;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
  background: var(--bg);
}
#main.has-welcome {
  background:
    radial-gradient(
      ellipse 75% 85% at 50% 50%,
      color-mix(in srgb, var(--accent-primary, #1f6feb) 29%, transparent) 0%,
      color-mix(in srgb, var(--accent-primary, #1f6feb) 18%, transparent) 20%,
      color-mix(in srgb, var(--accent-primary, #1f6feb) 8%, transparent) 46%,
      color-mix(in srgb, var(--accent-primary, #1f6feb) 2%, transparent) 66%,
      transparent 88%
    ),
    var(--bg);
  transition: background 0.58s cubic-bezier(0.22, 1, 0.36, 1);
}
#main.has-welcome.temporary-chat {
  background:
    radial-gradient(
      ellipse 75% 85% at 50% 50%,
      rgba(122, 122, 122, 0.25) 0%,
      rgba(122, 122, 122, 0.15) 20%,
      rgba(122, 122, 122, 0.07) 46%,
      rgba(122, 122, 122, 0.018) 66%,
      transparent 88%
    ),
    var(--bg);
}

#ghost-mode-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  padding: 0;
  width: 34px;
  height: 34px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s,
    box-shadow 0.2s;
  white-space: nowrap;
}
#ghost-mode-btn:hover {
  background: rgba(128, 128, 128, 0.2);
  color: var(--text);
}
#ghost-mode-btn.active {
  background: transparent;
  border-color: transparent;
  color: var(--accent-primary, #1f6feb);
  box-shadow: none;
}
#ghost-mode-btn svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#ghost-mode-btn.active svg {
  transform: scale(1.15);
}

#ghost-banner {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgba(88, 166, 255, 0.07);
  border-bottom: 1px solid rgba(88, 166, 255, 0.15);
  font-size: 12px;
  color: rgba(88, 166, 255, 0.8);
  flex-shrink: 0;
  transition:
    max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease,
    padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0 14px;
}
#ghost-banner.show {
  max-height: 40px;
  opacity: 1;
  padding: 7px 14px;
}

@keyframes ghostFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

#chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}
#chat-window::-webkit-scrollbar {
  width: 4px;
}
#chat-window::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.ad.adsbox.ad-banner.advertisement {
  position: absolute !important;
  left: -10000px !important;
  top: -10000px !important;
  width: 2px !important;
  height: 2px !important;
  pointer-events: none !important;
}
#feature-access-notice {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
}
.adblock-detected #feature-access-notice {
  display: flex;
}
.adblock-card {
  width: min(390px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65);
  text-align: left;
}
.adblock-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--text);
  text-align: left;
}
.adblock-card p {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.adblock-points {
  margin: 0 0 20px;
  padding-left: 19px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.adblock-points li + li {
  margin-top: 9px;
}
.adblock-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 8px;
}
.adblock-card button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 14px;
  background: var(--accent-primary, #1f6feb);
  color: #fff;
  font: 800 17px inherit;
  cursor: pointer;
}
.adblock-actions button {
  min-width: 0;
  padding-inline: 12px;
  font-size: 14px;
}
.adblock-card .adblock-limited-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.chat-load-indicator {
  margin: auto;
  display: grid;
  place-items: center;
  min-height: 120px;
}
.chat-load-indicator .spinner-loader {
  width: 30px;
  height: 30px;
  border-width: 3px;
  border-color: rgba(139, 148, 158, 0.28);
  border-top-color: var(--accent2);
}

.welcome {
  margin: auto;
  text-align: center;
  max-width: 380px;
  padding: 20px 0 14px;
  animation: fadeUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.welcome h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}
.welcome-dots {
  justify-content: center;
}
.welcome-dots span {
  width: 8px;
  height: 8px;
}
.welcome-typewriter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  font-size: 29px;
  font-weight: 600;
  letter-spacing: -0.35px;
  color: var(--text);
  white-space: nowrap;
}
.welcome-typewriter-text {
  background: linear-gradient(90deg, #f5f5f5, #cfcfcf);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.welcome-typewriter-caret {
  width: 2px;
  height: 1.1em;
  margin-left: 6px;
  border-radius: 2px;
  background: var(--accent2);
  animation: blink 0.8s step-end infinite;
}

.message {
  display: flex;
  max-width: 100%;
  animation: msgIn 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.history-message-fade {
  animation-fill-mode: both;
}
.message.user {
  justify-content: flex-end;
}
.message.ai {
  justify-content: flex-start;
}
.bubble {
  max-width: 72%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.message.user .bubble {
  background: var(--user-bubble);
  color: var(--user-text);
  border-radius: 18px 18px 4px 18px;
  box-shadow: none;
  white-space: pre-wrap;
  min-width: 52px;
}
.message.ai .bubble {
  background: var(--ai-bubble);
  color: var(--text);
  border-radius: 18px 18px 18px 4px;
  border: 1px solid var(--ai-border);
}
.bubble img {
  display: block;
  max-width: 100%;
  border-radius: 10px;
  margin-bottom: 6px;
}
.bubble code {
  font-family: "Courier New", monospace;
  background: rgba(31, 111, 235, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent2);
}
.bubble p {
  margin: 0 0 12px;
  line-height: 1.6;
}
.bubble p:last-child {
  margin-bottom: 0;
}
.bubble blockquote {
  margin: 12px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: rgba(31, 111, 235, 0.06);
}
.bubble strong {
  font-weight: 600;
}
.bubble em {
  font-style: italic;
}
.bubble a {
  color: var(--accent2);
  text-decoration: none;
  cursor: pointer;
}
.bubble a:hover {
  text-decoration: underline;
}
.bubble h1,
.bubble h2,
.bubble h3,
.bubble h4,
.bubble h5,
.bubble h6 {
  margin-top: 4px;
  margin-bottom: 4px;
  color: var(--text);
}
.bubble h1 {
  font-size: 19px;
}
.bubble h2 {
  font-size: 17px;
}
.bubble h3 {
  font-size: 15px;
}
.bubble h4 {
  font-size: 14px;
}
.bubble h5 {
  font-size: 13px;
}
.bubble h6 {
  font-size: 12px;
  color: var(--muted);
}
.bubble ul,
.bubble ol {
  margin: 4px 0 4px 20px;
  padding: 0;
}
.bubble ul ul,
.bubble ol ol,
.bubble ul ol,
.bubble ol ul {
  margin: 2px 0 2px 16px;
}
.bubble li {
  margin-bottom: 2px;
}
.bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
.bubble th {
  padding: 10px 12px;
  text-align: left;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  font-size: 13px;
}
.bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}
.bubble td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.bubble tr:last-child td {
  border-bottom: none;
}
.message.ai .bubble .ai-fade-line {
  opacity: 0;
  transform: translateY(6px);
  animation: aiLineIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: opacity, transform;
}
@keyframes aiLineIn {
  to {
    opacity: 1;
    transform: none;
  }
}

.bubble .code-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 6px 10px;
  font-family: inherit;
  letter-spacing: 0.03em;
}
.bubble .code-header img {
  display: inline-block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  vertical-align: middle;
}
.bubble .code-header span {
  vertical-align: middle;
}
.bubble pre {
  margin: 0 0 12px;
  padding: 0;
  overflow-x: auto;
  border-radius: 0 0 12px 12px;
  border: 1px solid var(--border);
}
.bubble pre code.hljs {
  border-radius: 0 0 12px 12px;
  padding: 12px;
  font-size: 13px;
}
.bubble pre:hover {
  opacity: 0.93;
}
.bubble pre:last-child {
  margin-bottom: 0;
}

.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 2px 0;
}
.typing-dots span {
  width: 5px;
  height: 5px;
  background: var(--muted);
  border-radius: 50%;
  animation: dot 1.2s infinite;
}
.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes dot {
  0%,
  60%,
  100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}
.bubble.streaming:not(.loading-dots):not(.inline-skeleton-bubble)::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent2);
  border-radius: 1px;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.7s step-end infinite;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

#chat-fade {
  position: relative;
  flex-shrink: 0;
  height: 48px;
  margin-bottom: -48px;
  pointer-events: none;
  z-index: 2;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 60%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 60%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: linear-gradient(to bottom, rgba(17, 17, 17, 0.8), transparent);
}

#input-area {
  padding: 6px 12px 6px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: transparent;
  position: relative;
  flex-shrink: 0;
  z-index: 3;
}
#footer {
  padding: 2px 14px 4px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 1;
}

#file-previews {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 4px 2px;
}
#file-previews.has-files {
  display: flex;
}
.file-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--muted);
  max-width: 160px;
}
.file-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
.file-chip-remove:hover {
  color: var(--text);
}
.attachment-tag {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.6;
  color: var(--muted);
}
.attachment-tag svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.attachment-tag span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#model-btn .chevron {
  color: var(--muted);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}
#model-btn.open .chevron {
  transform: rotate(90deg);
}
#model-btn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#model-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 99999;
  opacity: 0;
  transform: translateY(-6px) scaleY(0.95);
  transform-origin: top center;
  pointer-events: none;
  transition:
    opacity 0.18s,
    transform 0.2s cubic-bezier(0.34, 1.3, 0.64, 1);
  overflow: hidden;
  min-width: 220px;
}
#model-menu.open {
  opacity: 1;
  transform: none;
  pointer-events: all;
}
#model-menu-inner {
  overflow-y: auto;
  max-height: 167px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
#model-menu-inner::-webkit-scrollbar {
  width: 3px;
}
#model-menu-inner::-webkit-scrollbar-track {
  background: transparent;
}
#model-menu-inner::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}
#model-menu-inner:hover::-webkit-scrollbar-thumb {
  background: transparent;
}
.model-opt {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  min-height: 40px;
  touch-action: manipulation;
  transition: background 0.12s;
}
.model-opt:last-child {
  border-bottom: none;
}
.model-opt:hover,
.model-opt:active {
  background: var(--surface2);
}
.model-opt > span:first-child {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-opt .check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--accent2);
  opacity: 0;
  transition: opacity 0.2s;
  margin-left: auto;
}
.model-opt.selected .check {
  opacity: 1;
}
.model-opt .tag {
  font-size: 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}
.model-opt.vision-model .tag {
  color: var(--accent2);
  border-color: rgba(56, 139, 253, 0.25);
  background: rgba(56, 139, 253, 0.08);
}
.donor-mode-row {
  align-items: center;
  gap: 14px;
}
.donor-mode-row > span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.donor-mode-row small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.donor-key-title {
  color: #fff !important;
  letter-spacing: 0.02em;
}
.donor-key-field,
.byok-key-field {
  height: 46px;
  box-sizing: border-box;
  margin-top: 10px;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease !important;
}
.donor-key-field:hover,
.byok-key-field:hover {
  border-color: var(--border, rgba(255, 255, 255, 0.12)) !important;
}
.donor-key-field:focus-within,
.byok-key-field:focus-within {
  border-color: var(--accent-primary, #10b981) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18) !important;
}
.donor-key-field input,
.byok-key-field input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
  padding: 10px 46px 10px 14px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--text) !important;
  font:
    13px/1.3 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}
.donor-key-field input::placeholder,
.byok-key-field input::placeholder {
  color: var(--muted);
}
.donor-key-save {
  margin-top: 8px !important;
}
.settings-sub a,
#byok-box a {
  color: var(--accent-primary, #1f6feb) !important;
}
.byok-key-field {
  margin: 0;
}
.byok-key-field .byok-input-field {
  min-height: 46px !important;
  height: 46px !important;
}
#donor-openrouter-status,
#sidenav-byok-status,
#byok-status {
  opacity: 0;
  transform: translateY(-3px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}
#donor-openrouter-status.key-status-visible,
#sidenav-byok-status.key-status-visible,
#byok-status.key-status-visible {
  opacity: 1;
  transform: translateY(0);
}
.celoapi-title {
  margin-top: 30px !important;
}
.celoapi-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}
.celoapi-row select,
.celoapi-key-row input,
#celoapi-personalization {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font: 13px inherit;
  padding: 11px 12px;
  outline: 0;
}
.celoapi-row select:focus,
.celoapi-key-row input:focus,
#celoapi-personalization:focus {
  box-shadow: 0 0 0 2px var(--accent-primary, #1f6feb);
}
.celoapi-label {
  display: block;
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 12px;
}
.celoapi-key-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.celoapi-key-row input {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.celoapi-key-row button {
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
  font: 12px inherit;
}
.celoapi-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}
.celoapi-stats span {
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02) !important;
  border: none !important;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.celoapi-stats strong {
  font-size: 15px;
  color: var(--text);
}
.celoapi-section {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02) !important;
  border: none !important;
  box-shadow: none !important;
}
.celoapi-section-title {
  font-weight: 650;
  font-size: 13px;
  color: var(--text);
}
.celoapi-section .settings-sub {
  margin: 6px 0 0;
}
.celoapi-row {
  margin-top: 16px;
}
.celoapi-model-picker {
  position: relative;
}
.celoapi-model-picker > button {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 13px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.065);
  color: var(--text);
  font: 13px inherit;
  text-align: left;
  cursor: pointer;
}
.celoapi-model-picker > button:hover,
.celoapi-model-picker > button[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.1);
}
.celoapi-model-picker > button svg {
  width: 16px;
  height: 16px;
  transition: transform 0.18s ease;
}
.celoapi-model-picker > button[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
.celoapi-model-menu {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  border-radius: 12px;
  background: rgba(31, 31, 31, 0.3);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
  scrollbar-width: none;
}
.celoapi-model-menu::-webkit-scrollbar {
  display: none;
}
.celoapi-model-menu.open {
  display: block;
  animation: popupFadeIn 0.16s ease both;
}
.celoapi-model-menu button {
  display: block;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: 13px inherit;
  text-align: left;
  cursor: pointer;
}
.celoapi-model-menu button:hover,
.celoapi-model-menu button.selected {
  background: rgba(255, 255, 255, 0.1);
}
.celoapi-label {
  margin-top: 18px;
}
.celoapi-key-row input,
#celoapi-personalization {
  background: rgba(255, 255, 255, 0.055);
}
.celoapi-key-row {
  margin-top: 14px;
}
.celoapi-key-row button {
  min-width: 62px;
}
.celoapi-section #celoapi-personalization {
  min-height: 144px;
  resize: none;
  line-height: 1.5;
}
.celoapi-howto pre {
  margin: 12px 0 0;
  padding: 12px;
  overflow: auto;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--muted);
  font:
    11px/1.55 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.celoapi-howto code {
  color: inherit;
}
.celoapi-endpoint {
  overflow-wrap: anywhere;
}
.celoapi-language-tabs {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
.celoapi-language-tabs button {
  border: 0;
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font: 12px inherit;
  cursor: pointer;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}
.celoapi-language-tabs button:hover {
  background: rgba(255, 255, 255, 0.13);
  color: var(--text);
}
.celoapi-language-tabs button.active,
.celoapi-language-tabs button.active:hover {
  background: var(--accent-primary, #1f6feb);
  color: #fff;
}
.celoapi-usage-title {
  margin-top: 20px;
}
.celoapi-stats {
  margin-top: 10px;
}
.celoapi-stats span {
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
}
.celoapi-icon-copy {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 0 !important;
  cursor: pointer;
}
.celoapi-icon-copy:hover {
  background: rgba(255, 255, 255, 0.14);
}
.celoapi-icon-copy svg {
  width: 18px;
  height: 18px;
}
.celoapi-example-wrap {
  position: relative;
}
.celoapi-example-wrap .celoapi-example-copy {
  position: absolute;
  right: 8px;
  top: 20px;
  z-index: 1;
  background: rgba(255, 255, 255, 0.1);
}
.celoapi-example-wrap pre {
  padding-right: 56px;
}

#send-btn.send-press {
  animation: sendPress 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sendPress {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(0.86);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
/* ── Translucent Frosted Glass Plus Popup ── */
/* ── Translucent Frosted Glass Plus Popup ── */
.plus-popup,
#plus-popup {
  position: fixed !important;
  width: 240px !important;
  background: rgba(22, 24, 28, 0.45) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  border: none !important;
  outline: none !important;
  border-radius: 16px !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
  padding: 6px !important;
  z-index: 99999 !important;
  display: flex !important;
  flex-direction: column !important;
  transform-origin: bottom left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.96);
  transition:
    opacity 0.18s ease,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.22s;
  box-sizing: border-box !important;
}

body.theme-midnight #plus-popup,
html[data-theme="midnight"] #plus-popup {
  background: rgba(10, 12, 16, 0.4) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  border: none !important;
}

body.theme-light #plus-popup,
html[data-theme="light"] #plus-popup {
  background: rgba(255, 255, 255, 0.45) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  border: none !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.06) !important;
}

.plus-popup.open,
#plus-popup.open {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
  transition-delay: 0s !important;
}
.popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  color: #ececec !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer;
  min-height: 38px;
  touch-action: manipulation;
  transition:
    background 0.15s ease,
    color 0.15s ease;
  user-select: none;
  position: relative;
  background: transparent;
}
.popup-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}
.popup-item.active {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #3b82f6 !important;
}
.popup-item.active:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}
.popup-icon {
  flex-shrink: 0;
  color: #888888;
  transition: color 0.15s;
}
.popup-item:hover .popup-icon {
  color: #ffffff;
}
.popup-item.active .popup-icon {
  color: #3b82f6;
}
.popup-item .check-icon {
  margin-left: auto;
  color: #3b82f6;
  display: none;
  flex-shrink: 0;
}
.popup-item.active .check-icon {
  display: block;
}
.popup-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
  flex-shrink: 0;
}

#popup-web-search:hover,
#popup-deep-research:hover,
#popup-image-gen:hover,
#model-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

#popup-web-search:hover .popup-icon,
#popup-deep-research:hover .popup-icon,
#popup-image-gen:hover .popup-icon,
#model-btn:hover .popup-icon {
  color: #ffffff !important;
}

#model-btn.no-chevron .chevron {
  display: none !important;
}
#model-btn.locked-mode {
  cursor: default;
}
#model-btn.locked-mode:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

.popup-item.locked {
  opacity: 0.6;
  cursor: not-allowed;
}
.popup-item.locked:hover {
  background: transparent;
}
.popup-item.locked .popup-icon {
  color: #666;
}
.popup-item.locked .lock-icon {
  margin-left: auto;
  color: #666;
  display: block;
  flex-shrink: 0;
}
.popup-item .lock-icon {
  display: none;
}

.spin {
  width: 10px;
  height: 10px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.bar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(35, 35, 35, 0.62);
  border: 0;
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-radius: 24px;
  padding: 8px;
  transition:
    min-height 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    border-color 0.2s;
  min-height: 48px;
  box-sizing: border-box;
}
.bar.drag-active {
  min-height: 125px !important;
}
.bar-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  position: relative;
}
body.theme-midnight .bar,
html[data-theme="midnight"] .bar {
  background: rgba(10, 10, 10, 0.62);
}
body.theme-light .bar,
html[data-theme="light"] .bar {
  background: rgba(255, 255, 255, 0.58);
}
.bar:focus-within {
  border-color: transparent;
}
.char-count {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  min-width: 60px;
}
.char-count.overlimit {
  color: var(--danger);
}
#plus-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition:
    background 0.2s,
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  touch-action: manipulation;
  padding: 0;
  box-sizing: border-box;
}
#plus-btn .plus-h,
#plus-btn .plus-v {
  display: block;
  position: absolute;
  background: var(--text);
  border-radius: 2px;
}
#plus-btn .plus-h {
  width: 12px;
  height: 2px;
  top: 15px;
  left: 10px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#plus-btn .plus-v {
  width: 2px;
  height: 12px;
  top: 10px;
  left: 15px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#plus-btn:hover {
  background: var(--border);
}
#plus-btn.active .plus-h {
  transform: rotate(45deg) translate(0, 0);
}
#plus-btn.active .plus-v {
  transform: rotate(45deg) translate(0, 0);
}
#user-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  resize: none;
  max-height: 120px;
  min-height: 24px;
  line-height: 24px;
  padding: 4px 0;
  margin: 0;
  box-sizing: border-box;
  touch-action: manipulation;
}
#user-input::placeholder {
  color: var(--muted);
}
#send-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: var(--accent-primary, #1f6feb);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  touch-action: manipulation;
}
#send-btn:not(:disabled):hover {
  background: var(--accent-primary-hover, #1a60d6);
}
#send-btn svg {
  display: block;
  width: 13px;
  height: 13px;
  pointer-events: none;
}
#send-btn:active {
  transform: scale(0.95);
}
#send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.file-chip.animate-in {
  animation: fileIn 0.25s ease-out forwards;
}
@keyframes fileIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.image-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.image-modal.active {
  opacity: 1;
  pointer-events: auto;
}
.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.image-modal.active .image-modal-backdrop {
  opacity: 1;
}
.image-modal-content {
  position: relative;
  max-width: min(95vw, 720px);
  max-height: min(95vh, 720px);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.9);
  transform: scale(0.94);
  opacity: 0;
  transition:
    transform 0.22s ease,
    opacity 0.22s ease;
}
.image-modal.active .image-modal-content {
  transform: scale(1);
  opacity: 1;
}
.image-modal-content img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
}
.image-modal-caption {
  padding: 12px 14px 14px;
  font-size: 13px;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
}

.ctx-menu {
  position: fixed;
  background: rgba(22, 24, 28, 0.4) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  border: none !important;
  border-radius: 12px;
  padding: 6px;
  z-index: 99999 !important;
  min-width: 140px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
  opacity: 0;
  transform: translateY(6px) scale(0.97);
  pointer-events: none;
  transition:
    opacity 0.15s ease,
    transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}
.ctx-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition:
    opacity 0.2s ease,
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
  color: var(--text);
  border: none;
  background: none;
  width: 100%;
}
.ctx-item:hover {
  background: var(--surface);
}
.ctx-item.danger {
  color: var(--danger);
}
.ctx-item.danger:hover {
  background: rgba(248, 81, 73, 0.1);
}

#auth-screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
#auth-screen.visible {
  display: flex;
}
.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: opacity 0.15s ease;
}
#auth-screen.visible .auth-backdrop {
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
}
.auth-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 320px;
  padding: 32px 28px 28px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.07);
  opacity: 0;
  transform: translateY(32px) scale(0.95);
  transition:
    opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
#auth-screen.visible .auth-box {
  opacity: 1;
  transform: none;
}
.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 28px;
  text-align: center;
  transition:
    background 0.15s,
    color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-close:hover {
  background: var(--surface2);
  color: var(--text);
}
.auth-logo {
  font-size: 13px;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.auth-box h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
  margin-bottom: 6px;
  line-height: 1.2;
}
.auth-box .auth-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
  line-height: 1.5;
}

.auth-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
}
.auth-step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition:
    background 0.3s,
    width 0.3s;
  flex-shrink: 0;
}
.auth-step-dot.active {
  background: #1f6feb;
  width: 18px;
  border-radius: 3px;
}

.auth-field {
  margin-bottom: 14px;
}
.auth-field input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.055);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  font-family: inherit;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s;
  -webkit-user-select: text;
  user-select: text;
}
.auth-field input:focus {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--accent-primary, #1f6feb);
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--accent-primary, #1f6feb) 16%, transparent);
}
.auth-field input::placeholder {
  color: #555;
}
.auth-btn {
  width: 100%;
  padding: 14px;
  background: #1f6feb;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition:
    background 0.2s,
    transform 0.15s,
    box-shadow 0.2s;
  font-family: inherit;
}
.auth-btn:hover {
  background: #1a60d6;
  box-shadow: 0 6px 20px rgba(31, 111, 235, 0.4);
}
.auth-btn:active {
  transform: scale(0.98);
}
.auth-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.auth-btn.locked {
  background: #f85149;
  opacity: 1;
  cursor: not-allowed;
}
.auth-btn.locked:hover {
  background: #f85149;
  box-shadow: none;
}
.auth-provider-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.auth-provider-btn {
  flex: 1;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px;
  border: 0;
  border-radius: 12px;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.auth-provider-btn:hover {
  background: #303030;
}
.auth-provider-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.provider-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.provider-mark {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
}
.google-mark {
  color: #4285f4;
  font-family: Arial, sans-serif;
  font-size: 20px;
}
.microsoft-mark {
  display: grid;
  grid-template-columns: repeat(2, 8px);
  grid-template-rows: repeat(2, 8px);
  gap: 2px;
}
.microsoft-mark i:nth-child(1) {
  background: #f25022;
}
.microsoft-mark i:nth-child(2) {
  background: #7fba00;
}
.microsoft-mark i:nth-child(3) {
  background: #00a4ef;
}
.microsoft-mark i:nth-child(4) {
  background: #ffb900;
}
.discord-mark {
  color: #5865f2;
  font-size: 21px;
}
.github-mark {
  color: var(--text);
  font-size: 20px;
}
.password-field {
  position: relative;
}
.password-field input {
  padding-right: 46px !important;
}
.password-toggle {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.14s ease,
    visibility 0.14s,
    background 0.15s,
    color 0.15s;
}
.password-field:has(input:not(:placeholder-shown)) .password-toggle {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.password-toggle svg {
  width: 17px;
  height: 17px;
}
.password-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.dot-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 14px;
}
.dot-loader span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: dot-bounce 1.1s infinite ease-in-out both;
}
.dot-loader span:nth-child(1) {
  animation-delay: -0.24s;
}
.dot-loader span:nth-child(2) {
  animation-delay: -0.12s;
}
.dot-loader span:nth-child(3) {
  animation-delay: 0s;
}
.spinner-loader {
  display: inline-block;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin-loader 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin-loader {
  to {
    transform: rotate(360deg);
  }
}
.sidebar-loading {
  text-align: center;
  padding: 20px 0;
}
.sidebar-loading .spinner-loader {
  width: 15px;
  height: 15px;
  border-color: rgba(139, 148, 158, 0.28);
  border-top-color: var(--accent2);
}
@keyframes dot-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: #444;
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #2a2a2a;
}
.auth-switch {
  text-align: center;
  font-size: 13px;
  color: #555;
  margin-top: 16px;
}
.auth-switch {
  display: none;
}
.auth-switch button {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: color 0.15s;
  padding: 0;
}
.auth-switch button:hover {
  color: #fff;
}
.auth-secondary-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}
.auth-secondary-actions button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #a6acb7;
  padding: 3px 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  transition: color 0.16s ease, opacity 0.16s ease;
}
.auth-secondary-actions button:hover {
  color: #fff;
}
.auth-secondary-actions button:disabled {
  cursor: default;
  opacity: 0.65;
}
.auth-secondary-actions .spinner-loader {
  width: 15px;
  height: 15px;
}
.auth-error {
  color: #f85149;
  font-size: 12px;
  margin-top: 10px;
  text-align: center;
  min-height: 16px;
}
.auth-success {
  color: #3fb950;
  font-size: 13px;
  margin-top: 10px;
  text-align: center;
  line-height: 1.5;
}
.auth-method-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.auth-method-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.auth-method-row:last-child {
  border-bottom: 0;
}
.auth-method-row > span:first-child {
  min-width: 78px;
  color: var(--text);
  font-weight: 500;
}
.auth-provider-name {
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-provider-name img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}
.auth-method-email {
  margin-left: auto;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-password-row > span:last-child,
.auth-status {
  margin-left: auto;
  color: #f87171;
  font-size: 12px;
}
.auth-status.linked,
.auth-password-row > span:last-child.linked {
  color: #4ade80;
}
.auth-link-btn {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface2);
  color: var(--text);
  font: 600 12px inherit;
  cursor: pointer;
}
.auth-link-btn:hover {
  border-color: #666;
}
.auth-link-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.auth-password-set {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.auth-password-set .settings-save-btn {
  margin-top: 9px;
  width: 100%;
  padding: 8px;
}
.auth-password-set input {
  box-sizing: border-box;
  width: 100%;
  height: 42px;
  padding: 10px 42px 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font: 13px inherit;
  outline: none;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.auth-password-set input::placeholder {
  color: var(--muted);
}
.auth-password-set input:focus {
  border-color: var(--accent2);
  background: rgba(31, 111, 235, 0.06);
}
.auth-delete-btn {
  margin-top: 16px !important;
  background: transparent !important;
  border: 1px solid rgba(248, 81, 73, 0.55) !important;
  color: #f87171 !important;
}
.auth-delete-btn:hover {
  background: rgba(248, 81, 73, 0.1) !important;
}
.auth-inline-row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.auth-inline-row:first-child {
  border-radius: 11px 11px 0 0;
  overflow: hidden;
}
.auth-inline-row input {
  width: 100%;
  height: 48px;
  box-sizing: border-box;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 13px inherit;
  outline: 0;
  padding: 0 46px 0 14px;
}
.auth-inline-row input::placeholder {
  color: var(--muted);
}
.auth-inline-row:focus-within {
  z-index: 1;
  box-shadow: inset 0 0 0 1px var(--accent-primary, #1f6feb);
}
.auth-inline-save {
  position: absolute;
  right: 9px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent-primary, #1f6feb);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.auth-inline-save:hover {
  background: rgba(255, 255, 255, 0.08);
}
.auth-inline-save svg {
  width: 16px;
  height: 16px;
}
.auth-inline-eye {
  right: 41px;
}
.auth-inline-row.password-field input {
  padding-right: 78px !important;
}
.auth-email-row {
  background: rgba(255, 255, 255, 0.018);
}
.auth-email-row input {
  color: var(--muted);
  padding-right: 58px;
  cursor: default;
}
.auth-email-row span {
  position: absolute;
  right: 14px;
  color: var(--muted);
  font-size: 11px;
}
.auth-delete-btn {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #fff !important;
}
.auth-delete-btn:hover {
  background: #dc2626 !important;
}
.auth-settings-section {
  margin-top: 20px;
}
.auth-section-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px;
}
.auth-section-description {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.auth-credential-row {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}
.auth-credential-row:last-child {
  border-bottom: 0;
}
.auth-credential-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}
.auth-credential-copy label,
.auth-credential-copy strong {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}
.auth-credential-copy small {
  max-width: 210px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.auth-credential-copy input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent !important;
  color: var(--text);
  font: 13px inherit;
  line-height: 22px;
  outline: none;
}
.auth-credential-copy input::placeholder {
  color: var(--muted);
}
.auth-credential-copy input:focus {
  color: var(--text);
}
.auth-action-btn {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  min-width: 104px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid
    color-mix(in srgb, var(--accent-primary, #1f6feb) 30%, transparent);
  border-radius: 10px;
  background: color-mix(
    in srgb,
    var(--accent-primary, #1f6feb) 14%,
    transparent
  );
  color: color-mix(in srgb, var(--accent-primary, #1f6feb) 75%, white);
  font: 650 12px inherit;
  cursor: pointer;
  transition:
    transform 0.14s ease,
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease,
    opacity 0.14s ease;
}
.auth-action-btn:hover {
  border-color: color-mix(
    in srgb,
    var(--accent-primary, #1f6feb) 52%,
    transparent
  );
  background: color-mix(
    in srgb,
    var(--accent-primary, #1f6feb) 22%,
    transparent
  );
  color: #fff;
}
.auth-action-btn:active {
  transform: scale(0.96);
}
.auth-action-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}
.auth-action-btn.is-pending {
  color: var(--text);
}
.auth-action-btn.is-pending::before {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: authActionSpin 0.7s linear infinite;
}
.auth-oauth-list .auth-method-row {
  background: transparent;
}
@keyframes authActionSpin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 600px) {
  .auth-credential-row {
    min-height: 76px;
    gap: 12px;
    padding: 12px;
  }
  .auth-action-btn {
    min-width: 96px;
  }
  .auth-credential-copy small {
    max-width: 180px;
  }
}

.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 9600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-bg.open {
  display: flex;
}
.modal-bg .modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: opacity 0.15s ease;
}
.modal-bg.open.visible .modal-backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}
.modal {
  position: relative;
  z-index: 1;
  background: rgba(31, 31, 31, 0.48);
  border-radius: 16px;
  padding: 28px 24px 24px;
  backdrop-filter: blur(38px) saturate(1.35);
  -webkit-backdrop-filter: blur(38px) saturate(1.35);
  width: 100%;
  max-width: 300px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition:
    opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-bg.open.visible .modal {
  opacity: 1;
  transform: none;
}
.modal h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  text-align: center;
}
.modal p.modal-sub {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 20px;
}
.modal input {
  width: 100%;
  padding: 12px 14px;
  background: #2a2a2a;
  border: 1.5px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  margin-bottom: 16px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.modal input:focus {
  border-color: transparent;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.modal-btn {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.modal-btn.cancel {
  background: #2a2a2a;
  color: var(--text);
}
.modal-btn.cancel:hover {
  background: var(--surface2);
}
.modal-btn.primary {
  background: #1f6feb;
  color: #fff;
}
.modal-btn.primary:hover {
  background: #1a60d6;
}
.modal-btn.danger {
  background: #f85149;
  color: #fff;
}
.modal-btn.danger:hover {
  background: #e03d35;
}

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 15;
  display: none;
  animation: fadeIn 0.2s ease;
}
#overlay.show {
  display: block;
}

@media (max-width: 640px) {
  #sidebar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    height: 100dvh;
    z-index: 200;
  }
  #sidebar.collapsed {
    width: var(--sidebar-icon-w);
  }
  #main {
    margin-left: var(--sidebar-icon-w);
    transition: margin-left 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  }
  #sidebar:not(.collapsed) ~ #main {
    margin-left: 0;
  }
  .auth-box {
    margin: 0 16px;
    max-width: calc(100% - 32px);
  }
  #auth-screen {
    align-items: flex-end;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

#sidebar.collapsed .conv-item {
  position: relative;
}
#sidebar.collapsed .guest-conv-msg {
  opacity: 0;
  pointer-events: none;
}

#main.has-welcome {
  justify-content: center;
}
#main.has-welcome #chat-window {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
  padding: 0 16px;
}
#main.has-welcome .welcome {
  margin: 0 0 20px;
  text-align: center;
}
#main.has-welcome #chat-fade {
  display: none;
}
#main.has-welcome #input-area {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 0 12px 8px;
  flex-shrink: 0;
}
#main:not(.has-welcome) #input-area {
  margin-top: auto;
}

#sidebar.collapsed .conv-list {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
#sidebar.collapsed .sb-search {
  padding: 6px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: visible;
  opacity: 1;
}

.settings-anchor {
  position: relative;
  width: 100%;
}
.settings-popup {
  position: fixed;
  background: rgba(31, 31, 31, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  backdrop-filter: blur(38px) saturate(1.35);
  -webkit-backdrop-filter: blur(38px) saturate(1.35);
  padding: 4px;
  z-index: 300;
  min-width: 220px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  pointer-events: none;
  transition:
    opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  left: 14px;
  max-width: calc(100vw - 80px);
  overflow-y: auto;
  max-height: 60vh;
}
.settings-popup.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.settings-profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 8px;
  pointer-events: none;
  cursor: default;
}
.settings-profile-header .avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-profile-header .avatar img {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.settings-guest-icon {
  width: 15px;
  height: 15px;
  color: var(--muted);
  flex-shrink: 0;
}
.settings-profile-info {
  flex: 1;
  overflow: hidden;
  min-width: 0;
}
.settings-profile-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-profile-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}
.settings-trigger.active {
  background: var(--surface);
}
.settings-detail-screen {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.settings-detail-screen.open {
  display: flex;
}
.settings-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  opacity: 0;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: opacity 0.2s ease, backdrop-filter 0.2s ease, -webkit-backdrop-filter 0.2s ease;
  pointer-events: none;
}
.settings-detail-screen.open.visible .settings-detail-backdrop {
  background: rgba(0, 0, 0, 0.75);
  opacity: 1;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: auto;
}

/* ── Drag & Drop File Overlay ── */
.drag-drop-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1.5px dashed var(--accent, #4285f4) !important;
  background: rgba(18, 20, 26, 0.35) !important;
  backdrop-filter: blur(28px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
  box-sizing: border-box;
  animation: fadeIn 0.18s ease;
}
.drag-drop-overlay.active {
  display: flex;
}

@keyframes chipPopIn {
  0% {
    opacity: 0;
    transform: scale(0.82) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes chipPopOut {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.75) translateY(6px);
  }
}

.file-chip {
  animation: chipPopIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.file-chip.animate-out {
  animation: chipPopOut 0.18s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
  pointer-events: none !important;
}
.drag-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--accent, #4285f4);
}
.drag-drop-icon {
  width: 28px;
  height: 28px;
  color: var(--accent, #4285f4);
}
.drag-drop-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent, #4285f4);
}
.settings-detail-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  background: rgba(31, 31, 31, 0.48);
  border-radius: 20px;
  padding: 0;
  backdrop-filter: blur(38px) saturate(1.35);
  -webkit-backdrop-filter: blur(38px) saturate(1.35);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  transition:
    opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: min(90vh, 520px);
  overflow: hidden;
}
.settings-detail-screen.open.visible .settings-detail-box {
  opacity: 1;
  transform: none;
}
.settings-detail-back {
  display: none;
}
.settings-detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #888;
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  transition:
    background 0.15s,
    color 0.15s;
}
.settings-detail-close:hover {
  background: var(--surface);
  color: var(--text);
}
.settings-detail-close span {
  display: block;
  line-height: 1;
  transform: translateY(-0.5px);
}
.settings-detail-layout {
  display: flex;
  height: min(90vh, 520px);
}
.settings-sidenav {
  width: 170px;
  flex-shrink: 0;
  background: var(--surface2);
  border-right: 1px solid var(--border);
  padding: 48px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.settings-sidenav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition:
    background 0.15s,
    color 0.15s;
  white-space: nowrap;
}
.settings-sidenav-item svg {
  flex-shrink: 0;
}
.settings-sidenav-item:hover {
  background: var(--surface);
  color: var(--text);
}
.settings-sidenav-item.active {
  background: var(--surface);
  color: var(--text);
}
.settings-detail-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 48px 24px 24px;
  min-width: 0;
  box-sizing: border-box;
}
.settings-detail-content.panel-switching .settings-panel.visible {
  animation: settingsPanelIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes settingsPanelIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.settings-panel {
  display: none;
}
.settings-panel.visible {
  display: block;
}
.settings-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}
.settings-sub {
  font-size: 12px;
  color: #666;
  margin-bottom: 14px;
  line-height: 1.5;
}
.settings-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  background: none;
  border: none;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
  font-family: inherit;
}
.settings-item:hover {
  background: var(--surface);
}
.settings-item.danger {
  color: var(--danger);
}
.settings-item.danger:hover {
  background: rgba(248, 81, 73, 0.1);
}
.settings-signout-item {
  color: var(--danger);
  font-weight: 400;
}
.settings-signout-item svg:first-child {
  color: var(--danger);
}
.settings-signout-item:hover {
  background: rgba(248, 81, 73, 0.1);
}
.settings-item svg:first-child {
  flex-shrink: 0;
  color: var(--accent2);
}
.settings-chevron {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0.6;
}
.settings-back {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0 0 12px;
  font-family: inherit;
  transition: color 0.15s;
}
.settings-back:hover {
  color: var(--text);
}
.notif-permission-bar {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.notif-permission-bar span {
  font-size: 12px;
  color: #f59e0b;
  line-height: 1.35;
  min-width: 0;
}
.notif-permission-bar button {
  flex-shrink: 0;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 7px;
  padding: 5px 9px;
  background: transparent;
  color: #fbbf24;
  font: 600 12px inherit;
  cursor: pointer;
}
.notif-permission-bar button:hover {
  background: rgba(245, 158, 11, 0.12);
}
.settings-textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  resize: none;
  min-height: 120px;
  max-height: 200px;
  outline: none;
  line-height: 1.5;
  overflow-y: auto;
  box-sizing: border-box;
  -webkit-user-select: text;
  user-select: text;
}
.settings-textarea-wrap {
  position: relative;
  border: 1px solid transparent !important;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.settings-textarea-wrap:hover {
  border-color: var(--border, rgba(255, 255, 255, 0.12)) !important;
}
.settings-textarea-wrap:focus-within {
  border-color: var(--accent-primary, #10b981) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18) !important;
}
.settings-textarea-wrap .settings-textarea {
  padding-bottom: 30px;
}
.settings-textarea:focus {
  border-color: var(--accent-primary, #10b981);
}
.settings-textarea::placeholder {
  color: var(--muted);
}
.settings-word-count {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 10px;
  color: var(--muted);
  text-align: right;
  pointer-events: none;
}
.settings-word-count.overlimit {
  color: var(--danger);
}
.settings-save-btn {
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  background: var(--accent-primary, #1f6feb);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.settings-save-btn:hover {
  background: var(--accent-primary-hover, #1a60d6);
}
.settings-status {
  font-size: 12px;
  margin-top: 10px;
  min-height: 16px;
  color: var(--muted);
}
.settings-status:empty {
  display: none;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}
.katex {
  font-size: 1.05em;
}
/* ── Appearance panel ─────────────────────────────────────── */
.appearance-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.theme-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.theme-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s;
  min-width: 80px;
}
.theme-card.active {
  border-color: var(--accent-primary, #1f6feb);
}
.theme-card:hover {
  border-color: var(--accent-primary, #1f6feb);
}
.theme-preview {
  width: 52px;
  height: 34px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px;
}
.theme-preview-dark {
  background: #111;
}
.theme-preview-midnight {
  background: #000;
}
.theme-preview-light {
  background: #f5f5f5;
}
.theme-preview-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
}
.theme-preview-light .theme-preview-bar {
  background: rgba(0, 0, 0, 0.12);
}
.theme-preview-line {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
}
.theme-preview-line.short {
  width: 60%;
}
.theme-preview-light .theme-preview-line {
  background: rgba(0, 0, 0, 0.08);
}
.theme-label {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}
.theme-check {
  font-size: 11px;
  color: var(--accent-primary, #1f6feb);
  font-weight: 700;
  height: 14px;
}
.font-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.font-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color 0.15s;
  min-width: 70px;
}
.font-card.active {
  border-color: var(--accent-primary, #1f6feb);
}
.font-card:hover {
  border-color: var(--accent-primary, #1f6feb);
}
.font-preview {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}
.font-label {
  font-size: 11px;
  color: var(--muted);
}
.font-check {
  font-size: 11px;
  color: var(--accent-primary, #1f6feb);
  font-weight: 700;
  height: 14px;
}
.accent-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.accent-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition:
    transform 0.15s,
    border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.accent-swatch.active {
  border-color: #fff;
  transform: scale(1.15);
}
.accent-swatch:hover {
  transform: scale(1.1);
}
.accent-custom-swatch {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--muted);
}
.custom-color-picker {
  width: 220px;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(35, 35, 35, 0.72);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
}
.custom-color-native {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.custom-color-native input {
  width: 52px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}
.custom-color-native input::-webkit-color-swatch-wrapper {
  padding: 3px;
}
.custom-color-native input::-webkit-color-swatch {
  border: 0;
  border-radius: 5px;
}
.custom-color-hex-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.custom-color-hex-row input {
  min-width: 0;
  flex: 1;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 10px;
  color: var(--text);
  font:
    13px ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}
.custom-color-preview {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  background: #1f6feb;
}
.custom-color-apply {
  border: 0;
  border-radius: 9px;
  padding: 9px 10px;
  background: var(--accent-primary, #1f6feb);
  color: #fff;
  font: 700 13px inherit;
  cursor: pointer;
  transition:
    filter 0.15s,
    transform 0.15s;
}
.custom-color-apply:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* ── Notifications panel ─────────────────────────────────── */
.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.notif-row:last-child {
  border-bottom: none;
}
.notif-label {
  font-size: 13px;
  color: var(--text);
}
.notif-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}
.notif-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.notif-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: 0.2s;
}
.notif-slider:before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.notif-toggle input:checked + .notif-slider {
  background: var(--accent-primary, #1f6feb);
}
.notif-toggle input:checked + .notif-slider:before {
  transform: translateX(16px);
}

/* ── Theme overrides ─────────────────────────────────────────────── */
body.theme-midnight,
html[data-theme="midnight"] body,
:root:has(body.theme-midnight) {
  --bg: #000000;
  --sidebar-bg: rgba(0, 0, 0, 0.8);
  --surface: #0f0f0f;
  --surface2: #161616;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888888;
  --user-bubble: #141414;
  --user-text: #e8e8e8;
  --ai-bubble: #080808;
  --ai-border: #1e1e1e;
}
html[data-theme="midnight"] {
  --bg: #000000;
  --surface: #0f0f0f;
  --surface2: #161616;
  --border: #2a2a2a;
  --text: #e8e8e8;
}
body.theme-light,
html[data-theme="light"] body,
:root:has(body.theme-light) {
  --bg: #f0f0f0;
  --sidebar-bg: rgba(235, 235, 235, 0.95);
  --surface: #e8e8e8;
  --surface2: #dcdcdc;
  --border: #cccccc;
  --text: #1a1a1a;
  --muted: #444444;
  --accent: #444444;
  --accent2: #333333;
  --user-bubble: #d8d8d8;
  --user-text: #1a1a1a;
  --ai-bubble: #e8e8e8;
  --ai-border: #cccccc;
}
html[data-theme="light"] {
  --bg: #f0f0f0;
  --surface: #e8e8e8;
  --surface2: #dcdcdc;
  --border: #cccccc;
  --text: #1a1a1a;
}
body.theme-light .welcome-typewriter-text,
html[data-theme="light"] .welcome-typewriter-text {
  background: linear-gradient(90deg, #1a1a1a, #3a3a3a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── Mobile layout ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Sidebar: slides in/out off-screen */
  html.mobile-sidebar-preload-closed #sidebar {
    transform: translateX(-100%) !important;
    transition: none !important;
  }
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    height: 100dvh;
    z-index: 200;
    width: var(--sidebar-w) !important;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }
  #sidebar:not(.collapsed) {
    transform: translateX(0);
  }
  #sidebar.collapsed {
    transform: translateX(-100%);
  }
  #main {
    margin-left: 0 !important;
  }

  /* Topbar: transparent, no border, flush */
  #mobile-topbar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 150;
    height: 50px;
    align-items: center;
    padding: 0 10px;
    gap: 6px;
    background: transparent;
    border-bottom: none;
  }

  /* Sidebar toggle pill */
  #mobile-sidebar-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    width: 38px;
    height: 34px;
    cursor: pointer;
    color: var(--muted);
    transition:
      opacity 0.2s,
      background 0.15s;
  }
  #mobile-sidebar-fab:active {
    background: var(--surface2);
  }
  /* Hide FAB pill when sidebar is open */
  #sidebar:not(.collapsed) ~ #main #mobile-sidebar-fab {
    opacity: 0;
    pointer-events: none;
  }

  /* Combined action pill */
  #mobile-action-pill {
    display: inline-flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    height: 34px;
    overflow: hidden;
  }
  #mobile-ghost-btn,
  #mobile-topbar-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 34px;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    transition:
      background 0.15s,
      color 0.15s;
    font-family: inherit;
  }
  #mobile-ghost-btn:hover,
  #mobile-topbar-dots:hover {
    background: transparent;
  }
  #mobile-ghost-btn.active svg {
    color: var(--accent-primary, #1f6feb);
  }
  .mobile-pill-sep {
    width: 1px;
    height: 18px;
    background: var(--border);
    flex-shrink: 0;
  }

  /* Hide desktop ghost btn and push chat below topbar */
  #ghost-mode-btn {
    display: none !important;
  }
  #chat-window {
    padding-top: 50px !important;
  }
  #connections-page {
    padding-top: 60px !important;
  }

  /* Settings categories rise from the bottom and remain scrollable. */
  .settings-popup {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: 10px !important;
    width: calc(100% - 16px) !important;
    max-width: none !important;
    border-radius: 22px !important;
    max-height: calc(100dvh - 20px) !important;
    padding: 8px 8px calc(14px + env(safe-area-inset-bottom)) !important;
    transform: translateY(24px) !important;
    z-index: 400 !important;
    overflow-y: auto !important;
    box-sizing: border-box;
  }
  .settings-popup.open {
    transform: translateY(0) !important;
  }
  .settings-popup.mobile-settings-underlay {
    pointer-events: none;
  }
  #settings-blur-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 399;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
  #settings-blur-backdrop.open {
    display: block;
  }

  /* A category opens as a rounded bottom sheet with Back and Close controls. */
  .settings-detail-screen {
    align-items: flex-end;
    padding: 0 8px 10px;
  }
  .settings-detail-box {
    width: 100%;
    max-width: none;
    height: calc(100dvh - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 22px;
    transform: translateY(28px) scale(1);
    transition:
      opacity 0.28s ease,
      transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .settings-detail-screen.open.visible .settings-detail-box {
    transform: translateY(0) scale(1);
  }
  .settings-detail-layout {
    height: 100%;
    max-height: none;
    display: block;
  }
  .settings-detail-close {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 22px;
    color: #fff;
    display: grid;
    place-items: center;
    line-height: 1;
  }
  .settings-detail-close span {
    display: block;
    line-height: 1;
    transform: translateY(-1px);
  }
  .settings-detail-back {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
  }
  .settings-sidenav {
    display: none;
  }
  .settings-detail-content {
    height: 100%;
    box-sizing: border-box;
    padding: 68px 16px calc(24px + env(safe-area-inset-bottom));
  }
  .settings-title {
    font-size: 20px;
    margin-bottom: 10px;
  }
  .settings-sub {
    font-size: 13px;
    margin-bottom: 18px;
  }
  .settings-item {
    padding: 13px 10px;
  }
  .settings-textarea {
    font-size: 16px;
  }
}

/* Hide mobile elements on desktop */
@media (min-width: 641px) {
  #mobile-topbar {
    display: none !important;
  }
  #mobile-ghost-btn {
    display: none !important;
  }
  .settings-mobile-category {
    display: none !important;
  }
}

/* ── Connections Panel ─────────────────────────────────────── */
.connections-panel {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: var(--sidebar-bg);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.connections-panel.open {
  transform: translateX(0);
}
.connections-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.connections-back {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
}
.connections-back:hover {
  background: var(--surface);
}
.connections-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.connections-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.conn-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.conn-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
  overflow: hidden;
}
.conn-icon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.conn-info {
  flex: 1;
  min-width: 0;
}
.conn-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.conn-desc {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}
.conn-badge {
  font-size: 10px;
  font-weight: 600;
  border-radius: 6px;
  padding: 2px 7px;
  flex-shrink: 0;
}
.conn-badge-on {
  background: rgba(31, 111, 235, 0.15);
  color: #3b82f6;
}
.conn-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.conn-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.conn-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  transition: 0.2s;
}
.conn-slider:before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.conn-toggle input:checked + .conn-slider {
  background: var(--accent-primary, #1f6feb);
}
.conn-toggle input:checked + .conn-slider:before {
  transform: translateX(16px);
}

/* ── Sidebar nav button (below new-chat) ─────────────────── */
.sb-nav-btn {
  color: #ffffff;
  transition:
    background 0.15s,
    color 0.15s;
}
.sb-nav-btn:hover {
  background: var(--surface2);
  color: var(--text);
}
.sb-nav-btn.active {
  color: var(--text);
  background: var(--surface2);
}
#sidebar.collapsed .sb-nav-btn span {
  display: none;
}

/* ── Connections main page cards ─────────────────────────── */
/* ── Connections main page cards ─────────────────────────── */
#connections-page {
  flex: 1;
  overflow-y: auto;
  padding: 32px 32px 80px 32px !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto;
  box-sizing: border-box;
}

.connections-category-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 42px 4px 18px 4px !important;
  display: block;
}

.connections-category-title:first-child {
  margin-top: 6px !important;
}

.connections-page-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
}

@media (max-width: 680px) {
  .connections-page-grid {
    grid-template-columns: 1fr;
  }
}

.conn-page-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.035) !important;
  backdrop-filter: blur(20px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(140%) !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 16px;
  margin-bottom: 0;
  width: 100%;
  box-sizing: border-box;
  transition: none !important;
}

.conn-page-card:hover {
  background: rgba(255, 255, 255, 0.035) !important;
  border: none !important;
  box-shadow: none !important;
  transform: none !important;
}

body.theme-light .conn-page-card {
  background: rgba(0, 0, 0, 0.035) !important;
  border: none !important;
  box-shadow: none !important;
}

body.theme-light .conn-page-card:hover {
  background: rgba(0, 0, 0, 0.035) !important;
  border: none !important;
  box-shadow: none !important;
}

.conn-page-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05) !important;
  border: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
}
.conn-page-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
#connections-page.connections-enter .conn-page-card {
  opacity: 0;
  transform: translateY(8px) scale(0.99);
  animation: connectionCardIn 0.52s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--connection-delay, 0.02s);
  will-change: opacity, transform;
}
@keyframes connectionCardIn {
  to {
    opacity: 1;
    transform: none;
  }
}
.conn-page-info {
  flex: 1;
  min-width: 0;
}
.conn-page-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.conn-page-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Cookie consent banner ────────────────────────────────── */
.cookie-consent {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 10000;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}
.cookie-consent.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  animation: cookieFadeIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes cookieFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.cookie-consent-text strong {
  font-size: 13px;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}
.cookie-consent-text p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.cookie-consent-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cookie-btn {
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.18s,
    border-color 0.18s;
}
.cookie-btn-outline {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
}
.cookie-btn-outline:hover {
  background: var(--surface2);
}
.cookie-btn-primary {
  background: #1f6feb;
  color: #fff;
}
.cookie-btn-primary:hover {
  background: #1a60d6;
}
.guest-login-cta {
  cursor: default;
}
.guest-login-cta strong,
.guest-login-cta span {
  cursor: default;
}
.chat-search-backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.chat-search-box {
  background: rgba(31, 31, 31, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(38px) saturate(1.35);
  -webkit-backdrop-filter: blur(38px) saturate(1.35);
}
.chat-search-results {
  margin-top: 14px;
}
#chat-window:has(> .chat-load-indicator) {
  background: radial-gradient(
    ellipse 70% 78% at 50% 50%,
    color-mix(in srgb, var(--accent-primary, #1f6feb) 17%, transparent) 0%,
    color-mix(in srgb, var(--accent-primary, #1f6feb) 7%, transparent) 44%,
    transparent 82%
  );
}
#main:not(.has-welcome) {
  background:
    radial-gradient(
      720px 440px at 50% -160px,
      color-mix(in srgb, var(--accent-primary, #4a68de) 26%, transparent) 0%,
      color-mix(in srgb, var(--accent-primary, #4a68de) 11%, transparent) 45%,
      transparent 70%
    ),
    var(--bg);
}
#main:not(.has-welcome) #chat-window {
  background: transparent;
}
.ctx-menu {
  background: rgba(35, 35, 35, 0.38) !important;
  border: 0 !important;
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
}
.ctx-menu button:hover {
  background: rgba(255, 255, 255, 0.06) !important;
}
.profile-editor-avatar {
  width: 112px;
  height: 112px;
  margin: 4px auto 22px;
  position: relative;
  border-radius: 50%;
  overflow: visible;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
}
.profile-editor-avatar img {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.75);
}
.profile-editor-avatar span {
  position: absolute;
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
}
.profile-editor-avatar button {
  position: absolute;
  right: 1px;
  bottom: 4px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(35, 35, 35, 0.75);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.settings-panel-profile .auth-inline-row {
  border-radius: 12px;
  overflow: hidden;
}
#model-menu {
  background: rgba(35, 35, 35, 0.38) !important;
  border: 0 !important;
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
}
.model-opt:hover,
.model-opt:active {
  background: rgba(255, 255, 255, 0.06) !important;
}
.settings-community-link {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 10px 2px;
  color: var(--text);
  text-decoration: none;
  font-size: 11px;
  line-height: 1.35;
}
.settings-community-link strong {
  font-size: 11px;
}
.settings-community-link span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(88, 101, 242, 0.18);
  color: #bfc7ff;
  font-weight: 700;
}
.settings-community-link:hover span {
  background: rgba(88, 101, 242, 0.28);
}
.settings-community-link {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-decoration: none;
}
.settings-community-link strong {
  cursor: default;
}
.settings-community-link a {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(88, 101, 242, 0.18);
  color: #bfc7ff;
}
.settings-community-link a:hover {
  background: rgba(88, 101, 242, 0.28);
}
.settings-community-link span {
  display: none;
}
.settings-community-link a {
  border-radius: 8px;
}
.settings-community-link strong {
  color: var(--muted);
}
.settings-community-link a {
  background: transparent !important;
  outline: 0;
  text-decoration: none;
}
.settings-community-link a:hover {
  background: rgba(255, 255, 255, 0.05) !important;
}
.settings-community-link .settings-community-text {
  width: auto;
  height: auto;
  display: block;
  flex: 1;
  color: var(--muted);
  font-weight: 700;
}
.settings-community-link .settings-community-text:hover {
  color: var(--text);
}
.settings-popup,
.settings-detail-box,
.modal,
.chat-search-box,
.guest-feature-popover,
.custom-color-picker {
  border: 0 !important;
}
.celo-btn-cancel {
  border: 0 !important;
}
body.theme-light .settings-popup,
html[data-theme="light"] .settings-popup {
  background: rgba(255, 255, 255, 0.56) !important;
  color: #1a1a1a;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}
body.theme-light .settings-detail-box,
html[data-theme="light"] .settings-detail-box {
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.18);
}
body.theme-light .settings-popup .settings-sep,
html[data-theme="light"] .settings-popup .settings-sep {
  background: rgba(0, 0, 0, 0.16);
}
.settings-sidenav {
  background: rgba(255, 255, 255, 0.045);
  border-right: 0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.settings-sidenav-item:hover,
.settings-sidenav-item.active,
.settings-item:hover {
  background: rgba(255, 255, 255, 0.07);
}
.settings-item.danger:hover,
.settings-signout-item:hover {
  background: rgba(248, 81, 73, 0.08);
}
.auth-method-list,
.auth-inline-row,
.auth-email-row {
  background: rgba(255, 255, 255, 0.045) !important;
}
.auth-inline-row {
  border-color: rgba(255, 255, 255, 0.1);
}
.auth-password-set input,
.donor-key-field,
.byok-key-field,
.settings-detail-content input:not([type="color"]) {
  background: rgba(255, 255, 255, 0.055) !important;
  border-color: transparent !important;
}
.custom-color-picker {
  width: 220px;
  gap: 10px;
  padding: 12px;
  background: rgba(31, 31, 31, 0.45);
}
.custom-color-native {
  width: 100%;
  height: 38px;
  padding: 3px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}
.custom-color-native::-webkit-color-swatch-wrapper {
  padding: 0;
}
.custom-color-native::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}
.custom-color-hex-row input {
  background: rgba(255, 255, 255, 0.055);
  border: 0;
}
.custom-color-preview,
.custom-color-apply {
  display: none;
}
#sidebar .new-chat-btn,
#sidebar .sb-search input,
#sidebar.collapsed .sb-search-collapsed-btn {
  background: rgba(255, 255, 255, 0.045);
}
#sidebar .new-chat-btn:hover,
#sidebar .sb-search input:focus,
#sidebar.collapsed .sb-search-collapsed-btn:hover,
#sidebar .sb-search-expanded-btn:hover,
#sidebar .sb-toggle:hover {
  background: rgba(255, 255, 255, 0.09);
}
.settings-popup {
  background: rgba(31, 31, 31, 0.38) !important;
}
.settings-detail-box {
  background: rgba(31, 31, 31, 0.38);
}
.modal {
  background: rgba(31, 31, 31, 0.38);
}
body.theme-light .settings-sidenav,
html[data-theme="light"] .settings-sidenav {
  background: rgba(255, 255, 255, 0.32);
}
body.theme-light .settings-sidenav-item:hover,
body.theme-light .settings-sidenav-item.active,
body.theme-light .settings-item:hover,
html[data-theme="light"] .settings-sidenav-item:hover,
html[data-theme="light"] .settings-sidenav-item.active,
html[data-theme="light"] .settings-item:hover {
  background: rgba(0, 0, 0, 0.055);
}
body.theme-light .auth-method-list,
body.theme-light .auth-inline-row,
body.theme-light .auth-email-row,
html[data-theme="light"] .auth-method-list,
html[data-theme="light"] .auth-inline-row,
html[data-theme="light"] .auth-email-row {
  background: rgba(255, 255, 255, 0.3) !important;
}
.settings-sidenav,
.auth-method-list,
.auth-inline-row,
.auth-email-row,
.auth-password-set input,
.donor-key-field,
.byok-key-field,
.settings-detail-content input:not([type="color"]) {
  background: transparent !important;
}
.settings-sidenav-item:hover,
.settings-sidenav-item.active,
.settings-item:hover {
  background: rgba(255, 255, 255, 0.035) !important;
}
.custom-color-picker {
  width: 220px !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.custom-color-native {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px;
  padding: 0 !important;
  border-radius: 9px !important;
}
.custom-color-hex-row {
  flex: 1;
}
.custom-color-hex-row input {
  width: 100%;
}
.custom-color-native::-webkit-color-swatch-wrapper {
  padding: 3px;
}
.custom-color-native::-webkit-color-swatch {
  border-radius: 6px;
}
.settings-detail-box {
  background: rgba(31, 31, 31, 0.2) !important;
}
.settings-popup {
  background: rgba(31, 31, 31, 0.2) !important;
}
body.theme-light .settings-sidenav,
html[data-theme="light"] .settings-sidenav,
body.theme-light .auth-method-list,
body.theme-light .auth-inline-row,
body.theme-light .auth-email-row,
html[data-theme="light"] .auth-method-list,
html[data-theme="light"] .auth-inline-row,
html[data-theme="light"] .auth-email-row {
  background: transparent !important;
}
body.theme-light .settings-detail-box,
body.theme-light .settings-popup,
html[data-theme="light"] .settings-detail-box,
html[data-theme="light"] .settings-popup {
  background: rgba(255, 255, 255, 0.2) !important;
}
@media (max-width: 640px) {
  .welcome-typewriter {
    font-size: 23px;
    letter-spacing: -0.25px;
  }
  #main.has-welcome {
    background:
      radial-gradient(
        ellipse 130% 55% at 50% 52%,
        color-mix(in srgb, var(--accent-primary, #1f6feb) 28%, transparent) 0%,
        color-mix(in srgb, var(--accent-primary, #1f6feb) 14%, transparent) 34%,
        color-mix(in srgb, var(--accent-primary, #1f6feb) 4%, transparent) 58%,
        transparent 82%
      ),
      var(--bg);
  }
  #main.has-welcome.temporary-chat {
    background:
      radial-gradient(
        ellipse 130% 55% at 50% 52%,
        rgba(122, 122, 122, 0.23) 0%,
        rgba(122, 122, 122, 0.12) 34%,
        rgba(122, 122, 122, 0.035) 58%,
        transparent 82%
      ),
      var(--bg);
  }
  .cookie-consent {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-width: none;
  }
}

/* Final glass and attachment refinements. */
#model-menu {
  background: rgba(30, 30, 30, 0.3) !important;
  border: 0 !important;
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
}
#model-menu-inner {
  scrollbar-width: none;
}
#model-menu-inner::-webkit-scrollbar {
  display: none;
}
#error-toast {
  top: 34px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  width: fit-content;
  max-width: calc(100vw - 32px);
  min-width: 0;
  gap: 10px;
}
#error-toast .error-toast-text {
  flex: 0 1 auto;
}
.connections-section-title {
  margin: 2px 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.connections-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.connections-category-title {
  grid-column: 1/-1;
  margin: 12px 0 -2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.connections-category-title:first-child {
  margin-top: 0;
}
.connections-grid .conn-page-card {
  min-width: 0;
  height: 100%;
  margin: 0;
  transition:
    background 0.18s ease,
    transform 0.18s ease;
}
.connections-grid .conn-page-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.07);
}
@media (max-width: 760px) {
  .connections-grid {
    grid-template-columns: 1fr;
  }
  .connections-category-title {
    margin-top: 8px;
  }
}
.connections-grid .conn-page-card {
  background: rgba(31, 31, 31, 0.24);
  border: 0;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}
.connections-grid .conn-page-card:hover {
  background: rgba(255, 255, 255, 0.065);
}
body.theme-light .connections-grid .conn-page-card,
html[data-theme="light"] .connections-grid .conn-page-card {
  background: rgba(255, 255, 255, 0.26);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.5);
}
body.theme-light .connections-grid .conn-page-card:hover,
html[data-theme="light"] .connections-grid .conn-page-card:hover {
  background: rgba(255, 255, 255, 0.42);
}
.unblocker-option {
  margin: 0 0 14px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.unblocker-option-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.unblocker-option p {
  margin: 5px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.unblocker-label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.unblocker-option input {
  width: 100%;
  box-sizing: border-box;
}
.unblocker-option input,
.unblocker-option input:focus {
  color: #fff !important;
  caret-color: #fff !important;
  opacity: 1;
  cursor: text;
}
.unblocker-option input::placeholder {
  color: var(--muted);
  opacity: 1;
}
.unblocker-option .settings-save-btn {
  margin-top: 14px;
}
body.theme-light .unblocker-option,
html[data-theme="light"] .unblocker-option {
  background: rgba(255, 255, 255, 0.24);
}
body.theme-light .unblocker-option input,
body.theme-light .unblocker-option input:focus,
html[data-theme="light"] .unblocker-option input,
html[data-theme="light"] .unblocker-option input:focus {
  color: #151515 !important;
  caret-color: #151515 !important;
}
#error-toast .error-toast-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
#error-toast button {
  flex: 0 0 27px;
}
#error-toast {
  z-index: 30000 !important;
  max-width: min(660px, calc(100vw - 32px));
  align-items: center !important;
}
#error-toast .error-toast-text {
  white-space: pre-line !important;
  line-height: 1.45;
}
#error-toast button {
  width: 32px !important;
  height: 32px !important;
  flex: 0 0 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  line-height: 0 !important;
}
#error-toast button svg {
  display: block;
  width: 19px;
  height: 19px;
  margin: 0;
}
@media (min-width: 641px) {
  body:has(#sidebar.collapsed) #error-toast {
    left: calc(
      var(--sidebar-icon-w) + (100vw - var(--sidebar-icon-w)) / 2
    ) !important;
  }
}
#file-previews {
  display: none;
  width: 100%;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  box-sizing: border-box;
  padding: 0 4px 6px 4px;
}
#file-previews.has-files {
  display: flex !important;
  animation: chipPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.file-chip.image-chip {
  position: relative;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
}
.file-chip.image-chip img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: inherit !important;
}
.file-chip.image-chip span {
  display: none;
}
.file-chip.image-chip .file-chip-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 13px;
  line-height: 1;
}
.auth-box,
.adblock-card {
  background: rgba(31, 31, 31, 0.42) !important;
  border: 0 !important;
  backdrop-filter: blur(28px) saturate(1.2);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
}
@media (max-width: 640px) {
  #mobile-sidebar-fab {
    width: 48px;
    height: 48px;
    border: 0;
    background: transparent;
    border-radius: 14px;
    color: var(--text);
  }
  #mobile-sidebar-fab svg {
    width: 21px;
    height: 21px;
  }
  #mobile-action-pill {
    height: 48px;
    border: 0;
    background: transparent;
    border-radius: 14px;
    overflow: visible;
  }
  #mobile-ghost-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    color: var(--text);
  }
  #mobile-ghost-btn svg {
    width: 22px;
    height: 22px;
  }
  .mobile-pill-sep,
  #mobile-topbar-dots {
    display: none !important;
  }
}

/* Compact icon-only Authentication actions. */
.auth-action-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  border-radius: 10px !important;
}
.auth-action-btn svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── HTML5 / Web Code Execution & Artifact Live Preview ─── */
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface2, #21262d);
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  border: 1px solid var(--border, #30363d);
  border-bottom: 0;
  font-size: 12px;
  color: var(--muted, #8b949e);
  user-select: none;
}
.code-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.code-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}
.code-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border, #30363d);
  background: var(--surface, #161b22);
  color: var(--text, #c9d1d9);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.code-action-btn:hover {
  background: var(--surface2, #21262d);
  border-color: var(--muted, #8b949e);
}
.code-action-btn.run-btn {
  background: color-mix(in srgb, var(--accent-primary, #1f6feb) 20%, transparent);
  border-color: color-mix(in srgb, var(--accent-primary, #1f6feb) 45%, transparent);
  color: color-mix(in srgb, var(--accent-primary, #1f6feb) 85%, white);
}
.code-action-btn.run-btn:hover {
  background: color-mix(in srgb, var(--accent-primary, #1f6feb) 35%, transparent);
  color: #fff;
}

/* ─── Citation & Grounding Links ─── */
.chat-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border, #30363d);
}
.citation-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  background: var(--surface2, #21262d);
  border: 1px solid var(--border, #30363d);
  color: var(--text, #c9d1d9);
  font-size: 11px;
  text-decoration: none;
  transition: all 0.15s ease;
}
.citation-pill:hover {
  background: var(--surface, #161b22);
  border-color: var(--accent-primary, #1f6feb);
  color: var(--accent-primary, #1f6feb);
}

/* ─── Artifact Sandbox Modal ─── */
.artifact-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.artifact-modal.active {
  opacity: 1;
  pointer-events: auto;
}
.artifact-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
}
.artifact-dialog {
  position: relative;
  width: min(96vw, 1080px);
  height: min(92vh, 780px);
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.artifact-modal.active .artifact-dialog {
  transform: scale(1);
}
.artifact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface2, #21262d);
  border-bottom: 1px solid var(--border, #30363d);
}
.artifact-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #c9d1d9);
}
.artifact-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.artifact-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 7px;
  color: var(--text, #c9d1d9);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.artifact-btn:hover {
  background: var(--surface2, #282e37);
  border-color: var(--muted, #8b949e);
}
.artifact-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, #c9d1d9);
  font-size: 15px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.artifact-close-btn:hover {
  background: var(--danger, #f85149);
  color: #fff;
}
.artifact-body {
  flex: 1;
  background: #ffffff;
  position: relative;
}
.artifact-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}


/* ── Chat skeleton loader ── */
.chat-skeleton-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 16px;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}
.chat-skeleton-bubble {
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: skeletonPulse 1.6s ease-in-out infinite;
}
.chat-skeleton-bubble.user {
  align-self: flex-end;
  width: 45%;
  min-width: 160px;
  background: rgba(255, 255, 255, 0.05);
}
.chat-skeleton-bubble.ai {
  align-self: flex-start;
  width: 75%;
  min-width: 240px;
  background: rgba(255, 255, 255, 0.03);
}
.chat-skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.11) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.8s infinite linear;
}
@keyframes skeletonPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Transparent connections icons with accent color ── */
.conn-page-icon,
.conn-icon-wrap {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--accent-primary, #1f6feb) !important;
}
.conn-page-icon svg,
.conn-icon-wrap svg {
  color: var(--accent-primary, #1f6feb) !important;
  stroke: var(--accent-primary, #1f6feb) !important;
}


/* ── Centered reading column & spaced input bar ── */
#chat-window {
  padding: 24px 20px 16px;
  align-items: center;
}
.message {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}
.welcome {
  max-width: 780px;
  width: 100%;
}
#input-area {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 20px 10px;
  box-sizing: border-box;
}
.chat-skeleton-container {
  max-width: 780px !important;
}
@media (max-width: 640px) {
  #chat-window {
    padding: 16px 12px 10px;
  }
  #input-area {
    padding: 6px 12px 8px;
    max-width: 100%;
  }
}


/* ── Enhanced Message & Input Bar Sizing ── */
#chat-window {
  padding: 28px 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.message {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}
.bubble {
  font-size: 15px;
  line-height: 1.62;
  padding: 13px 18px;
}
.message.user .bubble {
  max-width: 70%;
  min-width: 58px;
  border-radius: 20px 20px 4px 20px;
}
.message.ai .bubble {
  max-width: 86%;
  border-radius: 20px 20px 20px 4px;
}
#input-area {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 24px 12px;
  box-sizing: border-box;
}
.bar {
  padding: 10px 12px 10px 10px;
  border-radius: 28px;
  gap: 10px;
  min-height: 52px;
}
#user-input {
  font-size: 16px;
  line-height: 1.55;
  padding: 6px 4px;
}
#plus-btn, #send-btn {
  width: 35px;
  height: 35px;
}
.chat-skeleton-container {
  max-width: 820px !important;
  padding: 28px 0 20px !important;
}
.chat-skeleton-bubble.user {
  width: 42% !important;
  padding: 16px 20px !important;
  border-radius: 20px 20px 4px 20px !important;
}
.chat-skeleton-bubble.ai {
  width: 80% !important;
  padding: 18px 22px !important;
  border-radius: 20px 20px 20px 4px !important;
}


/* ── Perfectly Centered Plus Button ── */
#plus-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}
#plus-btn .plus-h,
#plus-btn .plus-v {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  background: var(--text) !important;
  border-radius: 2px !important;
  display: block !important;
}
#plus-btn .plus-h {
  width: 14px !important;
  height: 2px !important;
  margin-top: -1px !important;
  margin-left: -7px !important;
  top: 50% !important;
  left: 50% !important;
  transform: none !important;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
#plus-btn .plus-v {
  width: 2px !important;
  height: 14px !important;
  margin-top: -7px !important;
  margin-left: -1px !important;
  top: 50% !important;
  left: 50% !important;
  transform: none !important;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
#plus-btn.active .plus-h {
  transform: rotate(45deg) !important;
}
#plus-btn.active .plus-v {
  transform: rotate(45deg) !important;
}

/* ── Smooth Gradient & Blur Transition Above Input Bar ── */
#chat-fade {
  position: relative !important;
  flex-shrink: 0 !important;
  height: 72px !important;
  margin-bottom: -72px !important;
  pointer-events: none !important;
  z-index: 2 !important;
  background: linear-gradient(to bottom, transparent 0%, rgba(17, 17, 17, 0.35) 45%, rgba(17, 17, 17, 0.9) 100%) !important;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 70%) !important;
  mask-image: linear-gradient(to bottom, transparent 0%, #000 70%) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 0 !important;
}
body.theme-light #chat-fade,
html[data-theme="light"] #chat-fade {
  background: linear-gradient(to bottom, transparent 0%, rgba(250, 250, 250, 0.35) 45%, rgba(250, 250, 250, 0.9) 100%) !important;
}


/* ── Clean, Proportional Chat Bubbles ── */
.message {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  display: flex;
}
.message.user {
  justify-content: flex-end;
}
.message.ai {
  justify-content: flex-start;
}
.bubble {
  font-size: 15px;
  line-height: 1.6;
  box-sizing: border-box;
  word-break: break-word;
}
.message.user .bubble {
  background: var(--user-bubble);
  color: var(--user-text);
  border-radius: 18px !important;
  padding: 10px 16px !important;
  max-width: 72% !important;
  min-width: 0 !important;
  width: fit-content !important;
  box-shadow: none;
  white-space: pre-wrap;
}
.message.ai .bubble {
  background: var(--ai-bubble);
  color: var(--text);
  border-radius: 18px !important;
  padding: 12px 18px !important;
  max-width: 86% !important;
  border: 1px solid var(--ai-border);
}


/* ── Settings Usage Panel Styles ── */
.usage-card {
  margin: 14px 0 16px;
  padding: 18px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02) !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
body.theme-light .usage-card,
html[data-theme="light"] .usage-card {
  background: rgba(0, 0, 0, 0.02) !important;
  border: none !important;
}
.usage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.usage-plan-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(31, 111, 235, 0.18);
  color: var(--accent-primary, #3b82f6);
  margin-bottom: 6px;
}
.usage-token-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.usage-percentage {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-primary, #3b82f6);
}
.usage-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}
body.theme-light .usage-progress-bar-wrap,
html[data-theme="light"] .usage-progress-bar-wrap {
  background: rgba(0, 0, 0, 0.08);
}
.usage-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-primary, #10b981) !important;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.usage-footer-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.usage-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.usage-info-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
body.theme-light .usage-info-item,
html[data-theme="light"] .usage-info-item {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
}
.usage-info-item strong {
  font-size: 13px;
  color: var(--text);
}
.usage-info-item span {
  font-size: 12px;
  color: var(--muted);
}


/* ── Inline Chat Message Skeleton Loader ── */
.inline-skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 2px;
  min-width: 180px;
  max-width: 280px;
}
.inline-skeleton-line {
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.16) 50%, rgba(255, 255, 255, 0.05) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s infinite linear;
}
body.theme-light .inline-skeleton-line,
html[data-theme="light"] .inline-skeleton-line {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.05) 25%, rgba(0, 0, 0, 0.14) 50%, rgba(0, 0, 0, 0.05) 75%);
  background-size: 200% 100%;
}


/* ── Dynamically Morphing Chat Skeleton Loader ── */
.inline-skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 2px;
  min-width: 180px;
  max-width: 320px;
  width: 100%;
}
.inline-skeleton-line {
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 20%, rgba(255, 255, 255, 0.18) 50%, rgba(255, 255, 255, 0.05) 80%);
  background-size: 250% 100%;
}
.inline-skeleton-line:nth-child(1) {
  width: 65%;
  animation: skeletonShimmer 1.4s infinite linear, skeletonMorph1 3.2s infinite ease-in-out;
}
.inline-skeleton-line:nth-child(2) {
  width: 88%;
  animation: skeletonShimmer 1.4s infinite linear, skeletonMorph2 3.8s infinite ease-in-out;
}
.inline-skeleton-line:nth-child(3) {
  width: 45%;
  animation: skeletonShimmer 1.4s infinite linear, skeletonMorph3 2.9s infinite ease-in-out;
}

@keyframes skeletonMorph1 {
  0% { width: 55%; opacity: 0.8; }
  33% { width: 85%; opacity: 1; }
  66% { width: 40%; opacity: 0.7; }
  100% { width: 55%; opacity: 0.8; }
}

@keyframes skeletonMorph2 {
  0% { width: 88%; opacity: 1; }
  33% { width: 60%; opacity: 0.75; }
  66% { width: 95%; opacity: 0.95; }
  100% { width: 88%; opacity: 1; }
}

@keyframes skeletonMorph3 {
  0% { width: 45%; opacity: 0.75; }
  33% { width: 72%; opacity: 0.9; }
  66% { width: 32%; opacity: 0.65; }
  100% { width: 45%; opacity: 0.75; }
}


/* ── Natural Single-Shape Skeleton Loaders & Trailing Shimmer ── */
.organic-skeleton-loader {
  display: inline-block;
  min-height: 28px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 20%, rgba(255, 255, 255, 0.18) 50%, rgba(255, 255, 255, 0.05) 80%);
  background-size: 250% 100%;
  animation: skeletonShimmer 1.2s infinite linear, organicPulse 2.8s infinite ease-in-out;
}
body.theme-light .organic-skeleton-loader,
html[data-theme="light"] .organic-skeleton-loader {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.05) 20%, rgba(0, 0, 0, 0.14) 50%, rgba(0, 0, 0, 0.05) 80%);
  background-size: 250% 100%;
}
.organic-skeleton-shape-1 {
  width: 140px;
  height: 32px;
  border-radius: 16px 16px 6px 16px;
}
.organic-skeleton-shape-2 {
  width: 220px;
  height: 36px;
  border-radius: 18px 18px 18px 6px;
}
.organic-skeleton-shape-3 {
  width: 175px;
  height: 44px;
  border-radius: 20px 14px 20px 14px;
}
.organic-skeleton-shape-4 {
  width: 260px;
  height: 32px;
  border-radius: 16px;
}

@keyframes organicPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.02); opacity: 1; }
}

.typewriter-ghost-trail {
  display: inline-block;
  vertical-align: middle;
  height: 12px;
  width: 54px;
  margin-left: 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06) 20%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0.06) 80%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.1s infinite linear;
}
body.theme-light .typewriter-ghost-trail,
html[data-theme="light"] .typewriter-ghost-trail {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.06) 20%, rgba(0, 0, 0, 0.16) 50%, rgba(0, 0, 0, 0.06) 80%);
  background-size: 200% 100%;
}


/* ── Full-Length Message Bubbles & Multi-Line Skeleton Loaders ── */
.message.ai .bubble {
  background: var(--ai-bubble);
  color: var(--text);
  border-radius: 18px 18px 18px 4px !important;
  padding: 14px 18px !important;
  max-width: 86% !important;
  min-width: min(320px, 80%) !important;
  width: fit-content;
  border: 1px solid var(--ai-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.full-skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px;
  width: 100%;
  min-width: 260px;
}

.full-skeleton-line {
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 20%, rgba(255, 255, 255, 0.17) 50%, rgba(255, 255, 255, 0.05) 80%);
  background-size: 250% 100%;
  animation: skeletonShimmer 1.3s infinite linear;
}

body.theme-light .full-skeleton-line,
html[data-theme="light"] .full-skeleton-line {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.05) 20%, rgba(0, 0, 0, 0.13) 50%, rgba(0, 0, 0, 0.05) 80%);
  background-size: 250% 100%;
}

/* Multi-line trailing skeleton lines ahead of the typewriter */
.typewriter-trailing-skeleton {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 10px;
  width: 100%;
}

.typewriter-trailing-line {
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06) 20%, rgba(255, 255, 255, 0.18) 50%, rgba(255, 255, 255, 0.06) 80%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.1s infinite linear;
}

body.theme-light .typewriter-trailing-line,
html[data-theme="light"] .typewriter-trailing-line {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.06) 20%, rgba(0, 0, 0, 0.15) 50%, rgba(0, 0, 0, 0.06) 80%);
  background-size: 200% 100%;
}


/* ── Clean Message Bubbles (No AI border, User message card) ── */
.message.user .bubble {
  background: var(--user-bubble);
  color: var(--user-text);
  border-radius: 18px 18px 4px 18px !important;
  padding: 13px 18px !important;
  max-width: 78% !important;
  min-width: min(160px, 60%) !important;
  width: fit-content !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: none !important;
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.6;
}

.message.ai .bubble {
  background: var(--ai-bubble);
  color: var(--text);
  border-radius: 18px 18px 18px 4px !important;
  padding: 14px 18px !important;
  max-width: 86% !important;
  min-width: min(320px, 80%) !important;
  width: fit-content;
  border: none !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}


/* ── Clean Top-Only Input Bar Transition Blur ── */
#chat-window {
  -webkit-mask-image: none !important;
  mask-image: none !important;
  padding-bottom: 24px !important;
}

#chat-fade {
  display: block !important;
  position: relative !important;
  flex-shrink: 0 !important;
  height: 64px !important;
  margin-top: -64px !important;
  margin-bottom: 0 !important;
  pointer-events: none !important;
  z-index: 5 !important;
  background: linear-gradient(to bottom, transparent 0%, rgba(17, 17, 17, 0.4) 40%, rgba(17, 17, 17, 0.95) 100%) !important;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 70%) !important;
  mask-image: linear-gradient(to bottom, transparent 0%, #000 70%) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 0 !important;
}

body.theme-light #chat-fade,
html[data-theme="light"] #chat-fade {
  background: linear-gradient(to bottom, transparent 0%, rgba(250, 250, 250, 0.4) 40%, rgba(250, 250, 250, 0.95) 100%) !important;
}

/* Remove blur completely on start / welcome screen */
#main.has-welcome #chat-fade {
  display: none !important;
}

.sidebar-skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 6px;
}
.sidebar-skeleton-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  width: 100%;
}
.sidebar-skeleton-text {
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 20%, rgba(255, 255, 255, 0.14) 50%, rgba(255, 255, 255, 0.05) 80%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.3s infinite linear;
}
body.theme-light .sidebar-skeleton-text,
html[data-theme="light"] .sidebar-skeleton-text {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.05) 20%, rgba(0, 0, 0, 0.12) 50%, rgba(0, 0, 0, 0.05) 80%);
  background-size: 200% 100%;
}





/* ── Translucent Frosted Glass & Smooth Fade In/Out for All Modals & Popups ── */

/* 1. Main Action & Confirmation Modal (#modal) */
.modal-bg {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.24s;
}

.modal-bg.open,
.modal-bg.visible,
.modal-bg.active {
  display: flex !important;
  visibility: visible !important;
}

.modal-bg.visible,
.modal-bg.active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-bg.visible .modal-backdrop,
.modal-bg.active .modal-backdrop {
  opacity: 1;
}

.modal {
  position: relative;
  z-index: 1;
  background: rgba(26, 29, 34, 0.72) !important;
  backdrop-filter: blur(32px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.25) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 22px !important;
  padding: 26px 28px !important;
  width: 440px !important;
  max-width: min(92vw, 460px) !important;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
  opacity: 0;
  transform: scale(0.95) translateY(6px);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.modal-bg.visible .modal,
.modal-bg.active .modal {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.modal h3 {
  font-size: 20px !important;
  font-weight: 650 !important;
  color: var(--text, #fff) !important;
  letter-spacing: -0.3px;
  margin-bottom: 10px !important;
  text-align: left !important;
}

.modal p.modal-sub {
  font-size: 13.5px !important;
  color: var(--muted, #94a3b8) !important;
  line-height: 1.55 !important;
  text-align: left !important;
  margin-bottom: 22px !important;
}

.modal input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  color: var(--text, #fff) !important;
  font-size: 14px !important;
  outline: none;
  margin-bottom: 20px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal input:focus {
  border-color: var(--accent-primary, #1f6feb) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary, #1f6feb) 20%, transparent);
}

.modal-actions {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

.modal-btn {
  flex: none !important;
  padding: 9px 18px !important;
  border-radius: 12px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.16s ease !important;
  font-family: inherit !important;
}

.modal-btn.cancel {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text, #cbd5e1) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.modal-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #fff !important;
}

.modal-btn.danger {
  background: var(--danger, #f85149) !important;
  color: #fff !important;
  border: none !important;
}

.modal-btn.danger:hover {
  background: #e03d35 !important;
}

.modal-btn.primary {
  background: var(--accent-primary, #1f6feb) !important;
  color: #fff !important;
  border: none !important;
}

.modal-btn.primary:hover {
  background: var(--accent-primary-hover, #1a60d6) !important;
}

/* 2. Plus Popup Menu */
.plus-popup {
  background: rgba(26, 26, 28, 0.65) !important;
  backdrop-filter: blur(28px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
  border: none !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
}

/* 3. Model Selector Menu */
#model-menu {
  background: rgba(26, 29, 34, 0.8) !important;
  backdrop-filter: blur(32px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.25) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45) !important;
}

/* 4. Context Menu (#ctx-menu) */
.ctx-menu {
  background: rgba(26, 29, 34, 0.82) !important;
  backdrop-filter: blur(28px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(28px) saturate(1.25) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45) !important;
}

/* 5. BYOK Box */
#byok-box {
  background: rgba(26, 29, 34, 0.76) !important;
  backdrop-filter: blur(32px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.25) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6) !important;
}

/* Light Theme Overrides */
body.theme-light .modal {
  background: rgba(255, 255, 255, 0.82) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12) !important;
}
body.theme-light .modal h3 {
  color: #0f172a !important;
}
body.theme-light .modal p.modal-sub {
  color: #64748b !important;
}
body.theme-light .modal input {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: #0f172a !important;
}
body.theme-light .modal-btn.cancel {
  background: rgba(0, 0, 0, 0.06) !important;
  color: #334155 !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}
body.theme-light .modal-btn.cancel:hover {
  background: rgba(0, 0, 0, 0.1) !important;
}
body.theme-light .plus-popup,
body.theme-light #model-menu,
body.theme-light .ctx-menu,
body.theme-light #byok-box {
  background: rgba(255, 255, 255, 0.85) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}


/* ── Remove Border on All Popups & Modals + Translucent Frosted Glass ── */
.modal,
.plus-popup,
#model-menu,
.ctx-menu,
#byok-box,
.settings-popup,
.settings-detail-box,
.celo-confirm-box,
.auth-box,
.chat-search-box,
.guest-feature-popover,
.custom-color-picker,
.artifact-dialog {
  border: none !important;
  border-width: 0 !important;
}

/* ── Transparent Background Inside Cards in Settings (Appearance) ── */
.theme-card,
.theme-card.active,
.theme-card:hover,
.font-card,
.font-card.active,
.font-card:hover {
  background: transparent !important;
}

.accent-custom-swatch {
  background: transparent !important;
}

.custom-color-picker {
  background: rgba(26, 29, 34, 0.8) !important;
  backdrop-filter: blur(32px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.25) !important;
  border: none !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5) !important;
}

/* ── Data Control & Confirmation Popups (Frosted, Smooth, Transparent Backdrop) ── */
.celo-confirm-overlay {
  display: flex !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  background: transparent !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transition: opacity 0.24s ease, visibility 0.24s ease !important;
}

.celo-confirm-overlay.open {
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.celo-confirm-backdrop {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.35) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  opacity: 0 !important;
  transition: opacity 0.24s ease !important;
}

.celo-confirm-overlay.open .celo-confirm-backdrop {
  opacity: 1 !important;
}

.celo-confirm-box {
  position: relative !important;
  z-index: 1 !important;
  background: rgba(22, 24, 28, 0.55) !important;
  backdrop-filter: blur(28px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
  border: none !important;
  outline: none !important;
  border-radius: 20px !important;
  padding: 24px 26px !important;
  width: 400px !important;
  max-width: min(92vw, 420px) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4) !important;
  opacity: 0 !important;
  transform: scale(0.96) translateY(6px) !important;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1), transform 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.celo-confirm-overlay.open .celo-confirm-box {
  opacity: 1 !important;
  transform: scale(1) translateY(0) !important;
}

/* ── Redesigned Clean Red Stop Chat Button ── */
.stop-btn,
#stop-btn {
  display: none;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: #ef4444 !important;
  border: none !important;
  color: #ffffff !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4) !important;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease !important;
}

.stop-btn:hover,
#stop-btn:hover {
  background: #dc2626 !important;
  transform: scale(1.06) !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5) !important;
}

.stop-btn:active,
#stop-btn:active {
  transform: scale(0.94) !important;
}

.stop-icon-inner {
  display: block;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-radius: 2px;
}

/* ── BYOK Get Key Button ── */
.byok-get-key-btn {
  display: inline-flex;
  align-items: center;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #10b981 !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.18s ease, color 0.18s ease, text-decoration 0.18s ease;
}

.byok-get-key-btn:hover {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #34d399 !important;
  opacity: 0.85;
  text-decoration: underline !important;
}

.celo-confirm-title {
  font-size: 20px !important;
  font-weight: 650 !important;
  color: var(--text, #fff) !important;
  letter-spacing: -0.3px !important;
  margin-bottom: 10px !important;
  text-align: left !important;
}

.celo-confirm-bullets {
  list-style: disc !important;
  padding-left: 18px !important;
  margin: 0 0 12px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.celo-confirm-bullets li {
  font-size: 13.5px !important;
  color: var(--muted, #94a3b8) !important;
  line-height: 1.5 !important;
  text-align: left !important;
}

.celo-confirm-proceed {
  font-size: 13.5px !important;
  color: var(--muted, #94a3b8) !important;
  margin-bottom: 22px !important;
  text-align: left !important;
  line-height: 1.55 !important;
}

.celo-confirm-actions {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

.celo-btn-cancel {
  min-height: auto !important;
  padding: 9px 18px !important;
  border-radius: 12px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text, #cbd5e1) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  transition: all 0.16s ease !important;
  font-family: inherit !important;
}

.celo-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #fff !important;
}

.celo-btn-confirm {
  min-height: auto !important;
  padding: 9px 18px !important;
  border-radius: 12px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  border: none !important;
  transition: all 0.16s ease !important;
  font-family: inherit !important;
}

.celo-btn-confirm.danger {
  background: var(--danger, #f85149) !important;
  color: #fff !important;
}

.celo-btn-confirm.danger:hover {
  background: #e03d35 !important;
}

.celo-btn-confirm.primary {
  background: var(--accent-primary, #1f6feb) !important;
  color: #fff !important;
}

.celo-btn-confirm.primary:hover {
  background: var(--accent-primary-hover, #1a60d6) !important;
}


/* ── Desktop Welcome Typewriter Vertical Placement ── */
@media (min-width: 641px) {
  #chat-window .welcome {
    margin-top: auto !important;
    margin-bottom: 28px !important;
  }
}


/* ── Compact Weekly Usage Card (Everything Tightly Grouped) ── */
.usage-card {
  margin: 6px 0 12px !important;
  padding: 12px 14px !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, 0.02) !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.usage-plan-badge {
  display: none !important;
}

.usage-header {
  display: flex !important;
  align-items: baseline !important;
  justify-content: space-between !important;
  gap: 8px !important;
  margin-bottom: 6px !important;
}

.usage-token-count {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  line-height: 1.2 !important;
}

.usage-percentage {
  font-size: 17px !important;
  font-weight: 800 !important;
  color: var(--accent-primary, #3b82f6) !important;
  line-height: 1.2 !important;
}

.usage-progress-bar-wrap {
  width: 100% !important;
  height: 5px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  margin-bottom: 6px !important;
}

.usage-footer-info {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-size: 11.5px !important;
  color: var(--muted) !important;
  line-height: 1.2 !important;
}


/* ── Modern Frosted Ad-Blocker Modal Dialog ── */
#feature-access-notice {
  position: fixed !important;
  inset: 0 !important;
  z-index: 20000 !important;
  display: none;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  background: transparent !important;
}

.adblock-detected #feature-access-notice {
  display: flex !important;
}

.adblock-backdrop {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

.adblock-card {
  position: relative !important;
  z-index: 1 !important;
  width: 440px !important;
  max-width: min(92vw, 460px) !important;
  padding: 26px 28px !important;
  background: rgba(26, 29, 34, 0.76) !important;
  backdrop-filter: blur(32px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.25) !important;
  border: none !important;
  border-radius: 22px !important;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6) !important;
  text-align: left !important;
  animation: modalPopIn 0.24s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.adblock-card h2 {
  font-size: 20px !important;
  font-weight: 650 !important;
  color: var(--text, #fff) !important;
  letter-spacing: -0.3px !important;
  margin: 0 0 10px !important;
  text-align: left !important;
}

.adblock-sub {
  font-size: 13.5px !important;
  color: var(--muted, #94a3b8) !important;
  line-height: 1.55 !important;
  margin: 0 0 14px !important;
}

.adblock-points {
  list-style: disc !important;
  padding-left: 18px !important;
  margin: 0 0 22px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.adblock-points li {
  font-size: 13px !important;
  color: var(--muted, #94a3b8) !important;
  line-height: 1.45 !important;
}

.adblock-actions {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

.adblock-actions button {
  width: auto !important;
  min-height: auto !important;
  padding: 9px 18px !important;
  border-radius: 12px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.16s ease !important;
  font-family: inherit !important;
}

.adblock-limited-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text, #cbd5e1) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.adblock-limited-btn:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #fff !important;
}

.adblock-reload-btn {
  background: var(--accent-primary, #1f6feb) !important;
  color: #fff !important;
  border: none !important;
}

.adblock-reload-btn:hover {
  background: var(--accent-primary-hover, #1a60d6) !important;
}

/* ── Halve the Distance Between Welcome Typewriter & Input Bar ── */
#chat-window .welcome {
  margin-top: auto !important;
  margin-bottom: 10px !important;
  padding: 0 0 4px !important;
}

@media (max-width: 640px) {
  #chat-window .welcome {
    margin-top: auto !important;
    margin-bottom: 8px !important;
    padding: 0 0 4px !important;
  }
}


/* ── Auth Screen: Transparent Inputs, Centered Close Button, CeloAI Title ── */
.auth-field input,
.password-field input,
#auth-email,
#auth-password,
#auth-name {
  background: transparent !important;
  border: 1.5px solid rgba(255, 255, 255, 0.12) !important;
}

.auth-field input:focus,
.password-field input:focus {
  background: transparent !important;
  border-color: var(--accent-primary, #1f6feb) !important;
}

.auth-logo {
  text-transform: none !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
}

.auth-close {
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  line-height: 1 !important;
  font-size: 18px !important;
}

/* ── Ad-Blocker Popup: Matching Background & Compact Buttons ── */
#feature-access-notice .adblock-card {
  background: rgba(26, 29, 34, 0.72) !important;
  backdrop-filter: blur(32px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.25) !important;
  border: none !important;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55) !important;
}

#feature-access-notice .adblock-actions {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

#feature-access-notice .adblock-actions button {
  width: auto !important;
  min-height: 34px !important;
  height: 34px !important;
  padding: 0 16px !important;
  border-radius: 10px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 34px !important;
}

/* ── Mobile Welcome Text Distance: Snug to Input Bar ── */
@media (max-width: 640px) {
  #main.has-welcome #chat-window {
    padding-bottom: 0 !important;
    justify-content: flex-end !important;
  }
  #main.has-welcome #chat-window .welcome {
    margin-top: auto !important;
    margin-bottom: 0 !important;
    padding-bottom: 2px !important;
  }
  #main.has-welcome #input-area {
    padding-top: 4px !important;
  }
}


/* ── Ad-Blocker Bigger Action Buttons ── */
#feature-access-notice .adblock-actions {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 12px !important;
}

#feature-access-notice .adblock-actions button {
  width: auto !important;
  min-height: 40px !important;
  height: 40px !important;
  padding: 0 22px !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 40px !important;
}


/* ── Translucent Frosted Cookie Consent & Ad-Blocker Popups ── */
.cookie-consent {
  background: rgba(26, 29, 34, 0.72) !important;
  backdrop-filter: blur(32px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.25) !important;
  border: none !important;
  border-radius: 18px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55) !important;
}

.cookie-btn {
  border-radius: 10px !important;
  padding: 8px 12px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  transition: all 0.15s ease !important;
}

.cookie-btn-outline {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: var(--text, #cbd5e1) !important;
}

.cookie-btn-outline:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #fff !important;
}

.cookie-btn-primary {
  background: var(--accent-primary, #1f6feb) !important;
  color: #fff !important;
  border: none !important;
}

.cookie-btn-primary:hover {
  background: var(--accent-primary-hover, #1a60d6) !important;
}

#feature-access-notice .adblock-card {
  background: rgba(26, 29, 34, 0.72) !important;
  backdrop-filter: blur(32px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.25) !important;
  border: none !important;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55) !important;
}


/* ── Naturally Sized Message Bubbles (No elongation on short messages) ── */
.message.user .bubble {
  background: var(--user-bubble) !important;
  color: var(--user-text) !important;
  border-radius: 18px 18px 4px 18px !important;
  padding: 10px 16px !important;
  max-width: 78% !important;
  min-width: 0 !important;
  width: fit-content !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  border: none !important;
  white-space: pre-wrap !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
}

.message.ai .bubble {
  background: var(--ai-bubble) !important;
  color: var(--text) !important;
  border-radius: 18px 18px 18px 4px !important;
  padding: 12px 16px !important;
  max-width: 86% !important;
  min-width: 0 !important;
  width: fit-content !important;
  border: none !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06) !important;
}


/* ── Sleek Custom Scrollbars (Transparent & Slim) ── */
*::-webkit-scrollbar {
  width: 5px !important;
  height: 5px !important;
}
*::-webkit-scrollbar-track {
  background: transparent !important;
}
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12) !important;
  border-radius: 999px !important;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.12) !important; }
*::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

#user-input {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
#user-input::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

#sidebar,
.sb-convs,
#conv-list,
.settings-detail-content,
.connections-page-inner {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent !important;
}


/* ── Sleek Frosted Transparent Context Menu (#ctx-menu) ── */
.ctx-menu {
  background: rgba(24, 27, 32, 0.72) !important;
  backdrop-filter: blur(32px) saturate(1.3) !important;
  -webkit-backdrop-filter: blur(32px) saturate(1.3) !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 6px !important;
  min-width: 144px !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42) !important;
  z-index: 9999 !important;
}

.ctx-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--text) !important;
  border-radius: 8px !important;
  border: none !important;
  background: transparent !important;
  cursor: pointer !important;
  width: 100% !important;
  text-align: left !important;
  transition: background 0.12s ease, color 0.12s ease !important;
}

.ctx-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

.ctx-item.danger {
  color: #ff5c5c !important;
}

.ctx-item.danger:hover {
  background: rgba(255, 75, 75, 0.12) !important;
  color: #ff7070 !important;
}

.ctx-item svg {
  width: 14px !important;
  height: 14px !important;
  opacity: 0.88 !important;
}


/* ── Unified Smooth Modal Overlays (Eliminated double-darkening glitch) ── */
.modal-bg {
  background: transparent !important;
}
.modal-bg .modal-backdrop {
  background: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  opacity: 0 !important;
  transition: opacity 0.2s ease !important;
}
.modal-bg.open.visible .modal-backdrop {
  opacity: 1 !important;
}



/* ── Unified All-At-Once Connections Fade-In (No line-by-line delay) ── */
.connections-enter .conn-page-card {
  animation: unifiedConnCardIn 0.2s ease-out forwards !important;
  animation-delay: 0ms !important;
  opacity: 1 !important;
}

@keyframes unifiedConnCardIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ══════════════════════════════════════════════════════════════
   NO-BORDER NATURAL USER BUBBLE EDIT STATE & AUTH BUTTON SPINNER
   ══════════════════════════════════════════════════════════════ */
.message.user.editing {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  width: 100% !important;
}

.message.user.editing .bubble {
  border-radius: 20px !important;
  padding: 10px 20px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
}

.user-edit-input {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: #ffffff !important;
  font-size: 14.5px !important;
  line-height: 1.5 !important;
  font-family: inherit !important;
  resize: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.user-edit-buttons {
  display: flex !important;
  gap: 6px !important;
  margin-top: 6px !important;
  justify-content: flex-end !important;
}

.user-edit-btn {
  padding: 5px 12px !important;
  border-radius: 9999px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  border: none !important;
  transition: background 0.15s ease, opacity 0.15s ease !important;
}

.user-edit-btn.cancel {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text, #ffffff) !important;
}
.user-edit-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.16) !important;
}

.user-edit-btn.submit {
  background: #ffffff !important;
  color: #000000 !important;
}
.user-edit-btn.submit:hover:not(:disabled) {
  background: #e0e0e0 !important;
}
.user-edit-btn.submit:disabled {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
}

/* Auth Buttons & Circle Loading Spinner */
.auth-btn-spinner,
.spinner-loader {
  display: inline-block !important;
  width: 20px !important;
  height: 20px !important;
  border: 2.5px solid rgba(255, 255, 255, 0.3) !important;
  border-top-color: #ffffff !important;
  border-radius: 50% !important;
  animation: authSpin 0.7s linear infinite !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

@keyframes authSpin {
  to {
    transform: rotate(360deg);
  }
}

.auth-btn,
#auth-submit-btn,
#auth-continue-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 48px !important;
  height: 48px !important;
  padding: 0 18px !important;
  box-sizing: border-box !important;
  border-radius: 12px !important;
}

.auth-btn:disabled,
#auth-submit-btn:disabled,
#auth-continue-btn:disabled {
  opacity: 0.8 !important;
  cursor: not-allowed !important;
}

/* ══════════════════ MASTER UI FIXES & ENHANCEMENTS ══════════════════ */

/* ── 1. User Message Pill & Transparent AI Message ── */
.message.user {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  justify-content: flex-end !important;
  width: 100% !important;
  margin: 6px 0 16px !important;
}

.message.user .bubble {
  border-radius: 9999px !important;
  padding: 8px 18px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: #ffffff !important;
  font-size: 14.5px !important;
  line-height: 1.5 !important;
  width: fit-content !important;
  max-width: min(80%, 720px) !important;
  box-sizing: border-box !important;
  word-break: break-word !important;
}

.message.ai,
.message.assistant {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  width: 100% !important;
  margin: 6px 0 20px !important;
  background: transparent !important;
}

.message.ai .bubble,
.message.assistant .bubble,
.bubble.assistant,
.bubble.ai {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 2px 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  color: var(--text, #ffffff) !important;
  font-size: 15px !important;
  line-height: 1.65 !important;
}

/* ── 2. User Message Action Buttons (Copy & Edit) ── */
.user-msg-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 4px !important;
  margin-top: 4px !important;
  padding-right: 4px !important;
  opacity: 0.7 !important;
  transition: opacity 0.15s ease !important;
}

.message.user:hover .user-msg-actions {
  opacity: 1 !important;
}

.user-msg-action-btn,
button.user-msg-action-btn {
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  min-height: 26px !important;
  max-width: 26px !important;
  max-height: 26px !important;
  flex: 0 0 26px !important;
  border-radius: 50% !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  background-color: transparent !important;
  color: rgba(255, 255, 255, 0.45) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease !important;
}

.user-msg-action-btn:hover,
button.user-msg-action-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  transform: scale(1.08) !important;
}

.user-msg-action-btn:active,
button.user-msg-action-btn:active {
  transform: scale(0.92) !important;
}

.user-msg-action-btn svg,
button.user-msg-action-btn svg {
  width: 14px !important;
  height: 14px !important;
  stroke: currentColor !important;
  stroke-width: 2 !important;
  fill: none !important;
  display: block !important;
}

/* ── 3. Compact & Borderless User Message Edit Mode ── */
.message.user.editing {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  width: 100% !important;
}

.message.user.editing .bubble {
  border-radius: 18px !important;
  padding: 8px 16px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  width: fit-content !important;
  max-width: min(80%, 720px) !important;
  box-sizing: border-box !important;
}

.user-edit-input {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: #ffffff !important;
  font-size: 14.5px !important;
  line-height: 1.45 !important;
  font-family: inherit !important;
  resize: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.user-edit-buttons {
  display: flex !important;
  gap: 6px !important;
  margin-top: 6px !important;
  justify-content: flex-end !important;
}

.user-edit-btn,
button.user-edit-btn {
  padding: 5px 12px !important;
  border-radius: 9999px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  border: none !important;
  outline: none !important;
  transition: background 0.15s ease, opacity 0.15s ease !important;
}

.user-edit-btn.cancel,
button.user-edit-btn.cancel {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text, #ffffff) !important;
}
.user-edit-btn.cancel:hover,
button.user-edit-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.16) !important;
}

.user-edit-btn.submit,
button.user-edit-btn.submit {
  background: #ffffff !important;
  color: #000000 !important;
}
.user-edit-btn.submit:hover:not(:disabled),
button.user-edit-btn.submit:hover:not(:disabled) {
  background: #e0e0e0 !important;
}
.user-edit-btn.submit:disabled,
button.user-edit-btn.submit:disabled {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
}

/* ── 4. Sidebar Footer Profile Row & Icon Controls ── */
.sb-footer {
  padding: 10px 12px 14px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  margin-top: auto !important;
  flex-shrink: 0 !important;
}

.sb-profile-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 6px 8px !important;
  border-radius: 12px !important;
  gap: 10px !important;
  background: transparent !important;
  transition: background 0.15s ease !important;
}

.sb-profile-row:hover {
  background: rgba(255, 255, 255, 0.05) !important;
}

.sb-user-profile {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

.sb-avatar,
#sb-user-avatar {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  flex: 0 0 32px !important;
  display: grid !important;
  place-items: center !important;
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-sizing: border-box !important;
}

.sb-avatar img,
#sb-user-avatar img,
#sb-gravatar {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
}

.sb-avatar #sb-initials {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  text-transform: uppercase !important;
}

.sb-user-name {
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: var(--text, #ffffff) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-width: 0 !important;
}

.sb-cog-btn,
#settings-btn,
button#settings-btn,
.sb-collapsed-btn,
button.sb-collapsed-btn,
#sb-collapsed-settings-btn,
#sb-collapsed-auth-btn {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  flex: 0 0 32px !important;
  border-radius: 50% !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  background-color: transparent !important;
  color: var(--muted, #8e8e93) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease !important;
}

.sb-cog-btn:hover,
#settings-btn:hover,
button#settings-btn:hover,
.sb-collapsed-btn:hover,
#sb-collapsed-settings-btn:hover,
#sb-collapsed-auth-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

.sb-cog-btn:hover,
#settings-btn:hover {
  transform: rotate(30deg) !important;
}

.sb-cog-btn svg,
#settings-btn svg,
.sb-collapsed-btn svg,
#sb-collapsed-settings-btn svg,
#sb-collapsed-auth-btn svg {
  width: 18px !important;
  height: 18px !important;
  stroke: currentColor !important;
  stroke-width: 2 !important;
  fill: none !important;
}

#sidebar:not(.collapsed) .sb-collapsed-footer,
#sidebar:not(.collapsed) #sb-collapsed-footer,
#sidebar:not(.collapsed) #sb-collapsed-settings-btn,
#sidebar:not(.collapsed) #sb-collapsed-auth-btn {
  display: none !important;
}

#sidebar.collapsed .sb-profile-row,
#sidebar.collapsed #sb-profile-row,
#sidebar.collapsed .guest-login-cta,
#sidebar.collapsed #guest-login-cta {
  display: none !important;
}

#sidebar.collapsed .sb-collapsed-footer,
#sidebar.collapsed #sb-collapsed-footer {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
}

/* ── 5. Sidebar Footer Exclusivity ── */
body.user-logged-in #guest-login-cta,
body.user-logged-in .guest-login-cta,
body.user-logged-in #sb-collapsed-auth-btn {
  display: none !important;
}

body.user-logged-in #sidebar:not(.collapsed) #sb-profile-row {
  display: flex !important;
}

body.user-logged-in #sidebar.collapsed #sb-collapsed-settings-btn {
  display: flex !important;
}

body.user-guest #sb-profile-row,
body.user-guest .sb-profile-row,
body.user-guest #sb-collapsed-settings-btn {
  display: none !important;
}

body.user-guest #sidebar:not(.collapsed) #guest-login-cta {
  display: flex !important;
}

body.user-guest #sidebar.collapsed #sb-collapsed-auth-btn {
  display: flex !important;
}

/* ── 6. Red Translucent Notification Toast ── */
#error-toast {
  background: rgba(220, 38, 38, 0.45) !important;
  backdrop-filter: blur(28px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(28px) saturate(1.4) !important;
  border: none !important;
  border-radius: 9999px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35) !important;
  color: #ffffff !important;
}

#error-toast button {
  width: 26px !important;
  height: 26px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border: none !important;
  color: #ffffff !important;
  cursor: pointer !important;
}

#error-toast button:hover {
  background: rgba(255, 255, 255, 0.22) !important;
}

/* ── 7. Auth Buttons & Spinner ── */
.auth-btn-spinner,
.spinner-loader {
  display: inline-block !important;
  width: 20px !important;
  height: 20px !important;
  border: 2.5px solid rgba(255, 255, 255, 0.3) !important;
  border-top-color: #ffffff !important;
  border-radius: 50% !important;
  animation: authSpin 0.7s linear infinite !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

@keyframes authSpin {
  to {
    transform: rotate(360deg);
  }
}

.auth-btn,
#auth-submit-btn,
#auth-continue-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 48px !important;
  height: 48px !important;
  padding: 0 18px !important;
  box-sizing: border-box !important;
  border-radius: 12px !important;
}

/* ── 8. Fluid 60fps Skeleton Wave Animation ── */
.full-skeleton-loader {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  padding: 4px 0 !important;
  width: 100% !important;
  max-width: 520px !important;
}

.full-skeleton-line {
  height: 12px !important;
  border-radius: 9999px !important;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.04) 100%
  ) !important;
  background-size: 200% 100% !important;
  animation: smoothSkeletonWave 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
  will-change: background-position, opacity !important;
}

@keyframes smoothSkeletonWave {
  0% {
    background-position: 200% 0;
    opacity: 0.55;
  }
  50% {
    opacity: 0.95;
  }
  100% {
    background-position: -200% 0;
    opacity: 0.55;
  }
}

body.theme-light .full-skeleton-line,
html[data-theme="light"] .full-skeleton-line {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 0%,
    rgba(0, 0, 0, 0.12) 50%,
    rgba(0, 0, 0, 0.04) 100%
  ) !important;
  background-size: 200% 100% !important;
}

/* ── 9. Modern Markdown Tables ── */
.message.ai table,
.message.assistant table,
.bubble table,
table {
  width: 100% !important;
  max-width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  margin: 16px 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  background: rgba(255, 255, 255, 0.025) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.message.ai thead,
.message.assistant thead,
.bubble thead,
table thead {
  background: rgba(255, 255, 255, 0.07) !important;
}

.message.ai thead tr,
.message.assistant thead tr,
.bubble thead tr,
table thead tr {
  background: transparent !important;
}

.message.ai th,
.message.assistant th,
.bubble th,
table th {
  padding: 11px 16px !important;
  font-size: 13.5px !important;
  font-weight: 650 !important;
  color: var(--text, #ffffff) !important;
  text-align: left !important;
  border: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: transparent !important;
}

.message.ai td,
.message.assistant td,
.bubble td,
table td {
  padding: 10px 16px !important;
  font-size: 13.5px !important;
  color: var(--text, #ffffff) !important;
  border: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  line-height: 1.55 !important;
  background: transparent !important;
}

.message.ai tbody tr:last-child td,
.message.assistant tbody tr:last-child td,
.bubble tbody tr:last-child td,
table tbody tr:last-child td {
  border-bottom: none !important;
}

.message.ai tbody tr:hover,
.message.assistant tbody tr:hover,
.bubble tbody tr:hover,
table tbody tr:hover {
  background: rgba(255, 255, 255, 0.035) !important;
}


/* ── Skeleton Loading Styling (Transparent AI & Pill User) ── */
.message.ai .bubble.inline-skeleton-bubble,
.bubble.inline-skeleton-bubble,
.inline-skeleton-bubble,
.chat-skeleton-bubble.ai,
.full-skeleton-loader {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  margin: 0 !important;
}

.chat-skeleton-bubble.user {
  align-self: flex-end !important;
  align-items: flex-end !important;
  border-radius: 9999px !important;
  padding: 8px 18px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  width: fit-content !important;
  max-width: 60% !important;
  box-sizing: border-box !important;
}

.chat-skeleton-bubble.user .full-skeleton-line,
.chat-skeleton-bubble.user .chat-skeleton-line {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0.1) 100%
  ) !important;
  background-size: 200% 100% !important;
}


/* ── Ensure Popups & Trays are Above All Blur Layers ── */
#chat-fade {
  z-index: 1 !important;
}

#input-area {
  position: relative !important;
  z-index: 20 !important;
}

#input-area .bar {
  position: relative !important;
  z-index: 21 !important;
}

.plus-popup,
#plus-popup,
#model-menu,
.ctx-menu {
  z-index: 99999 !important;
}


/* ── Never show blinking cursor | on skeleton loaders ── */
.bubble.inline-skeleton-bubble::after,
.inline-skeleton-bubble::after,
.full-skeleton-loader::after,
.full-skeleton-loader *::after {
  display: none !important;
  content: none !important;
}


/* ── Smooth Pure Opacity Fade-In (Zero Gliding, Zero Choppiness) ── */
@keyframes aiPureFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.message.ai .bubble.ai-fade-in {
  animation: aiPureFadeIn 0.32s ease-in-out forwards;
}

.message.ai .bubble {
  transition: opacity 0.25s ease-in-out;
}

.message.ai .bubble:not(.inline-skeleton-bubble) {
  animation: aiBubbleFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.message.ai .bubble:not(.inline-skeleton-bubble) p,
.message.ai .bubble:not(.inline-skeleton-bubble) pre,
.message.ai .bubble:not(.inline-skeleton-bubble) ul,
.message.ai .bubble:not(.inline-skeleton-bubble) ol,
.message.ai .bubble:not(.inline-skeleton-bubble) table {
  animation: aiBubbleFadeIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ── FLUX Generated Image Card ── */
.generated-image-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 512px;
  margin-top: 4px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface2, rgba(255,255,255,0.04));
  border: 1px solid var(--border, rgba(255,255,255,0.1));
}
.generated-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #0d0e12;
  overflow: hidden;
  cursor: pointer;
}
.generated-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}
.generated-image-wrap:hover img {
  transform: scale(1.02);
}
.generated-image-footer {
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.generated-image-prompt {
  font-size: 13px;
  color: var(--text, #fff);
  line-height: 1.4;
  font-style: italic;
}
.generated-image-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.image-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text, #fff);
  background: var(--surface, rgba(255,255,255,0.08));
  border: 1px solid var(--border, rgba(255,255,255,0.15));
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.image-download-btn:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.3);
}
.image-quota-badge {
  font-size: 11px;
  color: var(--muted, #888);
}

/* ── Simple Box Skeleton for Image Gen ── */
.image-gen-skeleton-bubble {
  width: 280px;
  max-width: 100%;
  padding: 8px !important;
  border-radius: 16px !important;
  background: var(--surface2, rgba(255, 255, 255, 0.04)) !important;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08)) !important;
}
.image-gen-box-skeleton {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.image-skeleton-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: imageShimmer 1.6s infinite ease-in-out;
}
@keyframes imageShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Creating Your Image Braille Dot Loader ── */
.message.ai .bubble.image-loader-bubble,
.image-loader-bubble {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 4px 0 !important;
  margin: 4px 0 !important;
  display: inline-block !important;
  width: fit-content !important;
}

.image-gen-loading-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  background: transparent;
  color: #ececec;
  font-size: 14.5px;
  font-weight: 400;
  letter-spacing: -0.1px;
  user-select: none;
}

.braille-dot-spinner {
  position: relative;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.b-dot {
  position: absolute;
  width: 2.8px;
  height: 2.8px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0.35;
  animation: braillePulse 1.2s infinite ease-in-out;
}

.b-dot-1 {
  top: 1px;
  left: 2px;
  animation-delay: 0s;
}

.b-dot-2 {
  bottom: 1px;
  left: 2px;
  animation-delay: 0.4s;
}

.b-dot-3 {
  top: 5.5px;
  right: 2px;
  animation-delay: 0.8s;
}

@keyframes braillePulse {
  0%, 100% {
    opacity: 0.25;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.3);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
  }
}

body.theme-light .image-gen-loading-pill {
  color: #1a1a1a;
}
body.theme-light .b-dot {
  background: #1a1a1a;
}


/* ── Experimental Feature Modal ── */
.custom-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  transition:
    opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.22s linear;
}
.custom-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
.custom-modal-backdrop {
  position: absolute;
  inset: 0;
}
.custom-modal-box {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: rgba(36, 40, 48, 0.68) !important;
  backdrop-filter: blur(32px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(32px) saturate(160%) !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  outline: none !important;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
  transform: scale(0.95) translateY(8px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.custom-modal.active .custom-modal-box {
  transform: scale(1) translateY(0);
}
.custom-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.custom-modal-icon-wrap.warning {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  flex-shrink: 0;
}
.custom-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text, #ffffff);
}
.custom-modal-body {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted, #a1a1aa);
  margin-bottom: 22px;
}
.custom-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.custom-modal-btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.custom-modal-btn.cancel {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, #ffffff);
}
.custom-modal-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.14);
}
.custom-modal-btn.primary {
  background: var(--accent-primary, #1f6feb);
  color: #ffffff;
}
.custom-modal-btn.primary:hover {
  background: var(--accent-primary-hover, #1a60d6);
}


/* ── Model Selector Menu (Identical to Plus Popup) ── */
#model-menu {
  position: fixed;
  display: block !important;
  visibility: hidden;
  width: 240px !important;
  min-width: 240px !important;
  background: rgba(22, 24, 28, 0.4) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  border: none !important;
  outline: none !important;
  border-radius: 16px !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
  padding: 6px !important;
  z-index: 99999 !important;
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  transform-origin: top center;
  pointer-events: none;
  transition:
    opacity 0.1s ease,
    transform 0.12s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.1s linear;
  overflow: hidden;
  box-sizing: border-box;
}

#model-menu.open {
  visibility: visible !important;
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  pointer-events: auto !important;
  transition-delay: 0s !important;
}

#model-menu-inner {
  overflow-y: auto;
  max-height: 240px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#model-menu-inner::-webkit-scrollbar {
  width: 3px;
}
#model-menu-inner::-webkit-scrollbar-track {
  background: transparent;
}
#model-menu-inner::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.model-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  color: #ececec !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer;
  border: none !important;
  border-bottom: none !important;
  min-height: 38px;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  background: transparent;
}

.model-opt:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

.model-opt.selected {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #ffffff !important;
}

.model-opt.selected:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

.model-opt > span:first-child {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-opt .check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #ffffff;
  opacity: 0;
  display: none;
  margin-left: auto;
}

.model-opt.selected .check {
  opacity: 1;
  display: block;
}

body.theme-midnight #model-menu,
html[data-theme="midnight"] #model-menu {
  background: rgba(10, 12, 16, 0.4) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  border: none !important;
}

body.theme-light #model-menu,
html[data-theme="light"] #model-menu {
  background: rgba(255, 255, 255, 0.45) !important;
  backdrop-filter: blur(28px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(200%) !important;
  border: none !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.06) !important;
}
body.theme-light .model-opt {
  color: #1a1a1a !important;
}
body.theme-light .model-opt:hover {
  background: rgba(0, 0, 0, 0.06) !important;
}
body.theme-light .model-opt.selected {
  background: rgba(0, 0, 0, 0.04) !important;
}
body.theme-light .model-opt .check {
  color: #1a1a1a !important;
}
