/* Sidebar-specific overrides are kept separate for future sidebar changes. */

/* —— Scrollable chat area ——
   The CHATS list and the (collapsed-until-relevant) ARCHIVED list share one
   scroll container so the sidebar keeps its single scrollbar and layout. */
.conv-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.conv-scroll::-webkit-scrollbar { width: 4px; }
.conv-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

/* Inside the wrapper the lists no longer scroll themselves. */
.conv-scroll .conv-list {
  flex: none;
  overflow: visible;
}

.layout.sidebar-collapsed .conv-scroll { display: none; }

/* —— Tools section (seção de ferramentas) ——
   Grupo de navegação próprio no topo da sidebar. */
.sidebar-section {
  display: flex;
  flex-direction: column;
}

.sidebar-section-title {
  font-size: 0.6875rem; /* 11px compacto */
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  padding: 12px 12px 4px;
}

.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--space-2);
}

.sidebar-nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 34px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background: var(--color-surface-translucent);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sidebar-nav-btn:hover {
  border-color: var(--color-accent-line);
  background: var(--color-accent-soft);
}

.sidebar-nav-btn .icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}

.sidebar-nav-btn .label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar recolapsada: os títulos somem e os botões
   viram ícones centralizados de 38×38px (label oculta). */
.layout.sidebar-collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-section-title {
  display: none !important;
}

.layout.sidebar-collapsed .sidebar-nav-btn,
.sidebar.collapsed .sidebar-nav-btn {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  justify-content: center;
}

.layout.sidebar-collapsed .sidebar-nav-btn .label,
.sidebar.collapsed .sidebar-nav-btn .label {
  display: none;
}

/* Barra de busca na seção CHATS: respiro antes da lista. */
.sidebar-search {
  margin-bottom: var(--space-2);
}

/* —— Pinned indicator —— */
.conv-item.pinned .conv-title { font-weight: 600; }

.conv-pin {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  vertical-align: -1px;
  color: var(--color-accent);
}

/* —— Per-chat three-dot action menu —— */
.conv-menu-btn {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-text-faint);
  cursor: pointer;
  opacity: 0;
  display: grid;
  place-items: center;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}

.conv-item:hover .conv-menu-btn,
.conv-item.active .conv-menu-btn,
.conv-menu-btn[aria-expanded="true"] { opacity: 1; }

.conv-menu-btn:hover,
.conv-menu-btn[aria-expanded="true"] { background: var(--color-surface-hover); color: var(--color-text); }

/* Touch/narrow layouts have no hover: keep the control reachable at all times. */
@media (hover: none) {
  .conv-menu-btn { opacity: 1; }
}

.chat-menu {
  position: fixed;
  z-index: 10000;
  min-width: 168px;
  padding: var(--space-1);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-medium);
  background: var(--color-overlay);
  box-shadow: var(--elevation-3);
}

.chat-menu-item {
  display: block;
  width: 100%;
  padding: 6px var(--space-3);
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.chat-menu-item:hover { background: var(--color-surface-hover); }
.chat-menu-item[data-action="delete"] { color: var(--color-danger); }
.chat-menu-item[data-action="delete"]:hover { background: var(--color-danger-soft); }

/* —— Rename / Share dialogs —— */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: rgba(0, 0, 0, 0.55);
}

/* Settings sits above the chat/sidebar layers. Its hidden attribute is removed
   by the opener; active also keeps the overlay visible during the transition. */
#settings-modal.active,
#settings-modal:not([hidden]) {
  display: flex !important;
  position: fixed !important;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 99999 !important;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.6);
}

#settings-modal[hidden]:not(.active) {
  display: none !important;
}

.dialog {
  width: min(420px, 100%);
  padding: var(--space-5);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-large);
  background: var(--color-overlay);
  box-shadow: var(--elevation-3);
}

