/* ==========================================================================
   Millisa AI - ChatGPT-Familiar Interface Design System
   Exact Visual Fidelity, Fluid Ergonomics, Obsessively Crafted
   ========================================================================== */

:root {
  /* ChatGPT Dark Theme Color Tokens */
  --bg-canvas: #212121;
  --bg-sidebar: #171717;
  --bg-pill: #2f2f2f;
  --bg-pill-hover: #383838;
  --bg-surface: #262626;
  --bg-surface-hover: #2f2f2f;
  --bg-surface-active: #343434;
  --bg-modal: #282828;
  --bg-code: #181818;

  /* Borders */
  --border-subtle: #2f2f2f;
  --border-medium: #3f3f46;
  --border-focus: #52525b;

  /* Typography Colors */
  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-tertiary: #71717a;
  --text-muted: #52525b;

  /* Accent Colors */
  --accent-blue: #2563eb;
  --accent-purple: #8b5cf6;
  --accent-green: #10a37f;
  --accent-amber: #f59e0b;

  /* Geometry & Metrics */
  --sidebar-width: 260px;
  --pill-max-width: 760px;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  /* Transitions */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 120ms ease;
  --transition: 200ms var(--ease);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code, pre, .font-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Master App Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

/* ──────────────────────────────────────────────────────────────────────────
   SIDEBAR (ChatGPT Style)
   ────────────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: 0;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  overflow: hidden; /* Clips all children cleanly */
  transition: width 0.22s var(--ease), min-width 0.22s var(--ease), opacity 0.2s ease, border-color 0.2s ease;
  z-index: 100;
  user-select: none;
}

.sidebar-inner {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border-right: none !important;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: width 0.22s var(--ease), min-width 0.22s var(--ease), opacity 0.15s ease, visibility 0.22s;
}

/* Sidebar open button in the main viewport header */
.btn-sidebar-toggle-main {
  display: none; /* Hidden on desktop when sidebar is open */
}

/* When sidebar is collapsed, reveal the open toggle in main header */
.sidebar.collapsed ~ .main-viewport .btn-sidebar-toggle-main {
  display: flex;
}

.sidebar-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.85rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}

.brand-logo-img {
  height: 26px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  display: block;
}

.brand-sparkle {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* New Chat Primary Button */
.new-chat-btn {
  margin: 0.25rem 0.75rem 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.new-chat-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
}

.new-chat-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.shortcut-badge {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Sidebar Nav Action Button (Plugins) */
#btn-plugins,
.sidebar-nav-action-btn {
  margin: 0 0.75rem 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  width: calc(100% - 1.5rem);
  box-sizing: border-box;
  outline: none;
  transition: all var(--transition-fast);
}

#btn-plugins:hover,
.sidebar-nav-action-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.sidebar-action-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sidebar-nav-action-btn svg {
  color: #38bdf8;
}

.plugin-count-pill {
  font-size: 0.68rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-pill);
}

/* Top Nav Links (Library, Projects, Scheduled, etc.) */
.sidebar-nav-links {
  padding: 0 0.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-nav-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.sidebar-nav-item svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.8;
  color: var(--text-secondary);
}

/* Chat History List */
.sidebar-history {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.history-section-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.65rem 0.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ──────────────────────────────────────────────────────────────────────────
   SIDEBAR FOLDERS SYSTEM (Projects / Collections)
   ────────────────────────────────────────────────────────────────────────── */
.history-section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.65rem 0.25rem;
}

.history-section-header-row .history-section-label {
  padding: 0;
}

.btn-create-folder-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-create-folder-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #38bdf8;
}

.folder-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 2px;
}

.folder-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
}

.folder-header:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.folder-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}

.folder-icon {
  color: #38bdf8;
  flex-shrink: 0;
}

.folder-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-count-pill {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  line-height: 1.2;
}

.folder-actions {
  display: none;
  align-items: center;
}

.folder-header:hover .folder-actions {
  display: flex;
}

.folder-action-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.folder-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.folder-chats-container {
  display: flex;
  flex-direction: column;
  padding-left: 0.75rem;
  margin-left: 0.85rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  gap: 1px;
}

.folder-empty-notice {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  padding: 0.35rem 0.5rem;
  font-style: italic;
}

/* ──────────────────────────────────────────────────────────────────────────
   MOVE CHAT TO FOLDER MODAL STYLES
   ────────────────────────────────────────────────────────────────────────── */
.move-folder-card {
  width: 90%;
  max-width: 420px;
  background: #202123;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalCardIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.move-folder-header {
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-folder-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  flex-shrink: 0;
}

.move-folder-body {
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  overflow-y: auto;
}

.move-folder-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}

.move-folder-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.move-folder-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.move-folder-option:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}

.move-folder-option.is-current {
  background: rgba(56, 189, 248, 0.16);
  border-color: #38bdf8;
}

.move-folder-option-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  overflow: hidden;
}

.move-folder-option-left svg {
  color: #38bdf8;
  flex-shrink: 0;
}

.btn-remove-from-folder {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 0.85rem;
  transition: background 0.15s ease;
}

.btn-remove-from-folder:hover {
  background: rgba(239, 68, 68, 0.15);
}

.move-folder-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 0.85rem;
}

.create-folder-inline-box {
  display: flex;
  gap: 0.5rem;
}

.inline-folder-input {
  flex: 1;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.inline-folder-input:focus {
  border-color: #38bdf8;
}

.btn-create-folder-inline {
  padding: 0.45rem 0.85rem;
  background: #38bdf8;
  color: #0b1120;
  font-weight: 600;
  font-size: 0.82rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.15s ease;
}

.btn-create-folder-inline:hover {
  background: #7dd3fc;
}

.empty-folders-picker {
  padding: 0.85rem 0.5rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

.chat-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.84rem;
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.chat-history-item:hover, .chat-history-item.active {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.chat-history-item.active {
  background: var(--bg-surface-active);
  font-weight: 500;
}

/* AI Agent Trained Chat Sidebar Golden Styling */
.chat-history-item.agent-chat-item {
  border-left: 3.5px solid #f59e0b !important;
  background: rgba(245, 158, 11, 0.08) !important;
  margin-bottom: 3px;
  border-top: 1px solid rgba(245, 158, 11, 0.22);
  border-bottom: 1px solid rgba(245, 158, 11, 0.22);
  border-right: 1px solid rgba(245, 158, 11, 0.22);
}

.chat-history-item.agent-chat-item:hover {
  background: rgba(245, 158, 11, 0.16) !important;
  color: #fef08a !important;
}

.chat-history-item.agent-chat-item.active {
  background: rgba(245, 158, 11, 0.24) !important;
  border-left: 4px solid #fbbf24 !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.22) !important;
}

.chat-history-item.agent-chat-item .chat-item-title {
  color: #fbbf24 !important;
  font-weight: 600 !important;
}

.chat-history-item.agent-chat-item:hover .chat-item-title,
.chat-history-item.agent-chat-item.active .chat-item-title {
  color: #fde047 !important;
}

.agent-chat-gold-badge {
  font-size: 0.62rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  padding: 0.12rem 0.4rem !important;
  border-radius: 4px !important;
  background: rgba(245, 158, 11, 0.22) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
  margin-left: auto !important;
  margin-right: 4px !important;
  flex-shrink: 0 !important;
  line-height: 1.1 !important;
  pointer-events: none !important;
}

.chat-history-item.agent-chat-item:hover .agent-chat-gold-badge,
.chat-history-item.agent-chat-item.active .agent-chat-gold-badge {
  background: rgba(245, 158, 11, 0.35) !important;
  border-color: rgba(251, 191, 36, 0.6) !important;
  color: #fef08a !important;
}

.chat-item-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  overflow: hidden;
  white-space: nowrap;
  flex: 1;
}

.chat-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item-actions {
  display: none;
  align-items: center;
  gap: 2px;
}

.chat-history-item:hover .chat-item-actions,
.chat-history-item.active .chat-item-actions,
.chat-history-item.menu-open .chat-item-actions {
  display: flex;
}

.chat-history-item.menu-open {
  background: var(--bg-surface-elevated);
}

.chat-item-menu-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  position: relative;
}

.chat-item-menu-btn svg,
.chat-item-menu-btn circle {
  pointer-events: none;
}

.chat-history-item.menu-open .chat-item-menu-btn,
.chat-item-menu-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
}

/* ──────────────────────────────────────────────────────────────────────────
   CHAT CONTEXT MENU POPOVER (Exact ChatGPT Style)
   ────────────────────────────────────────────────────────────────────────── */
