/* ============================================================
   workspace.css — Three-panel research workspace
   ============================================================ */

/* ---------- WORKSPACE GRID ---------- */
.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 380px;
  gap: 1px;
  height: calc(100vh - 128px);      /* adjust to header+footer height */
  min-height: 480px;
  background: #e8ecf1;
  transition: grid-template-columns 0.35s cubic-bezier(.4,0,.2,1);
  position: relative;
}

.panel {
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #e8ecf1;
  flex-shrink: 0;
  background: #fafbfc;
}
.panel-header h2 {
  font-size: 14px;
  margin: 0;
  color: #1a237e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-badge {
  font-size: 11px;
  color: #666;
  background: #eef2f6;
  padding: 3px 9px;
  border-radius: 10px;
  white-space: nowrap;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  min-width: 0;
  align-items: stretch;
}

.panel-footer {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid #e8ecf1;
  flex-shrink: 0;
  background: #fafbfc;
}

/* ---------- SHARED INPUTS / BUTTONS ---------- */
.panel-filter,
.panel-search-row input,
.chat-input-row input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s;
}
.panel-filter:focus,
.panel-search-row input:focus,
.chat-input-row input:focus {
  outline: none;
  border-color: #1976d2;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #d0d7de;
  color: #555;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-ghost:hover { background: #eef2f6; }

/* ---------- REPOSITORY PANEL ---------- */
.repo-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.repo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, transform 0.25s, box-shadow 0.15s;
  user-select: none;
}
.repo-item:hover { background: #f0f4f8; }
.repo-item.selected {
  background: #e3f2fd;
  box-shadow: inset 3px 0 0 #1976d2;
}
.repo-item.selected .repo-name {
  font-weight: 600;
  color: #1a237e;
}

.repo-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: #1976d2;
  flex-shrink: 0;
}

.repo-name {
  flex: 1;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #333;
}

.repo-count {
  font-size: 11px;
  color: #999;
  flex-shrink: 0;
}