.dialog-title {
  margin: 0 0 var(--space-3);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.dialog-text {
  margin: 0 0 var(--space-3);
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  line-height: 1.45;
}

.dialog-input {
  width: 100%;
  min-height: 42px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background: var(--color-surface-translucent);
  color: var(--color-text);
  font: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dialog-input:focus {
  border-color: var(--color-accent-line);
  box-shadow: 0 0 0 3px rgba(46, 224, 184, 0.08);
}

.dialog-error { margin: var(--space-2) 0 0; color: var(--color-danger); font-size: 0.78rem; }
.dialog-success { margin: var(--space-2) 0 0; color: var(--color-success); font-size: 0.78rem; }

/* —— Files in this chat dialog —— */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--space-2);
  max-height: min(50vh, 320px);
  margin-top: var(--space-3);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
.files-grid::-webkit-scrollbar { width: 6px; }
.files-grid::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }

.file-thumb {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface-translucent);
  transition: border-color 0.15s, transform 0.15s;
}
.file-thumb:hover { border-color: var(--color-accent-line); transform: translateY(-1px); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.files-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: var(--space-4) 0;
  color: var(--color-text-faint);
  font-size: 0.8125rem;
  text-align: center;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}

.dialog-btn {
  padding: 6px var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-translucent);
  color: var(--color-text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}

.dialog-btn:hover { background: var(--color-surface-hover); }
.dialog-btn.primary { border-color: transparent; background: var(--color-accent); color: var(--color-on-accent); }
.dialog-btn.primary:hover { background: var(--color-accent-hover); }

.share-link-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-3);
}

.share-link-row .dialog-input { flex: 1; min-width: 0; }