.chat-context-menu-popover {
  position: fixed;
  z-index: 10050;
  width: 195px;
  background: #212121;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 2px 6px rgba(0, 0, 0, 0.4);
  padding: 6px;
  flex-direction: column;
  gap: 2px;
  backdrop-filter: blur(12px);
  animation: contextMenuIn 120ms cubic-bezier(0.16, 1, 0.3, 1);
  display: none;
}

.chat-context-menu-popover.show {
  display: flex !important;
}

@keyframes contextMenuIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.context-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.52rem 0.7rem;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #ececec;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.context-menu-item svg {
  color: #9ca3af;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.context-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.context-menu-item:hover svg {
  color: #ffffff;
}

.context-menu-item.item-danger {
  color: #ef4444;
}

.context-menu-item.item-danger svg {
  color: #ef4444;
}

.context-menu-item.item-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.context-menu-item.item-danger:hover svg {
  color: #f87171;
}

.context-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 6px;
}

.chat-inline-rename-input {
  flex: 1;
  background: #18181b;
  border: 1px solid #38bdf8;
  border-radius: 4px;
  color: #ffffff;
  font-size: 0.86rem;
  padding: 0.15rem 0.4rem;
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.delete-modal-card {
  width: 90%;
  max-width: 400px;
  background: #202123;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: modalPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.delete-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-delete-pill {
  padding: 0.55rem 1.2rem;
  border-radius: 9999px;
  background: #dc2626;
  border: none;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-delete-pill:hover {
  background: #b91c1c;
}

.btn-cancel-pill {
  padding: 0.55rem 1.2rem;
  border-radius: 9999px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ececec;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-cancel-pill:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Sidebar Footer (User Account & Developer Portal Link) */
.sidebar-footer {
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.user-profile-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
  text-align: left;
}

.user-profile-btn:hover {
  background: var(--bg-surface-hover);
}

.user-info-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #111;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-names-group {
  display: flex;
  flex-direction: column;
}

.user-display-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-plan-sub {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

/* ChatGPT-style Profile Popover Menu in Sidebar Footer */
.profile-popover-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0.75rem;
  right: 0.75rem;
  background: var(--bg-modal);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75);
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 250;
  animation: popoverFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-popover-menu.show {
  display: flex;
}

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

.popover-user-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
}

.popover-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.35rem 0;
}

.popover-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.popover-item:hover {
  background: var(--bg-surface-hover);
}

.popover-icon-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.popover-avatar-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

.popover-item-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.25;
}

.popover-item-desc {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  line-height: 1.25;
}

/* ──────────────────────────────────────────────────────────────────────────
   MAIN CHAT VIEWPORT
   ────────────────────────────────────────────────────────────────────────── */
.main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

/* Top Header */
.chat-top-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  flex-shrink: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Share Pill in Main Header (Exact ChatGPT Style) */
.btn-share-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.8rem;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-share-pill:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* Developer API Pill in Main Header (like OpenAI platform switcher) */
.btn-developer-api-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.8rem;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #34d399;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.btn-developer-api-pill:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.22);
}

.pulse-emerald-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 2s infinite ease-in-out;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes pulseDot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

/* Model Selector Dropdown in Top Header */
.model-selector-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.model-selector-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.model-selector-dropdown {
  position: absolute;
  top: 52px;
  left: 1rem;
  width: 300px;
  max-height: calc(85vh - 70px);
  overflow-y: auto;
  background: var(--bg-modal);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 200;
}

.model-selector-dropdown.show {
  display: flex;
}

.model-option {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background var(--transition-fast);
}

.model-option:hover, .model-option.active {
  background: var(--bg-surface-hover);
}

.model-option-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.model-option-desc {
  font-size: 0.74rem;
  color: var(--text-tertiary);
}

/* Chat Messages Scroll Viewport */
.chat-scroll-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  scroll-behavior: smooth;
}

/* Shared Conversation Notice Banner */
.shared-chat-banner {
  background: rgba(56, 189, 248, 0.08);
  border-bottom: 1px solid rgba(56, 189, 248, 0.22);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  animation: bannerSlideDown 0.2s ease-out;
}

@keyframes bannerSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.shared-banner-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
}

.shared-pill-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.18);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.shared-banner-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-banner-date {
  font-size: 0.74rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.btn-continue-shared-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  background: #38bdf8;
  color: #0b1120;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.btn-continue-shared-pill:hover {
  background: #7dd3fc;
  transform: translateY(-1px);
}

/* Empty State / Hero Screen */
.empty-state-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 1.5rem;
  text-align: center;
  margin-top: auto;
  margin-bottom: auto;
}

.hero-logo-box {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-logo-img {
  height: 64px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
  filter: drop-shadow(0 8px 28px rgba(0, 168, 255, 0.32));
  transition: transform var(--transition-medium);
}

.hero-logo-img:hover {
  transform: scale(1.04);
}

.hero-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

.suggestion-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  max-width: var(--pill-max-width);
  width: 100%;
  margin-bottom: 2rem;
}

.suggestion-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.suggestion-chip:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
  transform: translateY(-2px);
}

.suggestion-chip-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.suggestion-chip-sub {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* Conversation Stream Messages */
.conversation-thread {
  display: none;
  flex-direction: column;
  width: 100%;
  max-width: var(--pill-max-width);
  margin: 0 auto;
  padding: 0.5rem 1rem 3rem;
  gap: 1.4rem;
}

.conversation-thread.active {
  display: flex;
}

/* Centered WhatsApp-Style Sticky Date Separator */
.chat-date-separator {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0.25rem 0 0.5rem;
  position: sticky;
  top: 8px;
  z-index: 10;
  pointer-events: none;
}

.chat-date-badge {
  background: rgba(30, 30, 30, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #a1a1aa;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.95rem;
  border-radius: 9999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.04em;
  pointer-events: auto;
  user-select: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.chat-date-badge:hover {
  background: rgba(45, 45, 45, 0.96);
  color: #f4f4f5;
}

.message-row {
  display: flex;
  gap: 0.85rem;
  width: 100%;
}

.message-row.user-row {
  justify-content: flex-end;
}

.message-row.assistant-row {
  align-items: flex-start;
}

.assistant-avatar-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.user-bubble {
  background: #2f2f2f;
  color: var(--text-primary);
  padding: 0.65rem 1rem 0.42rem 1.1rem;
  border-radius: 18px 18px 4px 18px;
  max-width: 80%;
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
  display: flex;
  flex-direction: column;
}

.user-bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.user-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0.25rem;
  align-self: flex-end;
}

.user-bubble-meta .message-time {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.52);
  user-select: none;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* Assistant Message Time */
.assistant-message-time {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-left: 0.65rem;
  user-select: none;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

/* Assistant Model Identifier Badge (beside time) */
.assistant-model-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.48rem;
  border-radius: 6px;
  margin-left: 0.45rem;
  user-select: none;
  line-height: 1.2;
  cursor: default;
  transition: all var(--transition-fast);
}

.assistant-model-badge:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text-secondary);
}

.model-badge-dot {
  width: 5.5px;
  height: 5.5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.assistant-content-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #ececec;
  word-break: break-word;
}

/* Markdown Rendering in Assistant Message */
.assistant-content-wrapper p {
  margin-bottom: 1rem;
}
.assistant-content-wrapper p:last-child {
  margin-bottom: 0;
}
.assistant-content-wrapper h1, 
.assistant-content-wrapper h2, 
.assistant-content-wrapper h3 {
  color: #fff;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
}
.assistant-content-wrapper ul, 
.assistant-content-wrapper ol {
  margin: 0.5rem 0 1rem 1.4rem;
}
.assistant-content-wrapper li {
  margin-bottom: 0.35rem;
}
.assistant-content-wrapper strong {
  color: #fff;
  font-weight: 600;
}

/* Code Container with Copy Bar */
.code-block-container {
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin: 0.85rem 0;
  overflow: hidden;
}

.code-block-header {
  background: #1e1e1e;
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.btn-copy-code {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.btn-copy-code:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.code-block-pre {
  padding: 1rem;
  margin: 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #e4e4e7;
  line-height: 1.5;
}

/* Collapsible Reasoning Block (when "Think" mode was used) */
.thinking-accordion {
  background: rgba(139, 92, 246, 0.07);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
}

.thinking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: #c4b5fd;
  font-weight: 600;
}

.thinking-content {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(139, 92, 246, 0.15);
  line-height: 1.5;
}

/* Assistant Message Action Buttons */
.assistant-action-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.65rem;
}

.action-pill-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.action-pill-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* ──────────────────────────────────────────────────────────────────────────
   SOURCES & REFERENCES DRAWER (Perplexity / ChatGPT-style Reference Links)
   ────────────────────────────────────────────────────────────────────────── */
