/* SuperAgents — superagents-modals.css
 * Module : modals
 * Généré depuis index.html
 */

/* ── Agent Catalog Search Modal ───────── */
.catalog-modal-wrap {
  background: var(--zen-surface); border-radius: 16px;
  width: 540px; max-width: 95vw; max-height: 80vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
.catalog-header { padding: 18px 22px; border-bottom: 1px solid var(--zen-border); }
.catalog-header h3 { font-size: 17px; font-weight: 800; margin: 0 0 10px; }
.catalog-search-bar {
  display: flex; gap: 8px; align-items: center;
}
.catalog-search-bar input {
  flex: 1; padding: 10px 14px; border-radius: var(--radius-md);
  border: 1px solid var(--zen-border); background: var(--zen-bg);
  color: var(--zen-text); font-size: 14px; outline: none;
}
.catalog-search-bar input:focus { border-color: var(--zen-primary); }
.catalog-search-bar button {
  padding: 10px 18px; border-radius: var(--radius-md); border: none;
  background: var(--zen-primary); color: white; font-weight: 700;
  font-size: 13px; cursor: pointer;
}
.catalog-search-bar button:disabled { opacity: 0.5; cursor: not-allowed; }
.catalog-results {
  flex: 1; overflow-y: auto; padding: 12px 22px;
  display: flex; flex-direction: column; gap: 8px; min-height: 120px;
}
.catalog-result-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: var(--radius-md); border: 1px solid var(--zen-border);
  cursor: pointer; transition: var(--transition);
}
.catalog-result-item:hover { border-color: var(--zen-primary); background: rgba(45,212,168,0.04); }
.catalog-result-item.already-added { opacity: 0.5; cursor: default; border-style: dashed; }
.catalog-result-icon { font-size: 28px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--zen-bg); flex-shrink: 0; }
.catalog-result-info { flex: 1; min-width: 0; }
.catalog-result-info h4 { font-size: 14px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catalog-result-info .cat-sub { font-size: 11.5px; color: var(--zen-text-muted); margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catalog-result-info .cat-id { font-size: 10.5px; color: var(--zen-text-muted); font-family: 'JetBrains Mono', monospace; opacity: 0.6; }
.catalog-result-add { padding: 6px 14px; border-radius: 8px; border: none; background: var(--zen-primary); color: white; font-size: 12px; font-weight: 700; cursor: pointer; flex-shrink: 0; }
.catalog-result-add:hover { filter: brightness(1.1); }
.catalog-status { padding: 30px; text-align: center; color: var(--zen-text-muted); font-size: 13px; }
.catalog-status .spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--zen-border); border-top-color: var(--zen-primary); border-radius: 50%; animation: spin 0.6s linear infinite; margin-bottom: 8px; }

.docs-rag-info {
  margin: 12px 24px; padding: 14px 16px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(45,212,168,0.06), rgba(54,184,224,0.06));
  border: 1px solid rgba(45,212,168,0.15); display: flex; gap: 10px; align-items: flex-start;
}
.docs-rag-info span { font-size: 22px; flex-shrink: 0; }
.docs-rag-info p { font-size: 11.5px; color: var(--zen-text-secondary); margin: 0; line-height: 1.5; }

/* ── File Preview ──────────────────────── */
.doc-item.previewable { cursor: pointer; }
.doc-item.previewable:hover { background: rgba(45,212,168,0.06); }