/* —— Persistent memory dashboard —— */
.memory-dialog {
  display: flex;
  flex-direction: column;
  width: min(620px, 100%);
  max-height: min(760px, calc(100dvh - 32px));
  overflow: hidden;
  padding: clamp(18px, 3vw, 28px);
  border-color: rgba(46, 224, 184, 0.16);
  background: linear-gradient(155deg, rgba(0, 0, 0, 0.98), rgba(0, 0, 0, 0.99) 72%);
}
.memory-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.memory-dialog-heading .dialog-title { margin: 0; font-size: 1.28rem; letter-spacing: -0.035em; }
.memory-dialog-heading .dialog-text { max-width: 30rem; margin: var(--space-2) 0 0; }
.memory-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.memory-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-translucent);
  color: var(--color-text-secondary);
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
}
.memory-sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-text-faint); }
.memory-sync-badge[data-state="synced"] { border-color: rgba(52, 211, 153, 0.22); color: #8BE6C4; background: rgba(52, 211, 153, 0.07); }
.memory-sync-badge[data-state="synced"] .memory-sync-dot { background: var(--color-success); box-shadow: 0 0 9px rgba(52, 211, 153, 0.7); }
.memory-sync-badge[data-state="loading"] .memory-sync-dot { background: var(--color-accent); box-shadow: 0 0 8px rgba(46, 224, 184, 0.55); animation: memory-pulse 1.2s ease-in-out infinite; }
.memory-sync-badge[data-state="error"] { border-color: rgba(248, 113, 113, 0.22); color: var(--color-danger); }
.memory-sync-badge[data-state="error"] .memory-sync-dot { background: var(--color-danger); }
@keyframes memory-pulse { 50% { opacity: 0.45; } }
.memory-close {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface-translucent);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  transition: border-color 0.16s, color 0.16s, background 0.16s, transform 0.16s;
}
.memory-close:hover { border-color: var(--color-border-strong); background: var(--color-surface-hover); color: var(--color-text); transform: rotate(90deg); }
.memory-usage { display: flex; align-items: center; gap: 12px; margin: 0 1px 9px; padding: 0 0 12px; border-bottom: 1px solid rgba(230, 247, 243, 0.07); }
.memory-meter { position: relative; isolation: isolate; height: 5px; flex: 1; overflow: hidden; border-radius: 99px; background: rgba(230, 247, 243, 0.16); }
.memory-meter-fill { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border-radius: inherit; background-color: #10B981; background-image: linear-gradient(90deg, #35F0C8 0%, #2EE0B8 52%, #0EA68A 100%); box-shadow: 0 0 8px rgba(46, 224, 184, 0.45); opacity: 1; transform: scaleX(0); transform-origin: left center; transition: transform 0.24s ease; will-change: transform; }
.memory-counter { flex: 0 0 auto; color: var(--color-text-faint); font-size: 0.68rem; font-variant-numeric: tabular-nums; }
.memory-status { min-height: 1.2rem; margin: 3px 1px 10px; color: var(--color-text-secondary); font-size: 0.72rem; line-height: 1.4; }
.memory-status[data-state="success"] { color: var(--color-success); }
.memory-status[data-state="error"] { color: var(--color-danger); }
.memory-summary-view { display: flex; min-height: 80px; flex: 1 1 auto; flex-direction: column; gap: 18px; overflow-y: auto; padding: 6px 5px 14px 1px; overscroll-behavior: contain; scrollbar-color: rgba(167, 186, 181, 0.22) transparent; scrollbar-width: thin; }
.memory-summary-view[hidden] { display: none; }
.memory-summary-section { padding: 2px 0 15px; border-bottom: 1px solid rgba(230, 247, 243, 0.075); }
.memory-summary-section:last-child { border-bottom: 0; }
.memory-summary-title { margin: 0 0 8px; color: var(--color-text); font-size: 0.91rem; line-height: 1.35; letter-spacing: -0.012em; }
.memory-summary-title strong { font-weight: 680; }
.memory-summary-paragraph { max-width: 68ch; margin: 0; color: var(--color-text-secondary); font-size: 0.84rem; line-height: 1.68; overflow-wrap: anywhere; white-space: pre-wrap; }
.memory-assistant-reply { flex: 0 0 auto; max-height: 150px; overflow-y: auto; margin: 8px 0 0; padding: 11px 13px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-surface-translucent); color: var(--color-text-secondary); font-size: 0.8rem; line-height: 1.55; white-space: pre-wrap; }
.memory-assistant-reply[hidden] { display: none; }
.memory-empty { display: flex; flex: 1 1 auto; min-height: 150px; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 24px 16px; text-align: center; }
.memory-empty[hidden] { display: none; }
.memory-empty-icon { display: grid; width: 48px; height: 48px; place-items: center; margin-bottom: 3px; border: 1px solid rgba(46, 224, 184, 0.16); border-radius: 15px; background: var(--color-accent-softer); color: var(--color-accent); }
.memory-empty strong { color: var(--color-text); font-size: 0.86rem; font-weight: 600; }
.memory-empty > span:last-child { max-width: 270px; color: var(--color-text-muted); font-size: 0.76rem; line-height: 1.5; }
.memory-actions { flex-direction: column; align-items: stretch; justify-content: stretch; flex-wrap: nowrap; margin-top: var(--space-4); }
.memory-selection-chip { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 8px; padding: 7px 9px 7px 12px; border: 1px solid rgba(230, 247, 243, 0.1); border-radius: 10px; background: rgba(5, 12, 12, 0.56); color: var(--color-text-secondary); font-size: 0.72rem; line-height: 1.35; }
.memory-selection-chip[hidden] { display: none; }
.memory-chip-label { flex: 0 0 auto; color: var(--color-accent); font-weight: 650; }
.memory-chip-text { min-width: 0; max-height: 5.5em; flex: 1 1 auto; overflow: auto; color: var(--color-text); overflow-wrap: anywhere; white-space: pre-wrap; scrollbar-color: rgba(167, 186, 181, 0.22) transparent; scrollbar-width: thin; }
.memory-chip-clear { display: grid; flex: 0 0 auto; width: 20px; height: 20px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--color-text-faint); font: inherit; font-size: 1rem; cursor: pointer; transition: color 0.14s, background 0.14s; }
.memory-chip-clear:hover { background: var(--color-surface-hover); color: var(--color-text); }
.memory-ask-row { display: flex; align-items: center; gap: 7px; width: 100%; min-width: 0; flex: 1 1 100%; padding: 5px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); background: rgba(5, 12, 12, 0.48); transition: border-color 0.16s, box-shadow 0.16s; }
.memory-ask-row:focus-within { border-color: var(--color-accent-line); box-shadow: 0 0 0 3px var(--color-accent-softer); }
.memory-ask-input { min-width: 0; flex: 1 1 auto; padding: 10px 13px; border: 0; background: transparent; box-shadow: none; }
.memory-ask-input:focus { outline: 0; }
.memory-ask-input:disabled { opacity: 0.62; cursor: wait; }
.memory-ask-button { display: grid; flex: 0 0 auto; width: 28px; height: 28px; place-items: center; border: 1px solid rgba(46, 224, 184, 0.24); border-radius: 50%; background: var(--color-accent-soft); color: var(--color-accent); cursor: pointer; transition: background 0.16s, transform 0.16s, opacity 0.16s; }
.memory-ask-button:not(:disabled):hover { background: rgba(46, 224, 184, 0.18); transform: translateY(-1px); }
.memory-ask-button:disabled { opacity: 0.4; cursor: not-allowed; }
.memory-ask-button[aria-busy="true"] { animation: memory-pulse 1.1s ease-in-out infinite; }