/* ---------- UPGRADE PROMPT ---------- */
.upgrade-prompt {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff3e0;
  border-top: 1px solid #ffe0b2;
  font-size: 12px;
  color: #e65100;
  flex-shrink: 0;
}
.upgrade-prompt.show { display: flex; }
.upgrade-prompt .btn-small {
  background: #1976d2;
  color: #fff;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ---------- SEARCH PANEL ---------- */
.panel-search-row {
  display: flex;
  gap: 8px;
  position: sticky;
  top: 0;
  background: #fff;
  padding-bottom: 4px;
  z-index: 2;
}
.panel-search-row input { flex: 1; }
.panel-search-row .btn {
  flex-shrink: 0;
  padding: 9px 16px;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.result-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #e8ecf1;
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.result-item:hover {
  border-color: #b8c4d0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.result-item.selected {
  background: #e8f5e9;
  border-color: #66bb6a;
}
.result-item.highlight-source {
  background: #fff8e1;
  border-color: #ffb300;
  box-shadow: 0 0 0 3px rgba(255,179,0,0.15);
}

.result-checkbox {
  margin-top: 3px;
  cursor: pointer;
  accent-color: #66bb6a;
  flex-shrink: 0;
}

.result-body { 
  min-width: 0;
  width: 100%;
}

.result-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a237e;
  margin-bottom: 4px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.35;
}
.result-title a {
  color: inherit;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}
.result-title a:hover { text-decoration: underline; }

.result-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  /* color: #888; */
  color: #58606c;
  padding: 2px 6px;
  margin-left: auto;
  border-radius: 4px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.result-toggle:hover { background: #eef2f6; color: #333; }

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: #666;
  margin-bottom: 6px;
}
.result-score.high   { color: #2e7d32; font-weight: 600; }
.result-score.medium { color: #ef6c00; font-weight: 600; }
.result-score.low    { color: #c62828; font-weight: 600; }

.result-summary {
  font-size: 12px;
  color: #444;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.result-item.expanded .result-summary {
  -webkit-line-clamp: unset;
  display: block;
}

.result-expanded {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e8ecf1;
  font-size: 12px;
  color: #555;
  line-height: 1.6;
}
.result-expanded > div { margin-bottom: 4px; }

.result-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.result-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 5px;
  border: 1px solid #d0d7de;
  background: #fff;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  color: #444;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.result-action-btn:hover { background: #f0f4f8; }
.result-action-btn.active {
  background: #66bb6a;
  color: #fff;
  border-color: #4caf50;
}
.result-action-btn.active:hover { background: #57a85c; }

/* ---------- CHAT PANEL ---------- */
.selected-docs {
  position: relative;
  flex-shrink: 0;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e8ecf1;

  /* ---- one row, horizontal scroll ---- */
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  max-height: none;              /* remove vertical cap */
  height: 52px;                  /* fixed height so chat gets the rest */
  align-items: center;

  /* Hide scrollbar visually but keep scrollability */
  scrollbar-width: thin;
  scrollbar-color: #c8d1da transparent;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.selected-docs::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 24px;
  background: linear-gradient(to right, transparent, #f8fafc);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.selected-docs.has-overflow::after { opacity: 1; }
.selected-docs::-webkit-scrollbar {
  height: 4px;
}
.selected-docs::-webkit-scrollbar-thumb {
  background: #c8d1da;
  border-radius: 2px;
}
.selected-docs::-webkit-scrollbar-track {
  background: transparent;
}

/* .docs-section { display: flex; flex-direction: column; gap: 6px; } */
.docs-section.ready-section {
  padding-top: 8px;
  border-top: 1px dashed #e0e6ed;
}

/* Chips must not shrink or wrap */
.selected-docs .doc-chip {
  flex: 0 0 auto;                /* don't grow, don't shrink */
  white-space: nowrap;
}

.selected-docs-empty {
  font-size: 12px;
  /* color: #888; */
  color: #58606c;
  font-style: italic;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.doc-chip.ready .doc-chip-remove { color: #2e7d32; }

.doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e3f2fd;
  color: #1a237e;
  padding: 4px 4px 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  max-width: 100%;
  transition: background 0.15s;
}
.doc-chip.abstract_only { background: #fff3e0; color: #e65100; }
.doc-chip.image_only    { background: #ffebee; color: #c62828; }

.doc-chip-title {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0 5px;
  border-radius: 50%;
  opacity: 0.7;
}
.doc-chip-remove:hover { opacity: 1; background: rgba(0,0,0,0.08); }

.web-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 12px;
  border-bottom: 1px solid #e8ecf1;
  cursor: pointer;
  flex-shrink: 0;
  background: #fafbfc;
}
.web-toggle-row input { accent-color: #1976d2; cursor: pointer; }
.web-toggle-hint {
  font-size: 11px;
  color: #58606c;
  /* color: #888; */
  margin-left: auto;
  text-align: right;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e8ecf1;
  flex-shrink: 0;
  background: #fafbfc;
}
.chat-input-row input { flex: 1; }
.chat-input-row input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
  color: #999;
}
.chat-input-row .btn { padding: 9px 16px; }
.chat-input-row .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- CHAT MESSAGES (reuse existing styles if present) ---------- */
.message { display: flex; }
.message-user      { justify-content: flex-end; }
.message-assistant { justify-content: flex-start; }

.message-bubble {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
}
.message-user .message-bubble {
  background: #1a237e;
  color: #fff;
  border-bottom-right-radius: 3px;
}
.message-assistant .message-bubble {
  background: #f0f4f8;
  color: #222;
  border-bottom-left-radius: 3px;
}
.message-user .message-bubble a { color: #bbdefb; }

.message-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
  opacity: 0.85;
}
.message-avatar { font-size: 14px; }

.message-text p { margin: 0 0 8px; }
.message-text p:last-child { margin-bottom: 0; }
.message-text pre {
  background: #1e1e1e;
  color: #f8f8f2;
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  margin: 8px 0;
}
.message-text code {
  background: rgba(0,0,0,0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.message-text pre code { background: transparent; padding: 0; }
.message-text ul, .message-text ol { margin: 6px 0; padding-left: 20px; }
.message-text h1, .message-text h2, .message-text h3 {
  margin: 10px 0 6px; font-size: 14px; color: #1a237e;
}
.message-user .message-text h1,
.message-user .message-text h2,
.message-user .message-text h3 { color: #fff; }

.message-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}
.msg-action {
  background: rgba(0,0,0,0.05);
  border: none;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 4px;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
}
.msg-action:hover { background: rgba(0,0,0,0.12); }

.sources-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0,0,0,0.15);
}
.sources-title {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 5px;
  opacity: 0.75;
}
.source-item {
  display: flex;
  gap: 6px;
  font-size: 11px;
  padding: 3px 0;
  cursor: pointer;
  border-radius: 3px;
  padding-left: 4px;
  transition: background 0.15s;
}
.source-item:hover { background: rgba(25,118,210,0.08); }
.source-number { color: #1976d2; font-weight: 600; flex-shrink: 0; }
.source-title a { color: #1976d2; text-decoration: none; }
.source-title a:hover { text-decoration: underline; }
.source-tenant { color: #999; margin-left: auto; font-size: 10px; }

/* ---------- PREPARE PROGRESS ---------- */
.prepare-progress {
  padding: 16px;
  background: #f8fafc;
  border-top: 1px solid #e8ecf1;
  text-align: center;
  flex-shrink: 0;
}
.prepare-progress h4 {
  margin: 8px 0;
  font-size: 13px;
  color: #1a237e;
}
.prepare-progress p {
  margin: 4px 0;
  font-size: 12px;
  color: #666;
}

.preparing-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e8ecf1;
  border-top-color: #1976d2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-track {
  margin: 12px 0;
  height: 6px;
  background: #e8ecf1;
  border-radius: 3px;
  overflow: hidden;
}
.progress-track #progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1a237e, #1976d2);
  transition: width 0.3s ease;
}

/* ---------- EMPTY STATES ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  /* color: #888; */
  color: #345;
  min-height: 180px;
}
.empty-state .icon {
  font-size: 38px;
  margin-bottom: 10px;
  opacity: 4.55;
}
.empty-state h3 {
  margin: 6px 0;
  color: #222;
  font-size: 15px;
  font-weight: 500;
}
.empty-state p {
  margin: 0;
  font-size: 12px;
  max-width: 260px;
  line-height: 1.5;
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #333;
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 5000;
  pointer-events: none;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: #2e7d32; }
.toast.error   { background: #c62828; }
.toast.info    { background: #1565c0; }

/* ---------- SCROLLBARS ---------- */
.panel-body::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.selected-docs::-webkit-scrollbar { width: 6px; }
.panel-body::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.selected-docs::-webkit-scrollbar-thumb {
  background: #c8d1da;
  border-radius: 3px;
}
.panel-body::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.selected-docs::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- MOBILE ---------- */
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr !important;
    height: calc(100vh - 110px);
  }
  .panel {
    height: 100%;
    max-height: none;
  }
  .workspace[data-active="repos"]  .panel:not(.panel-repos),
  .workspace[data-active="search"] .panel:not(.panel-search),
  .workspace[data-active="chat"]   .panel:not(.panel-chat) {
    display: none;
  }

  /* Mobile tab bar (added dynamically by JS) */
  .mobile-tabs {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    display: flex;
    background: #fff;
    border-top: 1px solid #e8ecf1;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  }
  .mobile-tabs button {
    flex: 1;
    padding: 10px 4px;
    border: none;
    background: transparent;
    font-size: 11px;
    color: #666;
    cursor: pointer;
    font-family: inherit;
    position: relative;
  }
  .mobile-tabs button.active {
    color: #1976d2;
    font-weight: 600;
  }
  .mobile-tabs button.active::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 2px;
    background: #1976d2;
    border-radius: 0 0 2px 2px;
  }
  .workspace { height: calc(100vh - 158px); }
  .toast { bottom: 70px; }
}
@media (min-width: 901px) {
  .mobile-tabs { display: none; }
}

/* ---------- MODAL ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
.modal-backdrop.show { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-card {
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px 20px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: slideUp 0.2s ease;
}
.modal-icon { font-size: 42px; margin-bottom: 8px; }
.modal-card h3 {
  margin: 0 0 10px;
  color: #1a237e;
  font-size: 18px;
}
.modal-card p {
  margin: 0 0 20px;
  color: #555;
  font-size: 13px;
  line-height: 1.55;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.modal-actions .btn,
.modal-actions .btn-ghost {
  padding: 8px 18px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-primary {
  background: #1976d2;
  color: #fff;
  border: 1px solid #1976d2;
}
.btn-primary:hover { background: #1565c0; }

/* ---------- ACCOUNT MODAL ---------- */
.modal-card-lg {
  max-width: 780px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
}
.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e8ecf1;
  flex-shrink: 0;
}
.modal-header-row h3 { margin: 0; color: #1a237e; font-size: 16px; }
.modal-close {
  background: none; border: none; font-size: 18px;
  cursor: pointer; color: #666; padding: 2px 8px; border-radius: 4px;
}
.modal-close:hover { background: #eef2f6; }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.account-wrap { display: flex; flex-direction: column; gap: 18px; }

.account-user-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #f8f9fa;
  padding: 14px 18px;
  border-radius: 10px;
}

.account-section-title {
  margin: 0;
  color: #1a237e;
  font-size: 14px;
}

/* Pricing table */
.pricing-table-wrap { overflow-x: auto; }
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e8ecf1;
}
.pricing-table th,
.pricing-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eef2f6;
}
.pricing-table th {
  background: #f5f8fb;
  color: #1a237e;
  font-weight: 600;
  font-size: 12px;
}
.pricing-table tr:last-child td { border-bottom: none; }
.pricing-table tr.current-plan td { background: #e8f5e9; }
.plan-name { font-weight: 600; color: #1a237e; }
.plan-price { font-variant-numeric: tabular-nums; }

.btn-select {
  background: #1976d2; color: #fff; border: none;
  padding: 5px 12px; border-radius: 5px; font-size: 12px;
  cursor: pointer; font-family: inherit;
}
.btn-select:hover { background: #1565c0; }

.exchange-rate {
  font-size: 12px; color: #666; text-align: right; padding: 4px 2px;
}

/* Payment */
.payment-section {
  display: none;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 10px;
}
.payment-section.show { display: block; }

.payment-methods {
  display: flex; gap: 10px; margin-bottom: 16px;
}
.payment-method-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid #d0d7de;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.payment-method-btn:hover { border-color: #b8c4d0; }
.payment-method-btn.selected {
  border-color: #1976d2;
  background: #e3f2fd;
  color: #1a237e;
  font-weight: 600;
}
.payment-method-btn .icon { font-size: 18px; }

.payment-form { display: none; margin-top: 12px; }
.payment-form.show { display: block; }

.form-group { margin-bottom: 12px; }
.form-group label {
  display: block; font-size: 12px; color: #555;
  margin-bottom: 5px; font-weight: 500;
}
.form-group input {
  width: 100%; padding: 10px 12px;
  border: 2px solid #e8ecf1; border-radius: 6px;
  font-size: 14px; font-family: inherit;
  box-sizing: border-box;
}
.form-group input:focus {
  outline: none; border-color: #1976d2;
}

.phone-input {
  display: flex; align-items: center; gap: 8px;
  background: #f5f5f5; padding: 4px 12px;
  border-radius: 6px; border: 2px solid #e8ecf1;
}
.phone-input span { font-weight: 600; color: #555; }
.phone-input input {
  border: none; background: transparent; flex: 1;
  outline: none; padding: 8px 0; font-size: 14px;
}

.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

.btn-mpesa {
  width: 100%;
  background: #43a047; color: #fff;
  border: none; padding: 12px; border-radius: 6px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn-mpesa:hover { background: #388e3c; }

.btn-success {
  width: 100%;
  background: #1976d2; color: #fff;
  border: none; padding: 12px; border-radius: 6px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn-success:hover { background: #1565c0; }

/* Plan badge (shared with header) */
.plan-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.plan-badge.free          { background: #eef2f6; color: #555; }
.plan-badge.basic         { background: #e3f2fd; color: #1565c0; }
.plan-badge.pro           { background: #f3e5f5; color: #6a1b9a; }
.plan-badge.pro_plus      { background: #fff3e0; color: #e65100; }
.plan-badge.pro_plus_plus { background: #ffebee; color: #c62828; }

/* Mobile: pricing table stacks */
@media (max-width: 700px) {
  .modal-card-lg { max-width: 100%; }
  .account-user-card { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   SITE HEADER (upgraded)
   ============================================================ */
.site-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  /* background: #fff; */
  border-bottom: 1px solid #e8ecf1;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.site-header-left { display: flex; align-items: center; gap: 14px; }

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.site-logo { font-size: 24px; line-height: 1; }
.site-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.site-title {
  font-weight: 700;
  font-size: 16px;
  color: #1a237e;
  letter-spacing: -0.2px;
}
.site-tagline { font-size: 10px; color: #a8606c; }

/* ---------- Global search ---------- */
.site-header-center {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.global-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 620px;
  background: #f5f8fb;
  border: 1px solid #e0e6ed;
  border-radius: 10px;
  padding: 4px 10px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.global-search:focus-within {
  background: #fff;
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(25,118,210,0.12);
}

.global-search-icon {
  font-size: 13px;
  opacity: 0.6;
  flex-shrink: 0;
}

.global-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  padding: 8px 0;
  min-width: 0;
  color: #222;
}
.global-search input::placeholder { color: #64748b; }

.global-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #58606c;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.global-search-clear:hover { background: #e8ecf1; color: #333; }

.global-search-scope {
  font-size: 10px;
  color: #64748b;
  background: #fff;
  border: 1px solid #e0e6ed;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

/* ---------- Profile menu ---------- */
.site-header-right { position: relative; }

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f5f8fb;
  border: 1px solid #e0e6ed;
  border-radius: 10px;
  padding: 5px 12px 5px 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: #333;
  transition: background 0.15s, border-color 0.15s;
}
.profile-trigger:hover { background: #eef2f6; border-color: #d0d7de; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1976d2, #1a237e);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  min-width: 0;
}
.profile-meta #siteUserName {
  font-weight: 600;
  font-size: 12px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-meta .plan-badge {
  font-size: 9px;
  padding: 1px 7px;
  border-radius: 8px;
  margin-top: 1px;
}

.profile-caret {
  font-size: 10px;
  color: #666;
  margin-left: 2px;
  transition: transform 0.15s;
}
.profile-trigger.open .profile-caret { transform: rotate(180deg); }

/* Profile dropdown */
.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid #e0e6ed;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
  padding: 6px;
  z-index: 300;
  animation: profileMenuIn 0.15s ease;
}
@keyframes profileMenuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.profile-menu-header {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f6;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-menu-header strong {
  font-size: 13px;
  color: #1a237e;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-menu-header span {
  font-size: 11px;
  color: #58606c;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: #333;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.profile-menu-item:hover { background: #f0f4f8; }
.profile-menu-item.danger { color: #c62828; }
.profile-menu-item.danger:hover { background: #ffebee; }

.profile-menu-divider {
  height: 1px;
  background: #eef2f6;
  margin: 4px 6px;
}

/* ---------- Plan badges (shared) ---------- */
.plan-badge {
  display: inline-block;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.2px;
}
.plan-badge.free          { background: #eef2f6; color: #555; }
.plan-badge.basic         { background: #e3f2fd; color: #1565c0; }
.plan-badge.pro           { background: #f3e5f5; color: #6a1b9a; }
.plan-badge.pro_plus      { background: #fff3e0; color: #e65100; }
.plan-badge.pro_plus_plus { background: #ffebee; color: #c62828; }

/* ---------- Legacy btn-small (kept for safety) ---------- */
.btn-small {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #d0d7de;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}
.btn-small:hover { background: #f0f4f8; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .site-header {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 8px 12px;
  }
  .site-tagline { display: none; }
  .site-title { font-size: 15px; }

  .global-search { max-width: none; padding: 3px 8px; }
  .global-search-scope { display: none; }

  .profile-meta { display: none; }
  .profile-trigger { padding: 5px; }
  .profile-caret { display: none; }
}

@media (max-width: 600px) {
  .site-header { grid-template-columns: auto 1fr auto; }
  .site-logo { font-size: 20px; }
  .site-title { font-size: 14px; }
  .global-search input { font-size: 12px; }
}

/* ============================================================
   FLOATING PREPARE BUTTON
   ============================================================ */
.prepare-fab {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 5;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 12px 18px;
  border: none;
  border-radius: 28px;

  background: linear-gradient(135deg, #1976d2, #1a237e);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;

  cursor: pointer;
  box-shadow: 0 6px 20px rgba(25,118,210,0.35);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
  animation: fabPop 0.25s cubic-bezier(.34,1.56,.64,1);
}
.prepare-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(25,118,210,0.45);
}
.prepare-fab:active { transform: translateY(0); }

.prepare-fab .fab-icon { font-size: 15px; }
.prepare-fab .fab-label { white-space: nowrap; }

.prepare-fab.dirty {
  background: linear-gradient(135deg, #ef6c00, #e65100);
  box-shadow: 0 6px 20px rgba(230,81,0,0.35);
}
.prepare-fab.dirty:hover {
  box-shadow: 0 10px 26px rgba(230,81,0,0.45);
}

.prepare-fab.working {
  background: #94a3b8;
  cursor: wait;
  box-shadow: none;
  opacity: 0.9;
}

@keyframes fabPop {
  from { opacity: 0; transform: scale(0.85) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Mobile — span wider, more thumb-friendly */
@media (max-width: 900px) {
  .prepare-fab {
    bottom: 76px;      /* sit above the mobile tab bar */
    right: 14px;
    padding: 14px 20px;
    font-size: 14px;
  }
}

/* Collapsed panels */
.panel-collapse-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #64748b;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, transform 0.2s;
  line-height: 1;
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.panel-collapse-btn:hover {
  background: #eef2f6;
  color: #1a237e;
}

.panel.collapsed {
  cursor: pointer;
  background: #f5f8fb;
  position: relative;
}

.panel.collapsed .panel-body,
.panel.collapsed .panel-footer,
.panel.collapsed .prepare-fab,
.panel.collapsed .panel-badge,
.panel.collapsed .btn-ghost {
  display: none !important;
}

.panel.collapsed .panel-header {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 4px;
  gap: 10px;
  border-bottom: none;
  height: 100%;
  background: #f5f8fb;
}

/* Header text hidden in collapsed state */
.panel.collapsed .panel-header h2 {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin: 6px 0;
  white-space: nowrap;
}

/* Chevron flips direction */
.panel.collapsed .panel-collapse-btn {
  transform: rotate(180deg);
  background: #e3f2fd;
  color: #1a237e;
}

/* Hover hint */
.panel.collapsed:hover {
  background: #eef2f6;
}
.panel.collapsed:hover .panel-header {
  background: #eef2f6;
}

@media (max-width: 900px) {
  .panel-collapse-btn { display: none; }

  /* Reset any desktop collapse state on mobile */
  .panel.collapsed .panel-body,
  .panel.collapsed .panel-footer,
  .panel.collapsed .panel-badge,
  .panel.collapsed .btn-ghost {
    display: revert !important;
  }
  .panel.collapsed .panel-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #fafbfc;
    height: auto;
  }
  .panel.collapsed .panel-header h2 {
    writing-mode: horizontal-tb;
    transform: none;
  }
}

.workspace {
  display: grid;
  /* Three width variables — default values */
  --w-repos:  280px;
  --w-search: minmax(0, 1fr);
  --w-chat:   380px;

  grid-template-columns: var(--w-repos) var(--w-search) var(--w-chat);
  gap: 1px;
  height: calc(100vh - 128px);
  min-height: 480px;
  background: #e8ecf1;
  transition: grid-template-columns 0.35s cubic-bezier(.4,0,.2,1);
  position: relative;
}

/* Active-panel sizing just changes the variables */
.workspace[data-active="repos"] {
  --w-repos:  1.35fr;
  --w-search: 1fr;
  --w-chat:   0.85fr;
}
.workspace[data-active="search"] {
  --w-repos:  0.75fr;
  --w-search: 1.7fr;
  --w-chat:   0.8fr;
}
.workspace[data-active="chat"] {
  --w-repos:  0.75fr;
  --w-search: 1fr;
  --w-chat:   1.45fr;
}

/* Collapse overrides a SINGLE variable — always wins because it's more specific in effect */
.workspace[data-collapsed="repos"] {
  --w-repos: 44px;
}
.workspace[data-collapsed="search"] {
  --w-search: 44px;
}
.workspace[data-collapsed="chat"] {
  --w-chat: 44px;
}

/* ============================================================
   FIRST-LIGHT EXPERIENCE
   ============================================================ */
.first-light {
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: firstLightIn 0.4s cubic-bezier(.4,0,.2,1);
}
@keyframes firstLightIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.first-light-hero { text-align: center; }
.first-light-flag {
  font-size: 46px;
  line-height: 1;
  display: inline-block;
  animation: flagWave 1.6s ease-in-out infinite;
  transform-origin: 70% 70%;
}
@keyframes flagWave {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-6deg); }
  75%      { transform: rotate(6deg); }
}

.first-light-hero h2 {
  margin: 12px 0 4px;
  color: #1a237e;
  font-size: 22px;
  letter-spacing: -0.3px;
  font-weight: 700;
}
.first-light-hero p {
  margin: 0;
  color: #555;
  font-size: 13px;
  line-height: 1.5;
}

/* Steps */
.first-light-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  padding: 16px 18px;
}
.first-light-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #333;
  line-height: 1.4;
}
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1976d2;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.first-light-step:nth-child(2) .step-num { background: #0d47a1; }
.first-light-step:nth-child(3) .step-num { background: #1a237e; }

/* Suggestions */
.first-light-try { display: flex; flex-direction: column; }
.first-light-try-label {
  font-size: 11px;
  /* color: #888; */
  color: #58606c;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  font-weight: 600;
}
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.suggestion-chip {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid #d0d7de;
  background: #fff;
  color: #1a237e;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.suggestion-chip:hover {
  background: #e3f2fd;
  border-color: #1976d2;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(25,118,210,0.15);
}
.suggestion-chip:active {
  transform: translateY(0);
}

/* Skip */
.first-light-skip {
  align-self: center;
  background: none;
  border: none;
  color: #58606c;
/* color: #888; */
  font-size: 11px;
  cursor: pointer;
  padding: 6px 12px;
  font-family: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s, color 0.15s;
}
.first-light-skip:hover {
  color: #555;
  text-decoration-color: #58606c;
}

/* Guest variant tweak */
.first-light.guest .first-light-hero h2 {
  font-size: 20px;
}

/* Mobile */
@media (max-width: 600px) {
  .first-light { padding: 20px 16px; gap: 18px; }
  .first-light-flag { font-size: 38px; }
  .first-light-hero h2 { font-size: 19px; }
  .first-light-steps { padding: 14px; }
  .first-light-step { font-size: 12px; }
}

/* ====================================================
   PINNED BAR
======================================================*/
.search-pin {
  flex-shrink: 0;
  padding: 12px 14px 10px;
  background: #fff;
  border-bottom: 1px solid #e8ecf1;
  position: relative;
  z-index: 3;
}

.search-pin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f8fb;
  border: 1px solid #e0e6ed;
  border-radius: 10px;
  padding: 4px 8px 4px 12px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.search-pin-row:focus-within {
  background: #fff;
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(25,118,210,0.12);
}

.search-pin-icon {
  font-size: 14px;
  color: #64748b;
/* color: #94a3b8; */
  flex-shrink: 0;
}

.search-pin-row input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  padding: 9px 0;
  min-width: 0;
}
.search-pin-row input::placeholder { color: #64748b; }

.search-pin-row .btn {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
}

.search-pin-hint {
  font-size: 11px;
  color: #64748b;
/* color: #94a3b8; */
  padding: 4px 12px 0;
  min-height: 14px;
  line-height: 1;
}

/* ============================================================
   SETTLED HOME
   ============================================================ */
.settled-home {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 6px;
  animation: settledIn 0.3s ease;
}
@keyframes settledIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Continue chat card */
.continue-chat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
  border: 1px solid #bbdefb;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s;
}
.continue-chat-card:hover {
  border-color: #1976d2;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25,118,210,0.15);
}
.continue-chat-icon { font-size: 26px; flex-shrink: 0; }
.continue-chat-body { flex: 1; min-width: 0; }
.continue-chat-title {
  font-weight: 700;
  font-size: 14px;
  color: #1a237e;
  margin-bottom: 2px;
}
.continue-chat-meta {
  font-size: 12px;
  color: #546e7a;
}
.continue-chat-arrow {
  font-size: 18px;
  color: #1976d2;
  flex-shrink: 0;
}

/* Section titles */
.settled-section { display: flex; flex-direction: column; gap: 8px; }
.settled-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b;
}

/* Recent search rows */
.settled-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #f8fafc;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
  width: 100%;
}
.settled-row:hover {
  background: #eef2f6;
  border-color: #d0d7de;
}
.settled-row-icon { font-size: 13px; flex-shrink: 0; }
.settled-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.settled-row-title {
  font-size: 13px;
  color: #1a237e;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settled-row-meta {
  font-size: 11px;
  color: #64748b;
/* color: #94a3b8; */
}
.settled-row-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
/* color: #94a3b8; */
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.settled-row:hover .settled-row-clear { opacity: 1; }
.settled-row-clear:hover { background: #e0e6ed; color: #333; }

/* Popular chips */
.settled-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.settled-chip {
  padding: 6px 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e0e6ed;
  color: #546e7a;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
}
.settled-chip:hover {
  background: #e3f2fd;
  border-color: #1976d2;
  color: #1a237e;
}

/* Stats Panel */
.panel-stats {
  padding: 8px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e8ecf1;
  font-size: 11px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
  flex-shrink: 0;
}
.panel-stats-line { flex: 1; min-width: 0; }
.panel-stats-line strong {
  color: #1a237e;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.panel-stats-line .stat-scope {
  color: #1976d2;
}

.result-action-btn.primary {
  background: #1a237e;
  color: white;
  border-color: #1a237e;
  font-weight: 600;
}
.result-action-btn.primary:hover {
  background: #0d47a1;
  border-color: #0d47a1;
}

.result-action-btn.disabled {
  background: #f5f7fa;
  color: #94a3b8;
  border-color: #e2e8f0;
  cursor: not-allowed;
  font-style: italic;
}
.result-action-btn.disabled:hover {
  background: #f5f7fa;
  border-color: #e2e8f0;
}

/* ---------- Disabled chat state (non-enrolled IR) ---------- */
.result-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.result-item.chat-disabled {
  /* Subtle mute — keeps the result fully readable but signals "no action here" */
  background: #fafbfc;
}
.result-item.chat-disabled .result-checkbox {
  /* Even more muted in the muted row */
  opacity: 0.25;
}

.result-item.chat-disabled .result-action-btn.disabled {
  /* The "Chat unavailable" pill we already render */
  background: #f5f7fa;
  color: #94a3b8;
  border-color: #e2e8f0;
  cursor: not-allowed;
  font-style: italic;
}

.result-checkbox-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 12px;
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   CHAT PANEL — collapsed by default, expands on multi-tenant
   ============================================================ */
.workspace[data-mode="discovery"] .panel-chat {
  display: none;
}
/* .workspace[data-mode="discovery"] .prepare-fab { */
  /* display: inline !important; */
/* } */

/* When chat mode is active, three-panel layout resumes */
.workspace[data-mode="chat"] .panel-chat {
  display: flex;
}

/* Two-column layout when chat is collapsed */
.workspace[data-mode="discovery"] {
  grid-template-columns: var(--w-repos, 280px) minmax(0, 1fr);
}
.workspace[data-mode="discovery"][data-active="repos"] {
  --w-repos: 1.35fr;
}
.workspace[data-mode="discovery"][data-active="search"] {
  --w-repos: 0.75fr;
}

/* Disable `data-active="chat"` from applying when chat is collapsed */
.workspace[data-mode="discovery"][data-active="chat"] {
  /* Fall back to search-active sizing */
  --w-repos: 0.75fr;
}

/* ---------- Search panel header tools ---------- */
.search-header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chat-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid #e0e6ed;
  background: #fff;
  font-size: 11px;
  color: #555;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.chat-filter-toggle:hover {
  border-color: #1976d2;
  background: #f5f8fb;
}
.chat-filter-toggle:has(input:checked) {
  background: #e8f5e9;
  border-color: #66bb6a;
  color: #2e7d32;
  font-weight: 600;
}
.chat-filter-toggle input {
  margin: 0;
  cursor: pointer;
  accent-color: #66bb6a;
  width: 12px;
  height: 12px;
}
.chat-filter-label {
  line-height: 1;
  white-space: nowrap;
}

/* Hidden on IR-side embeds where all docs are chat-enabled anyway */
body[data-ir-embed="true"] .chat-filter-toggle {
  display: none;
}