.doc-preview-wrap {
  background: var(--zen-surface); border-radius: 16px;
  min-width: 400px; max-width: 90vw; width: 800px;
  max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: 0 12px 50px rgba(0,0,0,0.3); overflow: hidden;
}
.doc-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--zen-border);
  background: var(--zen-bg);
}
.doc-preview-title { font-size: 15px; font-weight: 700; }
.doc-preview-content { flex: 1; overflow: auto; padding: 0; }
.doc-preview-iframe { width: 100%; height: 70vh; border: none; }
.doc-preview-img { max-width: 100%; max-height: 70vh; display: block; margin: 20px auto; }
.doc-preview-text {
  font-family: 'DM Sans', monospace; font-size: 13px; line-height: 1.6;
  padding: 16px 20px; margin: 0; white-space: pre-wrap; word-break: break-word;
  max-height: 70vh; overflow: auto; background: #f8f9fa;
}
.doc-preview-info {
  font-size: 10.5px; color: var(--zen-text-muted);
  padding: 6px 16px; text-align: right; border-top: 1px solid var(--zen-border);
}
.doc-preview-sheet-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--zen-border);
  overflow-x: auto; background: var(--zen-bg);
}
.doc-preview-sheet-tab {
  padding: 8px 16px; border: none; background: none;
  font-size: 11.5px; font-weight: 600; color: var(--zen-text-muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: var(--transition); white-space: nowrap;
}
.doc-preview-sheet-tab:hover { color: var(--zen-text); }
.doc-preview-sheet-tab.active {
  color: var(--zen-primary-dark); border-bottom-color: var(--zen-primary);
}

/* Table rendering */
.doc-preview-table-wrap { overflow: auto; max-height: 65vh; }
.doc-preview-table {
  width: 100%; border-collapse: collapse; font-size: 11.5px;
}
.doc-preview-table th {
  background: var(--zen-bg); color: var(--zen-text);
  font-weight: 700; position: sticky; top: 0; z-index: 1;
}
.doc-preview-table th, .doc-preview-table td {
  padding: 6px 10px; border: 1px solid var(--zen-border);
  text-align: left; white-space: nowrap; max-width: 300px;
  overflow: hidden; text-overflow: ellipsis;
}
.doc-preview-table tr:nth-child(even) td { background: rgba(0,0,0,0.015); }
.doc-preview-table tr:hover td { background: rgba(45,212,168,0.06); }

/* Inline spreadsheet in chat bubble */
.inline-spreadsheet {
  margin: 8px 0; border: 1px solid var(--zen-border); border-radius: 8px; overflow: hidden;
}
.inline-spreadsheet-title {
  font-size: 12px; font-weight: 700; padding: 6px 10px;
  background: var(--zen-bg); border-bottom: 1px solid var(--zen-border);
}
.inline-spreadsheet .doc-preview-table-wrap { max-height: 300px; }
.inline-spreadsheet .doc-preview-table { font-size: 10.5px; }
.inline-spreadsheet .doc-preview-table th, .inline-spreadsheet .doc-preview-table td { padding: 4px 8px; }
.inline-spreadsheet .doc-preview-info { font-size: 9.5px; padding: 4px 8px; }

/* RAG picker in create modal */
.rag-picker {
  max-height: 200px; overflow-y: auto; border: 1px solid var(--zen-border);
  border-radius: var(--radius-md); padding: 6px;
}
.rag-picker-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: 8px; cursor: pointer; transition: var(--transition);
  font-size: 13px; color: var(--zen-text);
}
.rag-picker-item:hover { background: var(--zen-bg); }
.rag-picker-item.selected { background: rgba(45,212,168,0.1); border: 1px solid var(--zen-primary-light); }
.rag-picker-item input[type="checkbox"] { accent-color: var(--zen-primary); }
.rag-picker-empty { padding: 16px; text-align: center; color: var(--zen-text-muted); font-size: 11.5px; }