@media (max-width: 480px) {
  .share-link-row { flex-wrap: wrap; }
  .share-link-row .dialog-input { flex: 1 1 100%; }
  .memory-dialog { max-height: calc(100dvh - 20px); padding: var(--space-4); }
  .memory-dialog-heading { margin-bottom: var(--space-4); }
  .memory-ask-row { flex-basis: 100%; }
  .memory-empty { min-height: 130px; }
}

/* —— AI personalization editor (manual rules + automatic toggle) —— */
.personalization-dialog { width: min(560px, 100%); }
.personalization-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.personalization-dialog-heading .dialog-title { margin-bottom: var(--space-1); }
.personalization-dialog-heading .dialog-text { max-width: 28rem; margin-bottom: var(--space-4); }
.personalization-textarea {
  display: block;
  min-height: 150px;
  padding: var(--space-3);
  resize: vertical;
  line-height: 1.55;
}
.personalization-textarea:disabled { opacity: 0.65; cursor: wait; }
.personalization-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background: var(--color-surface-translucent);
}
.personalization-row-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.personalization-row-title { color: var(--color-text); font-size: 0.85rem; font-weight: 600; }
.personalization-row-subtitle { color: var(--color-text-secondary); font-size: 0.75rem; line-height: 1.4; }
.personalization-lock {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.personalization-lock[hidden] { display: none; }
.personalization-row .toggle-switch[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.personalization-actions .dialog-btn:disabled { opacity: 0.55; cursor: wait; }

@media (max-width: 480px) {
  .personalization-dialog { padding: var(--space-4); }
  .personalization-textarea { min-height: 130px; }
  .personalization-row { flex-wrap: wrap; }
}

/* —— Account panel (bottom of the sidebar) —— */
.auth-panel {
  margin: 12px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
}

.auth-panel .sidebar-item { justify-content: center; }

#auth-logout { margin-top: 9px; }

.auth-user-info {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

#auth-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.auth-user-details { min-width: 0; }

.auth-user-details #auth-name,
.auth-user-details #auth-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user-details #auth-email {
  color: var(--color-text-secondary);
  font-size: 0.75rem;
}

#auth-status {
  margin: 7px 0 0;
  color: var(--color-text-secondary);
  font-size: 0.72rem;
}

/* —— Account panel, sidebar recolhida: chip só com o avatar ——
   O row herdava o padding assimétrico (6px 8px 6px 0) do estado
   expandido, deslocando o centro do rail de 60px; zerado, avatar
   e Settings ficam centralizados de fato. */
.layout.sidebar-collapsed .sidebar-account-row {
  padding: 0;
  overflow: hidden;
}

/* section.auth-panel eleva a especificidade acima de
   .layout.sidebar-collapsed .sidebar-account-row .auth-panel
   (style.css, carregado por último), que também define padding. */
.layout.sidebar-collapsed .sidebar-account-row section.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 8px 0;
  border: none;
  background: transparent;
  overflow: hidden;
}