.sources-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-tertiary, #9ca3af);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  margin-left: 0.45rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.2;
  user-select: none;
}

.sources-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.sources-toggle-btn.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
}

.sources-toggle-btn .sources-chevron {
  transition: transform 0.2s ease;
  display: inline-block;
  line-height: 1;
}

.sources-toggle-btn.active .sources-chevron {
  transform: rotate(180deg);
}

.sources-drawer {
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  animation: fadeInSlideDown 0.22s ease-out;
}

@keyframes fadeInSlideDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sources-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary, #9ca3af);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.5rem;
}

.source-card {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: all 0.18s ease;
  overflow: hidden;
}

.source-card:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.28);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.source-card-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.source-favicon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  object-fit: contain;
}

.source-domain {
  font-size: 0.72rem;
  font-weight: 600;
  color: #38bdf8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.source-ext-icon {
  opacity: 0.5;
  flex-shrink: 0;
  transition: opacity 0.18s ease;
}

.source-card:hover .source-ext-icon {
  opacity: 1;
  color: #38bdf8;
}

.source-title {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-primary, #e5e7eb);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.source-snippet {
  font-size: 0.68rem;
  color: var(--text-tertiary, #9ca3af);
  line-height: 1.25;
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ──────────────────────────────────────────────────────────────────────────
   AI GENERATED IMAGE CARD (FLUX.1 / Cloudflare / DALL-E)
   ────────────────────────────────────────────────────────────────────────── */
.generated-image-card {
  margin: 0.85rem 0;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.generated-image-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
}

.generated-image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 480px;
  background: #0f1015;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.generated-image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
  display: block;
}

.generated-image-container:hover .generated-image-preview {
  transform: scale(1.02);
}

.generated-image-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.generated-image-container:hover .generated-image-overlay {
  opacity: 1;
}

.image-zoom-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 500;
  color: #fff;
  backdrop-filter: blur(8px);
}

.generated-image-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.generated-image-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #38bdf8;
  letter-spacing: 0.02em;
}

.image-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.image-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.6rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

.image-action-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

/* ──────────────────────────────────────────────────────────────────────────
   FLOATING PILL INPUT DOCK (Exact ChatGPT Geometry)
   ────────────────────────────────────────────────────────────────────────── */
.input-dock-container {
  width: 100%;
  max-width: var(--pill-max-width);
  margin: 0 auto;
  padding: 0 1rem 1rem;
  position: relative;
  flex-shrink: 0;
}

.floating-pill-box {
  background: var(--bg-pill);
  border: 1px solid var(--border-medium);
  border-radius: 28px;
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.floating-pill-box:focus-within {
  border-color: var(--border-focus);
}

.dock-input-row {
  display: flex;
  align-items: flex-end;
  width: 100%;
  gap: 0.5rem;
}

/* Left Tools / Attach Button */
.btn-dock-tool {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.btn-dock-tool:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Voice Dictation (Microphone) Active State */
#btn-mic {
  position: relative;
}

#btn-mic.is-dictating {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.16) !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}

#btn-mic.is-dictating:hover {
  background: rgba(239, 68, 68, 0.28) !important;
}

.mic-wave-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(239, 68, 68, 0.7);
  animation: mic-ripple 1.5s cubic-bezier(0.1, 0.5, 0.7, 1) infinite;
  pointer-events: none;
}

@keyframes mic-ripple {
  0% {
    width: 26px;
    height: 26px;
    opacity: 0.9;
    border-color: rgba(239, 68, 68, 0.9);
  }
  100% {
    width: 48px;
    height: 48px;
    opacity: 0;
    border-color: rgba(239, 68, 68, 0);
  }
}

/* Expanding Prompt Textarea */
.prompt-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.98rem;
  line-height: 1.5;
  resize: none;
  max-height: 200px;
  min-height: 24px;
  padding: 0.35rem 0.25rem;
}

.prompt-textarea::placeholder {
  color: #8e8e93;
}

/* Right Tool Actions inside Pill */
.dock-actions-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* "Think" Pill Toggle Button */
.btn-think-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-think-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-think-toggle.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
}



/* Disclaimer Footer */
.dock-disclaimer {
  text-align: center;
  font-size: 0.74rem;
  color: var(--text-tertiary);
  margin-top: 0.45rem;
}

.dock-disclaimer a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

.dock-disclaimer a:hover {
  color: var(--text-primary);
}

/* ──────────────────────────────────────────────────────────────────────────
   MODALS (Quick Search & Attachments)
   ────────────────────────────────────────────────────────────────────────── */
.modal-backdrop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10060;
}

.modal-backdrop-overlay.show {
  display: flex;
}

/* ──────────────────────────────────────────────────────────────────────────
   RENAME CHAT MODAL
   ────────────────────────────────────────────────────────────────────────── */
.rename-modal-card {
  width: 90%;
  max-width: 440px;
  background: #202123;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalCardIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.rename-modal-header {
  padding: 1.1rem 1.25rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rename-modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.rename-modal-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.92rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rename-modal-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.btn-save-pill {
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-pill);
  background: #38bdf8;
  border: none;
  color: #0b1120;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-save-pill:hover {
  background: #7dd3fc;
  transform: translateY(-1px);
}

.btn-cancel-pill {
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-cancel-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* ──────────────────────────────────────────────────────────────────────────
   ARCHIVED CHATS MODAL
   ────────────────────────────────────────────────────────────────────────── */
.archived-modal-card {
  width: 92%;
  max-width: 580px;
  background: #202123;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 82vh;
  animation: modalCardIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.archived-modal-header {
  padding: 1.15rem 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-archived-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  flex-shrink: 0;
}

.archived-modal-body {
  padding: 1rem 1.25rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.archived-chats-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.archived-chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.95rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  transition: all 0.15s ease;
}

.archived-chat-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.archived-chat-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: hidden;
  flex: 1;
  padding-right: 0.75rem;
}

.archived-chat-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.archived-chat-title:hover {
  color: #38bdf8;
}

.archived-chat-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.archived-chat-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-unarchive-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-unarchive-pill:hover {
  background: #38bdf8;
  color: #0b1120;
}

.btn-delete-archived-pill {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-delete-archived-pill:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.archived-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-tertiary);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

/* Pinned Chat row indicator */
.chat-item-pin-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  margin-left: 5px;
  opacity: 0.9;
  flex-shrink: 0;
}

.chat-history-item.pinned {
  border-left: 2px solid rgba(56, 189, 248, 0.5);
}

.search-modal-card {
  width: 100%;
  max-width: 640px;
  background: var(--bg-modal);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  margin: 1rem;
  display: flex;
  flex-direction: column;
}

.search-input-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.search-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text-primary);
  font-family: inherit;
}

.search-field::placeholder {
  color: var(--text-tertiary);
}

.search-results-list {
  max-height: 440px;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.75rem 0.95rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  user-select: none;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.search-result-item:hover,
.search-result-item.selected {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.06);
}

.search-result-icon {
  margin-top: 3px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-result-item:hover .search-result-icon,
.search-result-item.selected .search-result-icon {
  color: var(--text-primary);
}

.search-result-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.search-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.search-result-title {
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-date {
  font-size: 0.74rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-result-snippet {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.search-result-snippet strong,
.search-result-snippet b,
.search-result-title strong,
.search-result-title b {
  font-weight: 600;
  color: var(--text-primary);
}

.search-code-inline {
  font-family: var(--font-mono, monospace);
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 4px;
}

.search-highlight {
  background: rgba(56, 189, 248, 0.22);
  color: #7dd3fc;
  font-weight: 600;
  padding: 1px 3px;
  border-radius: 3px;
}

.search-section-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: #38bdf8;
  padding: 0.65rem 0.5rem 0.35rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.search-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(56, 189, 248, 0.2);
}

.search-target-highlight {
  animation: searchFlash 2.2s ease-out;
}

@keyframes searchFlash {
  0% { background: rgba(56, 189, 248, 0.32); }
  100% { background: transparent; }
}

/* ──────────────────────────────────────────────────────────────────────────
   PLUGINS STORE MODAL
   ────────────────────────────────────────────────────────────────────────── */
.plugins-modal-card {
  width: 100%;
  max-width: 640px;
  background: var(--bg-modal);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  margin: 1rem;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

.plugins-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.plugin-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.plugins-search-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.plugin-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.plugins-grid {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}

.plugin-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
  transition: all var(--transition-fast);
}

.plugin-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-surface-hover);
}

.plugin-card.active {
  border-color: rgba(56, 189, 248, 0.4);
}

.plugin-top {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.plugin-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
}

.plugin-info {
  flex: 1;
  min-width: 0;
}

.plugin-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.plugin-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.plugin-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.plugin-status-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.plugin-status-tag.enabled {
  color: #38bdf8;
}

/* iOS / macOS style Toggle Switch */
.switch-control {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #3f3f46;
  border-radius: 20px;
  transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.switch-control input:checked + .switch-slider {
  background-color: #0284c7;
}

.switch-control input:checked + .switch-slider:before {
  transform: translateX(16px);
}

.plugins-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.btn-done-pill {
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-pill);
  background: var(--text-primary);
  color: #111;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.btn-done-pill:hover {
  transform: scale(1.03);
}

/* ──────────────────────────────────────────────────────────────────────────
   SHARE CHAT MODAL (ChatGPT Style)
   ────────────────────────────────────────────────────────────────────────── */
.share-modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-modal);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  margin: 1rem;
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.share-modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.share-title-preview {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  padding: 0.75rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.share-disclaimer {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.share-link-result-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #18181b;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
}

.share-url-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.84rem;
  color: #38bdf8;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy-share-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  background: var(--text-primary);
  color: #111;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.btn-copy-share-link.copied {
  background: #10b981;
  color: #ffffff;
}