/* Doc indexed status badge */
.doc-status-badge {
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px;
}
.doc-status-badge.indexed { background: #D1FAE5; color: #059669; }
.doc-status-badge.processing { background: #FEF3C7; color: #92400E; }

/* ── ATTACH MODAL ──────────────────────── */
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.attach-modal {
  background: var(--zen-surface); border-radius: 18px; width: 560px; max-width: 95vw;
  height: 520px; max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3); animation: slideUp 0.25s ease;
}
.attach-tabs { display: flex; border-bottom: 1px solid var(--zen-border); padding: 0 20px; }
.attach-tab {
  padding: 10px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; background: none; color: var(--zen-text-muted);
  border-bottom: 2px solid transparent; transition: var(--transition);
}
.attach-tab:hover { color: var(--zen-text); }
.attach-tab.active { color: var(--zen-primary-dark); border-bottom-color: var(--zen-primary); }
.attach-panels { flex: 1; overflow: hidden; min-height: 0; display: flex; flex-direction: column; }
.attach-panel { display: none; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
.attach-panel.active { display: flex; }
.attach-upload-zone {
  margin: 16px 20px; padding: 30px; border: 2px dashed var(--zen-border);
  border-radius: 14px; text-align: center; cursor: pointer;
  transition: var(--transition); color: var(--zen-text-muted);
}
.attach-upload-zone:hover { border-color: var(--zen-primary); background: rgba(45,212,168,0.04); }
.attach-upload-zone svg { margin-bottom: 8px; opacity: 0.4; }
.attach-upload-zone p { font-size: 14px; margin: 4px 0; }
.attach-upload-zone span { font-size: 12px; }
.attach-selected { padding: 0 20px 10px; display: flex; flex-direction: column; gap: 4px; max-height: 140px; overflow-y: auto; }
.attach-selected-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: var(--zen-bg); border-radius: 8px; font-size: 13px;
}
.attach-selected-item .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.attach-selected-item .size { color: var(--zen-text-muted); font-size: 11px; flex-shrink: 0; }
.attach-selected-item .remove { background: none; border: none; cursor: pointer; color: var(--zen-text-muted); font-size: 15px; padding: 0 4px; }
.attach-selected-item .remove:hover { color: var(--zen-danger); }
.attach-browser-bar { padding: 10px 20px 4px; }
.attach-breadcrumb { display: flex; align-items: center; gap: 2px; font-size: 13px; flex-wrap: wrap; }
.attach-breadcrumb-item { padding: 3px 8px; border-radius: 6px; cursor: pointer; color: var(--zen-text-secondary); font-weight: 500; }
.attach-breadcrumb-item:hover { background: var(--zen-bg); color: var(--zen-primary-dark); }
.attach-breadcrumb-sep { color: var(--zen-border); font-size: 11px; }
.attach-file-list { flex: 1; overflow-y: auto; padding: 6px 20px 16px; display: flex; flex-direction: column; gap: 3px; }
.attach-file-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer; transition: var(--transition); font-size: 12.5px;
}
.attach-file-item:hover { background: var(--zen-surface-hover); }
.attach-file-item.selected { background: rgba(45,212,168,0.1); outline: 2px solid var(--zen-primary); }
.attach-file-item .icon {
  width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.attach-file-item .icon.folder { background: #FEF3C7; }
.attach-file-item .icon.file { background: #EFF6FF; }
.attach-file-item .info { flex: 1; min-width: 0; }
.attach-file-item .info .fname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-file-item .info .fmeta { font-size: 10.5px; color: var(--zen-text-muted); }
.attach-file-item .check { font-size: 18px; flex-shrink: 0; }
.attach-footer {
  padding: 12px 20px; border-top: 1px solid var(--zen-border);
  display: flex; align-items: center; justify-content: space-between;
}
.attach-footer > div { display: flex; gap: 8px; }
.attach-count { font-size: 13px; color: var(--zen-text-muted); font-weight: 500; }

/* ── CREATE MODAL ───────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(26,46,53,0.5);
  backdrop-filter: blur(8px); z-index: 100; display: none;
  align-items: center; justify-content: center; animation: fadeIn 0.3s;
}
.modal-overlay.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.create-modal {
  background: var(--zen-surface); border-radius: var(--radius-xl);
  width: 700px; max-height: 86vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: modalUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.create-modal::-webkit-scrollbar { width: 5px; }
.create-modal::-webkit-scrollbar-thumb { background: var(--zen-border); border-radius: 5px; }

.modal-header {
  padding: 24px 28px 0; display: flex;
  align-items: center; justify-content: space-between;
}
.modal-header h2 { font-size: 22px; font-weight: 800; }
.modal-close {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--zen-border); background: var(--zen-surface);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--zen-text-secondary); transition: var(--transition);
}
.modal-close:hover { background: var(--zen-bg); border-color: var(--zen-danger); color: var(--zen-danger); }

.modal-body { padding: 24px 28px 28px; }
.form-section { margin-bottom: 24px; }
.form-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--zen-text-muted); margin-bottom: 12px;
}
.form-row { display: flex; gap: 14px; margin-bottom: 14px; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--zen-text-secondary); }
.form-group input, .form-group textarea, .form-group select {
  padding: 9px 12px; border: 1.5px solid var(--zen-border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 14px;
  color: var(--zen-text); background: var(--zen-surface);
  transition: var(--transition); outline: none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--zen-primary); box-shadow: 0 0 0 3px var(--zen-shadow);
}
.form-group textarea { min-height: 70px; resize: vertical; line-height: 1.5; }

.avatar-section { display: flex; align-items: center; gap: 18px; }
.avatar-preview {
  width: 80px; height: 80px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 35px; font-weight: 800; color: #fff;
  border: 3px solid var(--zen-border); overflow: hidden; position: relative;
}
.avatar-preview img, .avatar-preview svg { width: 100%; height: 100%; object-fit: cover; }
.avatar-controls { display: flex; flex-direction: column; gap: 7px; }
.btn-avatar {
  padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--zen-border); background: var(--zen-surface);
  font-size: 11.5px; font-weight: 600; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; gap: 5px; color: var(--zen-text-secondary);
}
.btn-avatar:hover { border-color: var(--zen-primary); color: var(--zen-primary-dark); }
.btn-avatar.generating { pointer-events: none; opacity: 0.6; }

.agents-picker {
  display: flex; flex-wrap: wrap; gap: 6px; max-height: 160px;
  overflow-y: auto; padding: 7px; background: var(--zen-bg);
  border-radius: var(--radius-md); border: 1px solid var(--zen-border);
}
.agents-picker::-webkit-scrollbar { width: 3px; }
.agents-picker::-webkit-scrollbar-thumb { background: var(--zen-border); border-radius: 3px; }
.agent-chip {
  padding: 5px 10px; border-radius: 16px; border: 1.5px solid var(--zen-border);
  background: var(--zen-surface); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: var(--transition); white-space: nowrap;
  color: var(--zen-text-secondary); user-select: none;
}
.agent-chip:hover { border-color: var(--zen-primary-light); }
.agent-chip.selected {
  background: linear-gradient(135deg, var(--zen-primary), var(--zen-primary-dark));
  border-color: var(--zen-primary); color: #fff; font-weight: 600;
}
.agent-chip .chip-remove {
  margin-left: 4px; font-size: 10px; opacity: 0.7; cursor: pointer;
}
.agent-chip .chip-remove:hover { opacity: 1; }
.catalog-search-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 10001;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.catalog-search-panel {
  background: var(--zen-surface); border-radius: var(--radius-lg); width: 520px; max-height: 70vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.catalog-search-header {
  padding: 16px 20px; border-bottom: 1px solid var(--zen-border);
  display: flex; align-items: center; gap: 10px;
}
.catalog-search-header input {
  flex: 1; padding: 9px 14px; border-radius: 8px; border: 1.5px solid var(--zen-border);
  background: var(--zen-bg); color: var(--zen-text); font-size: 14px; outline: none;
}
.catalog-search-header input:focus { border-color: var(--zen-primary); }
.catalog-search-results {
  flex: 1; overflow-y: auto; padding: 10px;
}
.catalog-agent-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 10px; cursor: pointer; transition: var(--transition);
}
.catalog-agent-item:hover { background: var(--zen-bg); }
.catalog-agent-item.already-added { opacity: 0.4; pointer-events: none; }
.catalog-agent-info { flex: 1; min-width: 0; }
.catalog-agent-name { font-weight: 600; font-size: 13px; color: var(--zen-text); }
.catalog-agent-id { font-size: 11px; color: var(--zen-text-muted); font-family: monospace; }
.catalog-agent-tags { font-size: 11px; color: var(--zen-text-secondary); margin-top: 2px; }
.catalog-agent-cat {
  padding: 3px 8px; border-radius: 10px; font-size: 10px; font-weight: 600;
  background: var(--zen-bg); color: var(--zen-text-secondary); text-transform: uppercase;
  white-space: nowrap;
}
.catalog-agent-add {
  padding: 4px 12px; border-radius: 8px; border: 1.5px solid var(--zen-primary);
  background: transparent; color: var(--zen-primary); font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.catalog-agent-add:hover { background: var(--zen-primary); color: #fff; }
.catalog-status { padding: 30px; text-align: center; color: var(--zen-text-muted); font-size: 13px; }

.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 10px; border-top: 1px solid var(--zen-border);
}
.btn-cancel {
  padding: 10px 20px; border-radius: var(--radius-md);
  border: 1.5px solid var(--zen-border); background: var(--zen-surface);
  font-weight: 600; font-size: 14px; cursor: pointer;
  color: var(--zen-text-secondary); transition: var(--transition);
}
.btn-cancel:hover { background: var(--zen-bg); }
.btn-create {
  padding: 10px 24px; border-radius: var(--radius-md); border: none;
  background: linear-gradient(135deg, var(--zen-primary), var(--zen-primary-dark));
  color: #fff; font-weight: 700; font-size: 14px; cursor: pointer;
  transition: var(--transition); box-shadow: 0 4px 14px var(--zen-shadow-strong);
}
.btn-create:hover { transform: translateY(-1px); box-shadow: 0 6px 22px var(--zen-shadow-strong); }

/* ── CONTEXT MENU ───────────────────────── */
.context-menu {
  position: absolute; background: var(--zen-surface);
  border: 1px solid var(--zen-border); border-radius: var(--radius-md);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12); z-index: 200;
  min-width: 150px; padding: 5px; display: none;
}
.context-menu.show { display: block; }
.context-menu-item {
  padding: 7px 12px; font-size: 13px; font-weight: 500;
  cursor: pointer; border-radius: var(--radius-sm); transition: var(--transition);
  color: var(--zen-text-secondary);
}
.context-menu-item:hover { background: var(--zen-bg); color: var(--zen-text); }
.context-menu-item.danger { color: var(--zen-danger); }
.context-menu-item.danger:hover { background: #FEF0F0; }

.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 50px; color: var(--zen-text-muted); text-align: center;
}
.empty-state svg { margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; color: var(--zen-text-secondary); }
.empty-state p { font-size: 14px; max-width: 300px; line-height: 1.6; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--zen-border); border-top-color: var(--zen-primary);
  border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

#file-input { display: none; }
#chat-file-input { display: none; }

/* ── FILE UPLOAD UI ─────────────────────── */
.btn-attach {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: transparent; color: var(--zen-text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition); flex-shrink: 0;
}
.btn-attach:hover { color: var(--zen-primary-dark); background: var(--zen-bg); }

.attached-files-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 24px; margin-bottom: 6px;
  max-height: 140px; overflow-y: auto;
}
.attached-files-bar:empty { display: none; }

.file-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px 6px 8px; border-radius: 10px;
  background: var(--zen-surface); border: 1px solid var(--zen-border);
  font-size: 11.5px; font-weight: 500; color: var(--zen-text-secondary);
  max-width: 220px; animation: msgSlide 0.25s ease;
}
.file-chip-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.file-chip-icon.pdf  { background: #FEE2E2; color: #DC2626; }
.file-chip-icon.img  { background: #DBEAFE; color: #2563EB; }
.file-chip-icon.doc  { background: #E0E7FF; color: #4F46E5; }
.file-chip-icon.txt  { background: #F0FDF4; color: #16A34A; }
.file-chip-icon.other{ background: var(--zen-bg); color: var(--zen-text-muted); }

.file-chip-info { flex: 1; min-width: 0; }
.file-chip-name {
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}
.file-chip-size { font-size: 11px; color: var(--zen-text-muted); }

.file-chip-remove {
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: transparent; color: var(--zen-text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: var(--transition); flex-shrink: 0;
  line-height: 1;
}
.file-chip-remove:hover { background: #FEE2E2; color: var(--zen-danger); }

.file-chip-thumb {
  width: 28px; height: 28px; border-radius: 6px;
  object-fit: cover; flex-shrink: 0;
}

/* Drag & drop overlay */
.chat-drop-overlay {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(45,212,168,0.08); border: 3px dashed var(--zen-primary);
  border-radius: var(--radius-lg); display: none;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.chat-drop-overlay.active { display: flex; }
.chat-drop-overlay span {
  background: var(--zen-surface); padding: 12px 24px; border-radius: var(--radius-md);
  font-weight: 700; font-size: 15px; color: var(--zen-primary-dark);
  box-shadow: 0 4px 20px var(--zen-shadow);
}

/* File indicator in messages */
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.msg-file-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 600;
  background: rgba(0,0,0,0.05); color: var(--zen-text-secondary);
}
.message.user .msg-file-badge { background: rgba(255,255,255,0.2); color: #fff; }
.msg-file-badge.previewable { cursor: pointer; }
.msg-file-badge.previewable:hover { background: rgba(45,212,168,0.3); transform: translateY(-1px); }

/* Agent links in chat bubbles */
.message-bubble a.agent-link {
  color: var(--zen-primary-dark); font-weight: 600; text-decoration: none;
  border-bottom: 1.5px solid var(--zen-primary-light);
  padding-bottom: 0.5px; transition: var(--transition);
}
.message-bubble a.agent-link:hover {
  color: var(--zen-primary); border-bottom-color: var(--zen-primary);
  background: rgba(45,212,168,0.08); border-radius: 3px;
  padding: 0 3px; margin: 0 -3px;
}
.message-bubble a.agent-link::after {
  content: '↗'; font-size: 11px; margin-left: 2px;
  display: inline-block; vertical-align: super; opacity: 0.5;
}
.message-bubble a.agent-link:hover::after { opacity: 1; }
.message.user .message-bubble a.agent-link {
  color: var(--zen-primary-dark); border-bottom-color: rgba(45,212,168,0.4);
}
.message.user .message-bubble a.agent-link:hover {
  border-bottom-color: var(--zen-primary); background: rgba(45,212,168,0.08);
}

/* ── MEDIA PREVIEWS IN CHAT ─────────────── */
.media-preview {
  display: inline-block; margin: 8px 0 4px; max-width: 100%;
}

/* Image thumbnail */
.media-preview-img {
  max-width: 280px; max-height: 200px; border-radius: 10px;
  object-fit: cover; cursor: pointer; transition: var(--transition);
  border: 2px solid var(--zen-border); display: block;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.media-preview-img:hover {
  border-color: var(--zen-primary); transform: scale(1.02);
  box-shadow: 0 4px 18px var(--zen-shadow-strong);
}

/* Audio inline player */
.media-audio-card {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #F0FDF9, #E0F7F0);
  border: 1.5px solid var(--zen-border); border-radius: 12px;
  padding: 10px 14px; max-width: 340px; cursor: pointer;
  transition: var(--transition);
}
.media-audio-card:hover {
  border-color: var(--zen-primary); box-shadow: 0 4px 16px var(--zen-shadow);
}
.media-audio-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--zen-primary), var(--zen-primary-dark));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff; font-size: 20px;
}
.media-audio-info { flex: 1; min-width: 0; }
.media-audio-name {
  font-size: 13px; font-weight: 600; color: var(--zen-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.media-audio-hint { font-size: 11px; color: var(--zen-text-muted); }
.message.user .media-audio-card {
  background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3);
}
.message.user .media-audio-name { color: #fff; }
.message.user .media-audio-hint { color: rgba(255,255,255,0.6); }

/* ── FULLSCREEN MEDIA MODAL ─────────────── */
.media-modal {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10,20,25,0.88); backdrop-filter: blur(12px);
  display: none; align-items: center; justify-content: center;
  flex-direction: column; padding: 24px;
  animation: fadeIn 0.25s;
}
.media-modal.active { display: flex; }

.media-modal-close {
  position: absolute; top: 18px; right: 18px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 24px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); z-index: 10;
}
.media-modal-close:hover { background: rgba(255,255,255,0.25); }

.media-modal-body {
  max-width: 92vw; max-height: 78vh; display: flex;
  flex-direction: column; align-items: center; gap: 16px;
}

.media-modal-body img {
  max-width: 92vw; max-height: 70vh; object-fit: contain;
  border-radius: 12px; box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

.media-modal-audio-wrap {
  background: var(--zen-surface); border-radius: 16px;
  padding: 28px 32px; min-width: 340px; max-width: 500px;
  box-shadow: 0 12px 50px rgba(0,0,0,0.3);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.media-modal-audio-wrap .audio-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--zen-primary), var(--zen-gradient-end));
  display: flex; align-items: center; justify-content: center;
  font-size: 31px; color: #fff;
}
.media-modal-audio-wrap .audio-title {
  font-size: 17px; font-weight: 700; color: var(--zen-text); text-align: center;
  word-break: break-word;
}
.media-modal-audio-wrap audio {
  width: 100%; border-radius: 8px; outline: none;
}

.media-modal-actions {
  display: flex; gap: 10px; margin-top: 4px;
}
.media-modal-btn {
  padding: 10px 20px; border-radius: var(--radius-md); border: none;
  font-weight: 700; font-size: 14px; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.media-modal-btn.primary {
  background: linear-gradient(135deg, var(--zen-primary), var(--zen-primary-dark));
  color: #fff; box-shadow: 0 4px 14px var(--zen-shadow-strong);
}
.media-modal-btn.primary:hover { transform: translateY(-1px); }
.media-modal-btn.secondary {
  background: rgba(255,255,255,0.12); color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
}
.media-modal-btn.secondary:hover { background: rgba(255,255,255,0.2); }

/* ── MEDIA LIBRARY (Images & Podcasts) ──── */
.media-lib-header {
  padding: 20px 24px 14px; background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px); border-bottom: 1px solid var(--zen-border);
}
.media-lib-title-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
}
.media-lib-title-row h2 { font-size: 20px; font-weight: 800; }
.media-lib-count {
  font-size: 12px; font-weight: 700; color: var(--zen-primary-dark);
  background: var(--zen-bg); padding: 3px 10px; border-radius: 10px;
}
.media-lib-filters { display: flex; gap: 6px; flex-wrap: wrap; }

.media-lib-content {
  flex: 1; overflow-y: auto; padding: 20px 24px;
}
.media-lib-content::-webkit-scrollbar { width: 5px; }
.media-lib-content::-webkit-scrollbar-thumb { background: var(--zen-border); border-radius: 5px; }

/* Image gallery grid */
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.gallery-card {
  background: var(--zen-surface); border: 1px solid var(--zen-border);
  border-radius: var(--radius-md); overflow: hidden;
  transition: var(--transition); position: relative;
}
.gallery-card:hover {
  border-color: var(--zen-primary);
  box-shadow: 0 6px 20px var(--zen-shadow);
  transform: translateY(-2px);
}
.gallery-card-img {
  width: 100%; height: 140px; object-fit: cover; cursor: pointer;
  display: block; background: var(--zen-bg);
}
.gallery-card-body { padding: 10px 12px; }
.gallery-card-title {
  font-size: 11.5px; font-weight: 600; color: var(--zen-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.gallery-card-meta {
  font-size: 11px; color: var(--zen-text-muted); display: flex;
  align-items: center; gap: 6px; margin-bottom: 6px;
}
.gallery-card-agent {
  font-size: 9.5px; font-weight: 600; color: var(--zen-primary-dark);
  background: rgba(45,212,168,0.1); padding: 1px 6px; border-radius: 6px;
}
.gallery-card-actions {
  display: flex; gap: 4px;
}
.gallery-btn {
  padding: 4px 8px; border-radius: 6px; border: 1px solid var(--zen-border);
  background: var(--zen-surface); font-size: 11px; cursor: pointer;
  transition: var(--transition); color: var(--zen-text-muted);
}
.gallery-btn:hover { border-color: var(--zen-primary); color: var(--zen-primary-dark); }
.gallery-btn.danger:hover { border-color: var(--zen-danger); color: var(--zen-danger); }
.gallery-card-tag {
  display: inline-block; padding: 1px 6px; border-radius: 6px;
  font-size: 9.5px; font-weight: 600; margin-right: 3px;
  background: #FEF3C7; color: #92400E;
}

/* Podcast list */
.podcast-list { display: flex; flex-direction: column; gap: 10px; }

.podcast-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--zen-surface); border: 1px solid var(--zen-border);
  border-radius: var(--radius-md); padding: 14px 16px;
  transition: var(--transition); position: relative;
}
.podcast-card:hover {
  border-color: var(--zen-primary);
  box-shadow: 0 4px 16px var(--zen-shadow);
}
.podcast-play-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--zen-primary), var(--zen-primary-dark));
  color: #fff; font-size: 20px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.podcast-play-btn:hover { transform: scale(1.08); box-shadow: 0 4px 14px var(--zen-shadow-strong); }
.podcast-info { flex: 1; min-width: 0; }
.podcast-title {
  font-size: 14px; font-weight: 700; color: var(--zen-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 2px;
}
.podcast-subtitle {
  font-size: 12px; color: var(--zen-text-muted);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.podcast-actions { display: flex; gap: 5px; flex-shrink: 0; }

@media (max-width: 900px) {
  .sidebar { width: 64px; min-width: 64px; }
  .sidebar-header, .sidebar-tagline, .sidebar-section-title,
  .nav-item-info, .btn-new-agent span, .user-info-small,
  .nav-badge-manager { display: none; }

/* External nav link (Agents Zenbaia) */
a.nav-item-external {
  text-decoration: none !important; color: inherit;
  border-top: 1px solid var(--zen-border);
  margin-top: 4px; padding-top: 10px;
}
a.nav-item-external svg { color: var(--zen-primary-dark); }
a.nav-item-external .nav-item-role { color: var(--zen-text-muted); font-size: 11px; }
a.nav-item-external:hover {
  background: rgba(45,212,168,0.08);
}
@media (max-width: 900px) {
  a.nav-item-external { justify-content: center; padding: 10px; }
}
  .sidebar-header { padding: 10px; display: flex; justify-content: center; }
  .nav-item { justify-content: center; padding: 10px; }
  .btn-new-agent { padding: 10px; }
  .sidebar-footer { justify-content: center; }
  .team-grid { grid-template-columns: 1fr 1fr; }
}