.layout.sidebar-collapsed .auth-user-details,
.layout.sidebar-collapsed #auth-status { display: none !important; }

.layout.sidebar-collapsed .auth-user-info {
  justify-content: center;
  overflow: hidden;
}

.layout.sidebar-collapsed #auth-login,
.layout.sidebar-collapsed #auth-logout {
  width: 32px;
  min-height: 32px;
  height: 32px;
  flex: 0 0 auto;
  padding: 0;
  margin: 0;
  justify-content: center;
  overflow: hidden;
}

/* Settings no rail recolhido: só o ícone, centralizado. */
.layout.sidebar-collapsed #settings-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  margin: 0 auto;
  overflow: hidden;
}

.layout.sidebar-collapsed #settings-btn span:not(.icon) { display: none !important; }


/* —— Project folders and project-owned chat history —— */
.projects-sidebar-tree {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px 2px;
}
.projects-tree-loading,
.projects-tree-empty {
  padding: 5px 8px;
  color: var(--color-text-faint);
  font-size: 0.72rem;
  line-height: 1.45;
}
.project-tree-group {
  min-width: 0;
}
.project-tree-heading {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.project-tree-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.project-tree-toggle:hover,
.project-tree-group.active > .project-tree-heading .project-tree-toggle {
  border-color: var(--color-accent-line);
  background: var(--color-accent-softer);
  color: var(--color-text);
}
.project-tree-icon {
  flex: 0 0 auto;
  width: 19px;
  text-align: center;
  font-size: 0.95rem;
}
.project-tree-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-tree-count {
  margin-left: auto;
  color: var(--color-text-faint);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}
.project-tree-add {
  display: grid;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.project-tree-add:hover {
  border-color: var(--color-accent-line);
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.project-tree-chats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 5px 16px;
  padding: 3px 0 3px 10px;
  border-left: 1px solid var(--color-border);
}
.project-tree-chat {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 0.74rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.project-tree-chat:hover,
.project-tree-chat.active {
  background: var(--color-surface-hover);
  color: var(--color-text);
}
.project-tree-chat.active {
  border-color: var(--color-accent-line);
}
.project-tree-chat.archived {
  opacity: 0.58;
}
.project-tree-chat-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-tree-empty {
  padding: 5px 8px 7px;
  color: var(--color-text-faint);
  font-size: 0.7rem;
}
.layout.sidebar-collapsed .projects-sidebar-tree {
  display: none;
}

.project-form-field {
  margin-bottom: 14px;
}
.project-form-field > label,
.project-field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.project-icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.project-icon-option {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-translucent);
  font-size: 1.1rem;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, transform 0.14s;
}
.project-icon-option:hover {
  border-color: var(--color-accent-line);
  transform: translateY(-1px);
}
.project-icon-option.selected,
.project-icon-option[aria-pressed="true"] {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  box-shadow: 0 0 0 2px var(--color-accent-softer);
}
.project-memory-hint {
  margin: 6px 0 0;
  color: var(--color-text-faint);
  font-size: 0.73rem;
  line-height: 1.45;
}
.project-list-icon {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  margin-right: 9px;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--color-surface-translucent);
  font-size: 1rem;
}


/* Automatic conversation-retention warning (shown seven days before cleanup). */
.conv-preview-retention {
  color: var(--color-warning, #d6a84f);
  font-weight: 600;
}