.btn-create-share-pill {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--text-primary);
  color: #111;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.btn-create-share-pill:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

/* ──────────────────────────────────────────────────────────────────────────
   MOBILE RESPONSIVENESS (< 768px)
   ────────────────────────────────────────────────────────────────────────── */
.mobile-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 90;
}

/* ──────────────────────────────────────────────────────────────────────────
   MOBILE SCREEN RESPONSIVENESS & ADAPTATION (Full Viewport Coverage)
   ────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .btn-sidebar-toggle-main {
    display: flex !important;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(85vw, 320px) !important;
    min-width: min(85vw, 320px) !important;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease), visibility 0.25s;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.85);
    z-index: 1000;
    visibility: hidden;
    opacity: 1;
    pointer-events: none;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .sidebar-inner {
    width: 100% !important;
    min-width: 100% !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .sidebar.collapsed {
    width: min(85vw, 320px) !important;
    min-width: min(85vw, 320px) !important;
    transform: translateX(-100%) !important;
  }

  .mobile-sidebar-backdrop {
    z-index: 999;
  }

  .mobile-sidebar-backdrop.show {
    display: block;
  }

  /* Top Navigation Header Responsiveness */
  .chat-top-header {
    height: 48px;
    padding: 0 0.65rem;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .chat-top-header-right {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .model-selector-btn {
    max-width: 140px;
    padding: 0.35rem 0.55rem;
  }

  #active-model-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 105px;
    display: inline-block;
  }

  .btn-developer-api-pill {
    padding: 0.32rem 0.65rem;
    font-size: 0.78rem;
  }

  .btn-share-pill {
    padding: 0.32rem 0.65rem;
    font-size: 0.78rem;
  }

  /* Hero & Suggestion Chips */
  .hero-logo-img {
    height: 52px;
  }

  .hero-title {
    font-size: 1.6rem;
    margin-bottom: 1.4rem;
    padding: 0 0.5rem;
  }

  .suggestion-chips-grid {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    width: 100%;
    padding: 0 0.5rem;
    box-sizing: border-box;
  }

  .suggestion-chip {
    padding: 0.75rem 0.9rem;
  }

  /* Message Thread & Bubbles */
  .conversation-thread {
    padding: 0.5rem 0.65rem 3.5rem;
    gap: 1.15rem;
  }

  .message-row {
    gap: 0.55rem;
  }

  .assistant-avatar-icon {
    width: 24px;
    height: 24px;
    margin-top: 3px;
  }

  .user-bubble {
    max-width: 88%;
    padding: 0.6rem 0.85rem 0.35rem 0.95rem;
    font-size: 0.92rem;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .assistant-content-wrapper {
    font-size: 0.92rem;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .code-block-container {
    max-width: 100%;
    overflow: hidden;
  }

  .code-block-pre {
    padding: 0.75rem;
    font-size: 0.8rem;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  /* Markdown Tables on Mobile (Prevent Viewport Bleed) */
  .assistant-content-wrapper table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin: 0.75rem 0;
    border-spacing: 0;
  }

  .assistant-content-wrapper th,
  .assistant-content-wrapper td {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border-subtle);
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .assistant-content-wrapper th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-primary);
  }

  /* Modals on Mobile Viewports */
  .modal-backdrop-overlay {
    padding: 10px;
    box-sizing: border-box;
  }

  .delete-modal-card,
  .rename-modal-card,
  .archived-modal-card,
  .search-modal-card,
  .plugins-modal-card,
  .share-modal-card,
  .auth-modal-card,
  .move-folder-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
  }

  .archived-modal-card {
    max-height: 88vh;
  }

  .input-dock-container {
    padding: 0 0.65rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  }
}

/* Specific Breakpoint for Phones (<= 540px) */
@media (max-width: 540px) {
  .btn-developer-api-pill {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    gap: 0.3rem;
  }

  .btn-developer-api-pill span:not(.pulse-emerald-dot) {
    display: none;
  }

  .btn-developer-api-pill svg {
    display: none;
  }

  .btn-developer-api-pill::after {
    content: "API";
    font-size: 0.74rem;
    font-weight: 700;
  }

  .btn-share-pill {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .btn-share-pill span {
    display: none;
  }

  .nav-guest-actions {
    gap: 0.25rem !important;
  }

  .nav-auth-btn-signup {
    display: none !important;
  }

  .nav-auth-btn-login {
    padding: 0.32rem 0.55rem !important;
    font-size: 0.76rem !important;
  }

  .model-selector-btn {
    max-width: 125px;
    font-size: 0.82rem;
  }

  #active-model-label {
    max-width: 95px;
  }
}

/* Ultra-Compact Phone Viewport (<= 380px) */
@media (max-width: 380px) {
  .btn-developer-api-pill {
    display: none !important;
  }

  .model-selector-btn {
    max-width: 110px;
    font-size: 0.78rem;
    padding: 0.3rem 0.45rem;
  }

  #active-model-label {
    max-width: 78px;
  }

  .hero-title {
    font-size: 1.35rem;
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   CHATGPT FLOATING TOAST NOTIFICATION
   ────────────────────────────────────────────────────────────────────────── */
.chatgpt-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #202123;
  color: #ececec;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.6rem 1.15rem;
  border-radius: 9999px;
  font-size: 0.84rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10000;
}

.chatgpt-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ──────────────────────────────────────────────────────────────────────────
   GUEST USER & AUTHENTICATION STYLES (ChatGPT Aesthetics)
   ────────────────────────────────────────────────────────────────────────── */

/* Sidebar Guest Prompt Card */
.sidebar-guest-card {
  padding: 0.75rem 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  margin-bottom: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.guest-card-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
}

.guest-card-desc {
  font-size: 0.73rem;
  color: var(--text-tertiary);
  line-height: 1.35;
}

.guest-card-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.btn-guest-login {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ececec;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-guest-login:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-guest-signup {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid #ffffff;
  color: #111111;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-guest-signup:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
}

/* Navbar Guest Auth Buttons */
.nav-auth-btn-login {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ececec;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-auth-btn-login:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

.nav-auth-btn-signup {
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid #ffffff;
  color: #111111;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.nav-auth-btn-signup:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
}

/* User Avatar variations */
.user-avatar-circle.guest-avatar {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-tertiary) !important;
}

/* Auth Modal Card */
.auth-modal-card {
  width: 90%;
  max-width: 400px;
  background: #202123;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalCardIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-modal-header {
  padding: 1.1rem 1.25rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-tabs-bar {
  display: flex;
  padding: 0.4rem 1.25rem 0;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-tab-btn {
  padding: 0.55rem 0.85rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-tertiary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.auth-tab-btn:hover {
  color: var(--text-primary);
}

.auth-tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

.auth-form {
  padding: 1.15rem 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-field-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.auth-field-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.auth-field-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.btn-auth-submit-primary {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  background: #38bdf8;
  border: none;
  color: #0b1120;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  margin-top: 0.35rem;
  transition: background 0.15s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.btn-auth-submit-primary:hover {
  background: #7dd3fc;
  transform: translateY(-1px);
}

.btn-auth-submit-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.auth-switch-prompt {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
}

.auth-switch-prompt a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 500;
}

.auth-switch-prompt a:hover {
  text-decoration: underline;
}

.auth-error-box {
  margin: 0.75rem 1.25rem 0;
  padding: 0.55rem 0.75rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #f87171;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* ──────────────────────────────────────────────────────────────────────────
   ATTACH / TOOLS POPOVER MENU (ChatGPT Signature Exact Popup from Screenshot)
   ────────────────────────────────────────────────────────────────────────── */
.attach-popover-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 16px;
  width: 440px;
  max-width: calc(100vw - 32px);
  background: #212121;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 2px 8px rgba(0, 0, 0, 0.4);
  z-index: 250;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-sizing: border-box;
}

.attach-popover-menu.show {
  display: flex;
  animation: attachMenuPop 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes attachMenuPop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.attach-menu-item {
  width: 100%;
  height: 44px;
  min-height: 44px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 12px;
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  text-align: left;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
  transition: background 0.12s ease;
}

.attach-menu-item:hover,
.attach-menu-item:focus-visible {
  background: #2f2f2f;
}

.attach-item-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ececec;
  flex-shrink: 0;
}

.attach-item-content {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}

.attach-item-title {
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}

.attach-item-desc {
  font-size: 14px;
  font-weight: 400;
  color: #8e8e8e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ──────────────────────────────────────────────────────────────────────────
   DOCK ATTACHMENTS STRIP (Chips shown inside Pill Box when files are staged)
   ────────────────────────────────────────────────────────────────────────── */
.dock-attachments-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.2rem 0.35rem 0.55rem;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.35rem;
  max-height: 140px;
  overflow-y: auto;
}

.attached-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0.35rem 0.55rem;
  max-width: 240px;
  position: relative;
  transition: all 0.15s ease;
  user-select: none;
}

.attached-file-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.chip-preview-img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  background: #09090b;
  flex-shrink: 0;
}

.chip-file-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

.chip-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.chip-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: #f3f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-size {
  font-size: 0.68rem;
  color: #9ca3af;
}

.chip-btn-remove {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  margin-left: 0.25rem;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.chip-btn-remove:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Mode pill badge inside dock (e.g. Web search / Image mode) */
.dock-mode-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.35);
  color: #38bdf8;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-right: 0.25rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.dock-mode-tag button {
  background: transparent;
  border: none;
  color: #38bdf8;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  margin-left: 0.2rem;
}

/* ──────────────────────────────────────────────────────────────────────────
   USER MESSAGE ATTACHMENTS (Rendered inside the chat thread)
   ────────────────────────────────────────────────────────────────────────── */
.user-attachments-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.user-attachment-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 0.45rem 0.75rem;
  max-width: 280px;
}

.user-attachment-img-preview {
  max-width: 240px;
  max-height: 220px;
  border-radius: 12px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.user-attachment-img-preview:hover {
  transform: scale(1.02);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Drag & Drop Overlays */
.main-viewport.drag-active {
  outline: 2px dashed #38bdf8;
  outline-offset: -8px;
}

.main-viewport.drag-active::after {
  content: 'Drop files to attach to chat';
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(8px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: #38bdf8;
  pointer-events: none;
}

/* Library Modal & Lightbox Styles */
.library-modal-card {
  width: 540px;
  max-width: 95vw;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  animation: modalScaleUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.library-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.65rem;
  max-height: 320px;
  overflow-y: auto;
  margin: 1rem 0;
}

.library-file-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.library-file-card:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  object-fit: contain;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Super Speed Real-Time Streaming Indicator
   ───────────────────────────────────────────────────────────────────────────── */
.streaming-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  background: var(--text-primary, #f3f4f6);
  vertical-align: -2px;
  margin-left: 3px;
  border-radius: 1px;
  animation: streamBlink 0.75s ease-in-out infinite;
}

@keyframes streamBlink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Universal PWA "Install App" Sidebar Button & Modals
   ───────────────────────────────────────────────────────────────────────────── */
.install-app-btn {
  transition: all var(--transition-fast, 0.15s ease) !important;
}

.install-app-btn:hover {
  background: rgba(167, 139, 250, 0.08) !important;
  border-color: rgba(167, 139, 250, 0.3) !important;
}

.install-device-pill {
  transition: all 0.2s ease !important;
}

.install-device-pill.installed {
  color: #10b981 !important;
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

/* Install Guide Modal Card */
.install-guide-card {
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  width: 440px;
  max-width: calc(100vw - 32px);
  padding: 1.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: modalCardPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.install-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.install-guide-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.install-guide-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.install-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 0.85rem;
  box-sizing: border-box;
}

.install-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(167, 139, 250, 0.2);
  color: #c4b5fd;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.install-step-content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.install-step-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary, #f3f4f6);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.install-step-desc {
  font-size: 0.78rem;
  color: var(--text-tertiary, #9ca3af);
  line-height: 1.35;
}

.install-step-key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.install-guide-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-install-got-it {
  padding: 0.6rem 1.4rem;
  border-radius: 10px;
  background: #a78bfa;
  border: none;
  color: #0f172a;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-install-got-it:hover {
  background: #c4b5fd;
  transform: translateY(-1px);
}

/* ──────────────────────────────────────────────────────────────────────────
   AI TRAINING STUDIO & ACTIVE AGENT SYSTEM
   ────────────────────────────────────────────────────────────────────────── */

/* Active Agent Pill in Chat Top Header */
.active-agent-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  padding: 0.32rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  animation: fadeInPill 0.25s ease-out;
}

@keyframes fadeInPill {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.active-agent-pill:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.55);
}

.active-agent-pill-avatar {
  font-size: 1rem;
  line-height: 1;
}

.active-agent-pill-name {
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.active-agent-pill-close {
  background: transparent;
  border: none;
  color: rgba(251, 191, 36, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s ease;
}

.active-agent-pill-close:hover {
  color: #ffffff;
  background: rgba(239, 68, 68, 0.4);
}

/* Training Studio Modal Window */
.training-studio-card {
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: studioModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes studioModalPop {
  0% { transform: scale(0.94); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.training-studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(24, 24, 27, 0.85);
  backdrop-filter: blur(10px);
}

.training-studio-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.training-studio-title {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text-primary, #f3f4f6);
  letter-spacing: -0.01em;
}

.training-studio-subtitle {
  font-size: 0.78rem;
  color: var(--text-tertiary, #9ca3af);
  margin-top: 2px;
}

.training-studio-body {
  padding: 1.25rem 1.4rem;
  overflow-y: auto;
  max-height: calc(88vh - 75px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Custom Scrollbar for Studio */
.training-studio-body::-webkit-scrollbar {
  width: 6px;
}
.training-studio-body::-webkit-scrollbar-track {
  background: transparent;
}
.training-studio-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 3px;
}

/* Studio Section Group */
.studio-section-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.studio-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary, #f3f4f6);
}

.studio-badge-pill {
  font-size: 0.72rem;
  font-weight: 600;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 0.12rem 0.5rem;
  border-radius: 9999px;
}

/* Starter Templates Grid */
.studio-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.85rem;
}

.studio-template-chip {
  background: #202023;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.studio-template-chip:hover {
  background: #26262b;
  border-color: rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.template-chip-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.template-chip-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.template-chip-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary, #f3f4f6);
}

.template-chip-desc {
  font-size: 0.72rem;
  color: var(--text-tertiary, #9ca3af);
  line-height: 1.35;
}

.template-use-btn {
  font-size: 0.74rem;
  font-weight: 600;
  color: #f59e0b;
  text-align: right;
  opacity: 0.85;
}

.studio-template-chip:hover .template-use-btn {
  opacity: 1;
  text-decoration: underline;
}

/* Trained Agents List Header */
.studio-agents-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.btn-studio-primary-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f59e0b;
  color: #18181b;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-studio-primary-sm:hover {
  background: #fbbf24;
  transform: translateY(-1px);
}

/* Agents Grid */
.studio-agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.studio-agent-card {
  background: #202023;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.studio-agent-card:hover {
  border-color: rgba(245, 158, 11, 0.4);
  background: #26262a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(-2px);
}

.agent-card-active-ring {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 1px #f59e0b, 0 8px 24px rgba(245, 158, 11, 0.15) !important;
}

.studio-agent-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.agent-avatar-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.agent-meta-info {
  flex: 1;
  min-width: 0;
}

.agent-name-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary, #f3f4f6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-role-subtitle {
  font-size: 0.74rem;
  color: var(--text-tertiary, #9ca3af);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.agent-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.72rem;
}

.agent-pill-info {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  color: #d1d5db;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.agent-card-starters-preview {
  font-size: 0.72rem;
  color: var(--text-tertiary, #9ca3af);
  line-height: 1.4;
  border-left: 2px solid rgba(245, 158, 11, 0.4);
  padding-left: 0.5rem;
  margin: 0.1rem 0;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.agent-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-agent-chat-now {
  background: #f59e0b;
  color: #18181b;
  border: none;
  border-radius: 8px;
  padding: 0.38rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-agent-chat-now:hover {
  background: #fbbf24;
  transform: translateY(-1px);
}

.btn-agent-edit-pill {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
  border-radius: 8px;
  padding: 0.36rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-agent-edit-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Empty State */
.studio-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.studio-empty-icon {
  font-size: 3rem;
  line-height: 1;
}

.studio-empty-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary, #f3f4f6);
}

.studio-empty-desc {
  font-size: 0.82rem;
  color: var(--text-tertiary, #9ca3af);
  max-width: 420px;
  line-height: 1.45;
}

.btn-studio-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #f59e0b;
  color: #18181b;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all 0.18s ease;
}

.btn-studio-primary:hover {
  background: #fbbf24;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

/* ──────────────────────────────────────────────────────────────────────────
   STUDIO AGENT EDITOR FORM
   ────────────────────────────────────────────────────────────────────────── */
.studio-editor-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.studio-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  color: var(--text-tertiary, #9ca3af);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.studio-back-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.studio-editor-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #f3f4f6);
}

.btn-studio-save-top {
  background: #f59e0b;
  color: #18181b;
  border: none;
  border-radius: 8px;
  padding: 0.38rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-studio-save-top:hover {
  background: #fbbf24;
}

.studio-form-scroll {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.studio-form-card {
  background: #202023;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.studio-form-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary, #f3f4f6);
}

.studio-field-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary, #9ca3af);
  line-height: 1.4;
  margin: 0;
}

.required-star {
  color: #ef4444;
}

.studio-identity-row {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.avatar-preview-box {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: rgba(245, 158, 11, 0.14);
  border: 2px solid rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  user-select: none;
  transition: transform 0.18s ease;
}

.avatar-preview-box:hover {
  transform: scale(1.05);
}

.studio-identity-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.studio-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 0.35rem;
}

.studio-input {
  width: 100%;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  color: #ffffff;
  font-size: 0.85rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.studio-input:focus {
  border-color: #f59e0b;
}

.studio-select {
  width: 100%;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  color: #ffffff;
  font-size: 0.84rem;
  outline: none;
  box-sizing: border-box;
  cursor: pointer;
}

.studio-select:focus {
  border-color: #f59e0b;
}

.studio-emoji-tray-label {
  font-size: 0.75rem;
  color: var(--text-tertiary, #9ca3af);
  margin-top: 0.2rem;
}

.studio-emoji-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.emoji-chip {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.emoji-chip:hover {
  background: #2a2a2e;
  border-color: #f59e0b;
  transform: scale(1.1);
}

.studio-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .studio-grid-2col {
    grid-template-columns: 1fr;
  }
}

.studio-range {
  width: 100%;
  accent-color: #f59e0b;
  cursor: pointer;
  margin: 0.4rem 0;
}

.temp-range-markers {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-tertiary, #9ca3af);
}

.instruction-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.25rem 0;
}

.instruction-chip {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  border-radius: 9999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.instruction-chip:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
  transform: translateY(-1px);
}

.studio-textarea {
  width: 100%;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.84rem;
  line-height: 1.45;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.studio-textarea:focus {
  border-color: #f59e0b;
}

/* Upload Dropzone */
.studio-upload-dropzone {
  border: 2px dashed rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.03);
  border-radius: 12px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.18s ease;
}

.studio-upload-dropzone:hover {
  background: rgba(245, 158, 11, 0.08);
  border-color: #f59e0b;
}

.upload-dropzone-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-dropzone-text {
  font-size: 0.85rem;
  color: var(--text-primary, #f3f4f6);
}

.upload-dropzone-sub {
  font-size: 0.72rem;
  color: var(--text-tertiary, #9ca3af);
}

.btn-paste-knowledge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d1d5db;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.74rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-paste-knowledge:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.knowledge-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.knowledge-file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.09);
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
}

.knowledge-file-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.knowledge-file-icon {
  color: #f59e0b;
  font-size: 1.1rem;
}

.knowledge-file-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: #f3f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.knowledge-file-size {
  font-size: 0.7rem;
  color: var(--text-tertiary, #9ca3af);
  margin-left: 0.35rem;
}

.knowledge-file-del {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.knowledge-file-del:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.2);
}

/* Master Drafting Template Card */
.studio-template-active-box {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(24, 24, 27, 0.95) 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  animation: templateFadeIn 0.2s ease-out;
}

@keyframes templateFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.template-active-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.template-active-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.template-doc-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.template-doc-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.template-doc-meta {
  font-size: 0.72rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 2px;
}

.template-active-tag {
  color: #10b981;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.template-active-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.template-active-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-template-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e5e7eb;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-template-action:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-template-action.delete:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.template-detected-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.template-detected-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #fbbf24;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.template-placeholders-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.template-placeholder-chip {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fef3c7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.71rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  user-select: all;
}

.template-section-chip {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #e0f2fe;
  font-size: 0.71rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Starters Grid */
.studio-starters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 600px) {
  .studio-starters-grid {
    grid-template-columns: 1fr;
  }
}

.starter-input {
  font-size: 0.8rem;
  padding: 0.5rem 0.7rem;
}

/* Editor Action Bar */
.studio-editor-actions {
  display: flex;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-studio-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-studio-delete:hover {
  background: rgba(239, 68, 68, 0.22);
}

.btn-studio-cancel {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary, #d1d5db);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-studio-cancel:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.btn-studio-submit {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #f59e0b;
  border: none;
  color: #18181b;
  padding: 0.52rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-studio-submit:hover {
  background: #fbbf24;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* ──────────────────────────────────────────────────────────────────────────
   MICROSOFT WORD (.DOCX) DRAFTING ARTIFACT CARD & A4 PREVIEW
   ────────────────────────────────────────────────────────────────────────── */

/* In-Stream Word Document Card */
.docx-artifact-card {
  margin: 0.85rem 0;
  background: linear-gradient(135deg, rgba(43, 87, 154, 0.08) 0%, rgba(24, 24, 27, 0.95) 100%);
  border: 1px solid rgba(43, 87, 154, 0.35);
  border-left: 4px solid #2b579a;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: docxCardFadeIn 0.3s ease-out;
}

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

.docx-artifact-card:hover {
  border-color: rgba(43, 87, 154, 0.6);
  box-shadow: 0 12px 32px rgba(43, 87, 154, 0.18);
}

.docx-card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.docx-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #2b579a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(43, 87, 154, 0.4);
}

.docx-title-group {
  flex: 1;
  min-width: 0;
}

.docx-filename {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-primary, #f3f4f6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.docx-doc-type {
  font-size: 0.74rem;
  color: #93c5fd;
  margin-top: 2px;
}

/* Feature Badges */
.docx-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.docx-badge-pill {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #d1d5db;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.docx-badge-pill.highlight {
  background: rgba(43, 87, 154, 0.15);
  border-color: rgba(43, 87, 154, 0.35);
  color: #93c5fd;
  font-weight: 600;
}

/* Action Buttons */
.docx-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-docx-download {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #2b579a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.48rem 1.15rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 14px rgba(43, 87, 154, 0.35);
}

.btn-docx-download:hover {
  background: #3b6fc0;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(43, 87, 154, 0.5);
}

.btn-docx-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.45rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-docx-preview:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

/* ──────────────────────────────────────────────────────────────────────────
   A4 PAGINATED WORD PREVIEW MODAL
   ────────────────────────────────────────────────────────────────────────── */
.word-preview-card {
  width: 95%;
  max-width: 960px;
  height: 92vh;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wordPreviewModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wordPreviewModalPop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.word-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(24, 24, 27, 0.95);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.word-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(43, 87, 154, 0.15);
  border: 1px solid rgba(43, 87, 154, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-word-download-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #2b579a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-word-download-pill:hover {
  background: #3b6fc0;
  transform: translateY(-1px);
}

.word-preview-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1.5rem;
  background: #0f1013;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.word-preview-page-container {
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Realistic A4 Document Sheet */
.word-a4-sheet {
  width: 100%;
  background: #ffffff;
  color: #111827;
  padding: 3.5rem 3.5rem;
  border-radius: 4px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65), 0 2px 6px rgba(0, 0, 0, 0.3);
  font-family: 'Calibri', 'Segoe UI', Arial, sans-serif;
  position: relative;
  box-sizing: border-box;
  min-height: 1050px;
  display: flex;
  flex-direction: column;
}

/* Realistic Page Border on the A4 Sheet */
.word-page-border-frame {
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 24px;
  right: 24px;
  pointer-events: none;
  box-sizing: border-box;
}

/* Running Header & Running Footer */
.word-running-header {
  font-size: 0.76rem;
  color: #6b7280;
  text-align: right;
  margin-bottom: 2rem;
  font-style: italic;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.4rem;
}

.word-running-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.78rem;
  color: #6b7280;
  text-align: center;
}

/* Headings in A4 Preview */
.word-a4-sheet h1 {
  font-size: 1.55rem;
  color: #1b365d;
  font-weight: 700;
  margin: 1.2rem 0 0.8rem;
  line-height: 1.25;
}

.word-a4-sheet h2 {
  font-size: 1.2rem;
  color: #1b365d;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.25rem;
}

.word-a4-sheet p {
  font-size: 0.95rem;
  color: #374151;
  margin: 0.6rem 0;
  line-height: 1.7; /* 1.5 line spacing visual equivalent */
}

.word-a4-sheet p.justified {
  text-align: justify;
  text-justify: inter-word;
}

/* Callout Box */
.word-preview-callout {
  background: #f4f6f9;
  border-left: 4px solid #2b579a;
  padding: 0.85rem 1.15rem;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #1f2937;
  font-style: italic;
  margin: 1rem 0;
}

/* Preview Table */
.word-preview-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.88rem;
}

.word-preview-table th {
  background: #2b579a;
  color: #ffffff;
  padding: 0.6rem 0.8rem;
  text-align: left;
  font-weight: 600;
  border: 1px solid #1b365d;
}

.word-preview-table td {
  padding: 0.55rem 0.8rem;
  border: 1px solid #d1d5db;
  color: #374151;
}

.word-preview-table tr:nth-child(even) td {
  background: #f9fafb;
}

/* Signatures Block */
.word-preview-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 2.5rem;
  gap: 2rem;
}

.word-signatory-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.word-sig-line {
  border-bottom: 1.5px solid #9ca3af;
  height: 40px;
  margin-bottom: 0.4rem;
}

/* Footnotes Section at Bottom of Page */
.word-preview-footnotes {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #9ca3af;
  font-size: 0.78rem;
  color: #4b5563;
  line-height: 1.45;
}

.word-footnote-ref {
  font-size: 0.72rem;
  vertical-align: super;
  color: #2b579a;
  font-weight: 600;
  margin: 0 1px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   IN-PLACE OPENXML MS WORD (.DOCX) PATCH ARTIFACT CARD
   ───────────────────────────────────────────────────────────────────────────── */

.docx-patch-card {
  background: var(--bg-surface-elevated, #242426);
  border: 1px solid rgba(43, 87, 154, 0.4);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.docx-patch-card:hover {
  border-color: rgba(43, 87, 154, 0.65);
  box-shadow: 0 6px 24px rgba(43, 87, 154, 0.15);
}

.docx-patch-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.docx-patch-icon-box {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #1b365d 0%, #2b579a 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(43, 87, 154, 0.35);
}

.docx-shield-pill {
  font-size: 0.7rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.docx-patch-summary-box {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid #2b579a;
  padding: 0.65rem 0.9rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.84rem;
  color: var(--text-secondary, #d1d5db);
  margin-bottom: 0.9rem;
  line-height: 1.45;
}

.docx-patch-diff-table {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.95rem;
}

.docx-diff-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0.5rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary, #9ca3af);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.docx-diff-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0.55rem 0.85rem;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  align-items: center;
}

.docx-diff-row:last-child {
  border-bottom: none;
}

.diff-find-val {
  color: #f87171;
  text-decoration: line-through;
  font-family: monospace;
  font-size: 0.8rem;
  word-break: break-word;
}

.diff-replace-val {
  color: #34d399;
  font-weight: 600;
  font-family: monospace;
  font-size: 0.8rem;
  word-break: break-word;
}

.btn-docx-patch-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}

.btn-docx-patch-download:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MILLISA HIGH-PERFORMANCE MARKDOWN & SCIENTIFIC LAYOUT SYSTEM
   ───────────────────────────────────────────────────────────────────────────── */

.markdown-body {
  color: #ececec;
  font-size: 1rem;
  line-height: 1.72;
  word-break: break-word;
}

.markdown-body p {
  margin: 0 0 1rem 0;
  line-height: 1.72;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: #ffffff;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 1.4rem;
  margin-bottom: 0.6rem;
}

.markdown-body h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 0.4rem; }
.markdown-body h2 { font-size: 1.3rem; letter-spacing: -0.015em; }
.markdown-body h3 { font-size: 1.12rem; color: #f1f5f9; }
.markdown-body h4 { font-size: 1rem; color: #e2e8f0; }

.markdown-body strong {
  font-weight: 600;
  color: #ffffff;
}

.markdown-body em {
  font-style: italic;
  color: #e2e8f0;
}

.markdown-body del {
  color: #94a3b8;
  text-decoration: line-through;
}

.markdown-body sup {
  font-size: 0.78em;
  vertical-align: super;
  line-height: 0;
  color: #38bdf8;
  font-weight: 600;
}

.markdown-body sub {
  font-size: 0.78em;
  vertical-align: sub;
  line-height: 0;
  color: #38bdf8;
}

/* Inline Code */
.inline-code {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  background: #242424;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.18rem 0.45rem;
  border-radius: 5px;
  font-size: 0.88em;
  color: #f1f5f9;
  white-space: pre-wrap;
}

/* Markdown Links */
.markdown-link {
  color: #38bdf8;
  text-decoration: none;
  border-bottom: 1px solid rgba(56, 189, 248, 0.35);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  word-break: break-all;
}

.markdown-link:hover {
  color: #7dd3fc;
  border-bottom-color: #7dd3fc;
}

/* Horizontal Rule */
.markdown-hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  margin: 1.6rem 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   TABLE LAYOUT (Responsive Container, Clean Borders, Zebra Rows, Copy Table)
   ───────────────────────────────────────────────────────────────────────────── */

.table-container {
  margin: 1.35rem 0;
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.table-container:hover {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-copy-table {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 500;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-copy-table:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-copy-table.copied {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.markdown-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.92rem;
  text-align: left;
}

.markdown-table th {
  background: rgba(255, 255, 255, 0.05);
  color: #f8fafc;
  font-weight: 600;
  padding: 11px 18px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  letter-spacing: 0.015em;
  font-size: 0.9rem;
}

.markdown-table td {
  padding: 11px 18px;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
  line-height: 1.55;
}

.markdown-table tbody tr:last-child td {
  border-bottom: none;
}

.markdown-table tbody tr {
  transition: background 0.12s ease;
}

.markdown-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.018);
}

.markdown-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MATHEMATICAL & SCIENTIFIC FORMULA LAYOUT (KaTeX + Fallback Symbols)
   ───────────────────────────────────────────────────────────────────────────── */

.math-block {
  display: block;
  text-align: center;
  margin: 1.25rem 0;
  padding: 1rem 1.4rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 10px;
  color: #e0f2fe;
  font-size: 1.12rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.math-inline {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  margin: 0 0.12rem;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 4px;
  color: #38bdf8;
  font-size: 0.94em;
  vertical-align: baseline;
}

/* KaTeX Dark Theme Adjustments */
.katex-display {
  margin: 0.8rem 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.4rem 0;
}

.katex {
  color: #e0f2fe !important;
  font-size: 1.05em;
}

/* Pure CSS Fractions Fallback */
.math-fraction {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  padding: 0 0.25rem;
  font-size: 0.88em;
  line-height: 1.1;
}

.math-num {
  border-bottom: 1.5px solid currentColor;
  padding-bottom: 2px;
}

.math-den {
  padding-top: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   LISTS & CHECKBOX TASK LISTS
   ───────────────────────────────────────────────────────────────────────────── */

.markdown-ul,
.markdown-ol {
  margin: 0.75rem 0 1rem 1.5rem;
  padding: 0;
}

.markdown-ul li,
.markdown-ol li {
  margin-bottom: 0.45rem;
  line-height: 1.68;
  color: #e2e8f0;
}

.markdown-task-list {
  list-style: none;
  margin: 0.75rem 0 1rem 0;
  padding: 0;
}

.task-list-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
  color: #e2e8f0;
}

.task-list-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #10b981;
  cursor: default;
  margin: 0;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BLOCKQUOTES & GITHUB-STYLE CALLOUT ALERTS
   ───────────────────────────────────────────────────────────────────────────── */

.markdown-body blockquote {
  margin: 1.1rem 0;
  padding: 0.75rem 1.25rem;
  border-left: 3.5px solid #64748b;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 0 8px 8px 0;
  color: #cbd5e1;
  font-style: italic;
}

.markdown-alert {
  margin: 1.25rem 0;
  border-radius: 10px;
  padding: 0.9rem 1.2rem;
  border-left: 4px solid;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.markdown-alert-note      { border-left-color: #38bdf8; background: rgba(56, 189, 248, 0.06); }
.markdown-alert-tip       { border-left-color: #10b981; background: rgba(16, 185, 129, 0.06); }
.markdown-alert-important { border-left-color: #a855f7; background: rgba(168, 85, 247, 0.06); }
.markdown-alert-warning   { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.06); }
.markdown-alert-caution   { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.06); }

.markdown-alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.markdown-alert-note .markdown-alert-header      { color: #38bdf8; }
.markdown-alert-tip .markdown-alert-header       { color: #10b981; }
.markdown-alert-important .markdown-alert-header { color: #a855f7; }
.markdown-alert-warning .markdown-alert-header   { color: #f59e0b; }
.markdown-alert-caution .markdown-alert-header   { color: #ef4444; }

.markdown-alert-body {
  font-size: 0.94rem;
  color: #e2e8f0;
  line-height: 1.62;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MILLISA REAL-TIME VOICE INTERPRETER & SPEECH TRANSLATOR MODAL
   ───────────────────────────────────────────────────────────────────────────── */
.interpreter-modal-card {
  width: 94%;
  max-width: 980px;
  max-height: 90vh;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(56, 189, 248, 0.08);
  overflow: hidden;
  animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.interpreter-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(24, 24, 27, 0.7);
  backdrop-filter: blur(12px);
}

.interpreter-header-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.12rem;
  font-weight: 700;
  color: #f3f4f6;
  letter-spacing: -0.01em;
}

.interpreter-header-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.interpreter-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.interpreter-lang-selector-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.interpreter-lang-select {
  background: #27272a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f3f4f6;
  border-radius: 10px;
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.interpreter-lang-select:hover, .interpreter-lang-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.btn-swap-lang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #38bdf8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-swap-lang:hover {
  background: rgba(56, 189, 248, 0.15);
  transform: rotate(180deg);
}

.btn-autospeak-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #9ca3af;
  border-radius: 9999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-autospeak-toggle.active {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

/* Speaker Tabs */
.interpreter-speaker-tabs {
  display: flex;
  gap: 0.5rem;
}

.speaker-tab-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #a1a1aa;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.speaker-tab-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #f3f4f6;
  font-weight: 600;
}

/* Dual Card Grid */
.interpreter-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.interpreter-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.interpreter-card {
  background: #202024;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  max-height: 280px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease;
  overflow: hidden;
}

.interpreter-card.active-card {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.08);
}

.interpreter-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
  color: #9ca3af;
}

.interpreter-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #e4e4e7;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: pulseDot 1.4s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.3); }
}

.interpreter-card-text {
  flex: 1;
  padding: 1rem;
  font-size: 1.02rem;
  line-height: 1.6;
  color: #f4f4f5;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.interpreter-placeholder {
  color: #71717a;
  font-style: italic;
  font-size: 0.92rem;
}

.interpreter-clauses-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.interpreter-clause-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  font-size: 0.96rem;
  line-height: 1.5;
  color: #f3f4f6;
  position: relative;
  transition: all 0.2s ease;
  animation: clauseFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.interpreter-clause-item.speaker-b {
  border-left: 3px solid #a855f7;
}

.interpreter-clause-item.speaker-a {
  border-left: 3px solid #38bdf8;
}

.interpreter-clause-item.target-clause {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.07) 0%, rgba(168, 85, 247, 0.04) 100%);
  border-color: rgba(56, 189, 248, 0.22);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}

.interpreter-clause-item.target-clause.speaking {
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.16);
}

.interpreter-clause-item.interim-clause {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(56, 189, 248, 0.3);
  color: #94a3b8;
}

.btn-sentence-listen {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #38bdf8;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.btn-sentence-listen:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #ffffff;
  transform: scale(1.08);
}

.interpreter-shimmer-text {
  color: #38bdf8;
  font-size: 0.9rem;
  font-style: italic;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  animation: pulseShimmer 1.5s infinite ease-in-out;
}

@keyframes pulseShimmer {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

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

.interpreter-live-cursor {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  background: #38bdf8;
  margin-left: 3px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.9s infinite ease-in-out;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.interpreter-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.btn-card-action {
  background: transparent;
  border: none;
  color: #a1a1aa;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.btn-card-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.btn-card-action.playing {
  color: #10b981;
}

/* Visualizer & Mic Area */
.interpreter-action-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 0.75rem 0;
  position: relative;
}

.interpreter-visualizer-box {
  width: 100%;
  max-width: 480px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.interpreter-waveform-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.interpreter-orb-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.interpreter-glow-orb {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.35) 0%, rgba(168, 85, 247, 0.15) 60%, transparent 100%);
  filter: blur(14px);
  opacity: 0.3;
  transition: all 0.25s ease-out;
}

.interpreter-glow-orb.active {
  opacity: 0.85;
  animation: orbPulse 2s infinite ease-in-out;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); filter: blur(14px); }
  50% { transform: scale(1.25); filter: blur(20px); }
}

.btn-interpreter-mic-main {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 2rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #0284c7, #7c3aed);
  color: #ffffff;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
  transition: all 0.2s ease;
  position: relative;
  z-index: 2;
}

.btn-interpreter-mic-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.45);
}

.btn-interpreter-mic-main.listening {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.45);
  animation: micRing 1.6s infinite ease-out;
}

@keyframes micRing {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* History Section */
.interpreter-history-wrapper {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1rem;
}

.interpreter-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #d4d4d8;
}

.interpreter-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.interpreter-history-empty {
  text-align: center;
  padding: 1.5rem;
  color: #71717a;
  font-size: 0.84rem;
  font-style: italic;
}

.interpreter-history-card {
  background: #202024;
  border-radius: 10px;
  padding: 0.75rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
}

.interpreter-history-card.speaker-a {
  border-left: 3px solid #38bdf8;
}

.interpreter-history-card.speaker-b {
  border-left: 3px solid #a855f7;
}

.interpreter-history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: #71717a;
}

.speaker-pill {
  font-weight: 600;
  color: #e4e4e7;
}

.interpreter-history-orig {
  font-size: 0.88rem;
  color: #a1a1aa;
}

.interpreter-history-trans {
  font-size: 0.92rem;
  font-weight: 500;
  color: #f4f4f5;
}

.btn-history-play {
  align-self: flex-end;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #9ca3af;
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  font-size: 0.74rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.btn-history-play:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.interpreter-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(24, 24, 27, 0.9);
}

.btn-interpreter-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #27272a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e4e4e7;
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-interpreter-action:hover {
  background: #3f3f46;
  color: #ffffff;
}

.btn-interpreter-primary {
  background: #38bdf8;
  border-color: #38bdf8;
  color: #0f172a;
  font-weight: 600;
}

.btn-interpreter-primary:hover {
  background: #7dd3fc;
  color: #0f172a;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .interpreter-cards-grid {
    grid-template-columns: 1fr;
  }
  .interpreter-modal-card {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .btn-new-chat-top-pill span {
    display: none;
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   NEW CHAT & RESET CONVERSATION BUTTONS (Global & Interpreter)
   ────────────────────────────────────────────────────────────────────────── */
.btn-header-new-chat {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  height: 34px !important;
  border-radius: 8px !important;
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: var(--text-secondary) !important;
  cursor: pointer !important;
  transition: all var(--transition-fast) !important;
  flex-shrink: 0 !important;
}

.btn-header-new-chat:hover {
  background: var(--bg-surface-hover) !important;
  color: var(--text-primary) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.btn-new-chat-top-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  padding: 0.38rem 0.85rem !important;
  border-radius: var(--radius-pill) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #ececec !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all var(--transition-fast) !important;
  flex-shrink: 0 !important;
}

.btn-new-chat-top-pill:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.24) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

.btn-interpreter-action-sm {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  background: rgba(239, 68, 68, 0.1) !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
  color: #fca5a5 !important;
  padding: 0.35rem 0.75rem !important;
  border-radius: 8px !important;
  font-size: 0.8rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.btn-interpreter-action-sm:hover {
  background: rgba(239, 68, 68, 0.22) !important;
  color: #ffffff !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
}

.btn-interpreter-reset-danger {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.28) !important;
  color: #fca5a5 !important;
}

.btn-interpreter-reset-danger:hover {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: #ffffff !important;
}



