/* ============================================== */
/* --- AGENT IA — Chat Interface                --- */
/* ============================================== */

/* Header button */
.btn-ai {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.85);
    padding: 7px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-ai:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: rgba(255,255,255,0.4);
}

#ai-chat-view {
    display: flex;
    height: calc(100dvh - 180px);
    background: var(--chanv-blanc);
    position: relative;
}

/* --- Sidebar Toggle Button (visible on all screens) --- */
.ai-sidebar-toggle {
    position: fixed;
    top: 50%;
    left: 280px;
    transform: translateY(-50%);
    z-index: 101;
    width: 20px;
    height: 48px;
    border: none;
    border-radius: 0 8px 8px 0;
    background: var(--chanv-terre);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: left 0.3s ease, background 0.2s;
    padding: 0;
}

.ai-sidebar-toggle:hover {
    background: var(--chanv-beige);
    color: var(--chanv-terre);
}

.ai-sidebar-toggle .toggle-arrow {
    transition: transform 0.3s ease;
}

.ai-sidebar.collapsed ~ .ai-chat-main .ai-sidebar-toggle,
#ai-chat-view.sidebar-collapsed .ai-sidebar-toggle {
    left: 0;
}

#ai-chat-view.sidebar-collapsed .ai-sidebar-toggle .toggle-arrow {
    transform: rotate(180deg);
}

/* --- Sidebar --- */
.ai-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--chanv-terre);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.05);
    z-index: 100;
    transition: left 0.3s ease;
}

#ai-chat-view.sidebar-collapsed .ai-sidebar {
    left: -280px;
}

.ai-sidebar-header {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ai-sidebar-back {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    text-align: left;
}

.ai-sidebar-back:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.ai-sidebar-new {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    text-align: left;
}

.ai-sidebar-new:hover {
    background: rgba(255,255,255,0.25);
}

.ai-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.ai-sidebar-list::-webkit-scrollbar {
    width: 4px;
}

.ai-sidebar-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* Sidebar agent section (bottom) */
.ai-sidebar-agents {
    padding: 12px 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.ai-sidebar-agents-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ai-sidebar-agents-title {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ai-sidebar-agents-btns {
    display: flex;
    gap: 4px;
}

.ai-agent-quick-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}

.ai-agent-quick-btn:hover {
    background: rgba(255,255,255,0.15);
    color: white;
    border-color: var(--chanv-beige);
}

/* Agent pills grid */
.ai-agent-pills {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-agent-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    background: transparent;
}

.ai-agent-pill:hover {
    background: rgba(255,255,255,0.08);
}

.ai-agent-pill.active {
    background: rgba(201,168,118,0.15);
    border-color: var(--chanv-beige);
}

.ai-agent-pill-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    flex-shrink: 0;
}

.ai-agent-pill.active .ai-agent-pill-icon {
    background: rgba(201,168,118,0.25);
}

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

.ai-agent-pill-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-agent-pill-desc {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.ai-agent-pill.active .ai-agent-pill-name {
    color: var(--chanv-beige);
}

.ai-agent-pill-check {
    font-size: 12px;
    color: var(--chanv-beige);
    opacity: 0;
    transition: opacity 0.15s;
}

.ai-agent-pill.active .ai-agent-pill-check {
    opacity: 1;
}

/* Empty state */
.ai-agents-empty {
    padding: 12px;
    text-align: center;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    line-height: 1.5;
}

/* Team agents section */
.ai-agent-team-section {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.ai-agent-team-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    padding-left: 4px;
}

/* --- Sidebar "Mes documents" button --- */
.ai-sidebar-docs-btn-wrapper {
    padding: 6px 12px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.ai-sidebar-docs-btn {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px dashed rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.6);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    letter-spacing: 0.2px;
}
.ai-sidebar-docs-btn:hover {
    background: rgba(201,168,118,0.12);
    border-color: rgba(201,168,118,0.4);
    color: rgba(255,255,255,0.9);
}

/* --- Modal Gestion Fichiers GANDALF --- */
.gandalf-docs-modal {
    background: var(--card-bg, #1e1e1e);
    border: 1px solid var(--border-color, #333);
    border-radius: 18px;
    padding: 0;
    max-width: 640px;
    width: 94%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.gandalf-docs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.gandalf-docs-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #f0f0f0);
}
.gandalf-docs-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}
.gandalf-docs-close:hover { color: #ff6b6b; background: rgba(255,100,100,0.1); }
.gandalf-docs-hint {
    margin: 0;
    padding: 10px 24px;
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    line-height: 1.5;
}
.gandalf-docs-dropzone {
    margin: 0 20px 12px;
    padding: 24px;
    border: 2px dashed rgba(201,168,118,0.25);
    border-radius: 12px;
    background: rgba(201,168,118,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    transition: all 0.25s;
}
.gandalf-docs-dropzone.drag-over {
    border-color: var(--chanv-beige, #C9A876);
    background: rgba(201,168,118,0.12);
}
.gandalf-docs-drop-icon { font-size: 28px; opacity: 0.6; }
.gandalf-docs-upload-btn {
    padding: 8px 18px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
}
.gandalf-docs-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
    max-height: 320px;
}
.gandalf-docs-loading { text-align: center; padding: 20px; color: rgba(255,255,255,0.3); font-size: 13px; }
.gandalf-docs-empty { text-align: center; padding: 24px; color: rgba(255,255,255,0.3); font-size: 13px; line-height: 1.6; }

/* File row */
.gandalf-doc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.gandalf-doc-row:hover { background: rgba(255,255,255,0.04); }
.gandalf-doc-icon { font-size: 20px; flex-shrink: 0; }
.gandalf-doc-info { flex: 1; min-width: 0; }
.gandalf-doc-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #f0f0f0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gandalf-doc-meta {
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    margin-top: 2px;
}
.gandalf-doc-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.gandalf-doc-row:hover .gandalf-doc-actions { opacity: 1; }
.gandalf-doc-action {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.15s;
}
.gandalf-doc-action:hover { background: rgba(255,255,255,0.12); color: white; }
.gandalf-doc-action.delete:hover { background: rgba(255,100,100,0.15); color: #ff6b6b; }

/* Rename input inline */
.gandalf-doc-rename {
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid var(--chanv-beige, #C9A876);
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    color: var(--text-primary, #f0f0f0);
    font-family: inherit;
    outline: none;
    width: 100%;
}

.gandalf-docs-footer {
    padding: 12px 24px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    text-align: center;
}
.gandalf-docs-drive-link {
    font-size: 12px;
    color: var(--chanv-beige, #C9A876);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.gandalf-docs-drive-link:hover { opacity: 1; }

.ai-convo-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.ai-convo-item:hover {
    background: rgba(255,255,255,0.1);
}

.ai-convo-item.active {
    background: rgba(255,255,255,0.15);
}

.ai-convo-item.pinned {
    border-left: 2px solid var(--chanv-beige, #C9A876);
    padding-left: 10px;
}

.ai-convo-pin-icon {
    font-size: 11px;
    opacity: 0.7;
}

.ai-convo-title {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 24px;
}

.ai-sidebar-search {
    padding: 8px 12px 4px;
}

.ai-sidebar-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: white;
    font-family: inherit;
    font-size: 12px;
    outline: none;
    transition: var(--transition);
    box-sizing: border-box;
}

.ai-sidebar-search input::placeholder {
    color: rgba(255,255,255,0.35);
}

.ai-sidebar-search input:focus {
    border-color: var(--chanv-beige);
    background: rgba(255,255,255,0.1);
}

.ai-convo-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 3px;
}

.ai-convo-date {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

.ai-convo-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.ai-convo-item:hover .ai-convo-actions {
    opacity: 1;
}

.ai-convo-actions button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.ai-convo-actions button:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.ai-convo-actions button:last-child:hover {
    color: #ff6b6b;
}

.ai-convo-rename-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--chanv-beige);
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.ai-action-regen {
    border-color: var(--chanv-beige) !important;
    color: var(--chanv-terre) !important;
    font-weight: 700 !important;
}

/* --- Main Chat Area --- */
.ai-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: 280px;
    transition: margin-left 0.3s ease;
}

#ai-chat-view.sidebar-collapsed .ai-chat-main {
    margin-left: 0;
}

.ai-chat-header {
    padding: 12px 24px;
    border-bottom: 1px solid var(--chanv-fibre);
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    flex-shrink: 0;
}

.ai-model-select {
    padding: 8px 14px;
    border: 1px solid var(--chanv-fibre);
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    background: white;
    color: var(--chanv-terre);
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    min-width: 200px;
}

.ai-model-select:hover,
.ai-model-select:focus {
    border-color: var(--chanv-beige);
}

.ai-model-label {
    font-size: 12px;
    color: #999;
    font-weight: 500;
    white-space: nowrap;
}

.ai-share-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--chanv-fibre);
    color: var(--chanv-terre);
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

.ai-share-btn:hover {
    background: var(--chanv-beige);
    transform: scale(1.05);
}

/* Voice conversation mode button */
.ai-voice-mode-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--chanv-fibre);
    color: var(--chanv-terre);
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-voice-mode-btn:hover {
    background: var(--chanv-beige);
    transform: scale(1.05);
}

.ai-voice-mode-btn.ai-voice-mode-active {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border-color: #2ecc71;
    color: white;
    animation: ai-voice-mode-glow 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.3);
}

@keyframes ai-voice-mode-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(46, 204, 113, 0.3); }
    50% { box-shadow: 0 0 16px rgba(46, 204, 113, 0.5); }
}

.ai-voice-mode-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

@media (max-width: 768px) {
    .ai-voice-mode-label { display: none; }
}

.ai-active-agent-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #C9A876 0%, #E8D5B7 100%);
    color: #1a1a2e;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    margin-right: 4px;
}

.ai-active-agent-badge.hidden {
    display: none;
}

/* --- Messages Area --- */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 80px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: auto;
    scrollbar-color: rgba(107, 94, 71, 0.25) transparent;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 10px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(107, 94, 71, 0.25);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 94, 71, 0.4);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Welcome screen when no messages */
.ai-chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    gap: 12px;
    padding: 40px;
    text-align: center;
}

.ai-chat-welcome-icon {
    font-size: 48px;
    opacity: 0.5;
}

.ai-chat-welcome h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    color: var(--chanv-terre);
    font-weight: 600;
}

.ai-chat-welcome p {
    font-size: 14px;
    max-width: 400px;
    line-height: 1.5;
}

/* Suggested prompts */
.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    max-width: 520px;
    justify-content: center;
}

.ai-suggestion {
    padding: 10px 16px;
    border: 1px solid var(--chanv-fibre);
    border-radius: 12px;
    background: white;
    color: var(--chanv-terre);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    line-height: 1.4;
}

.ai-suggestion:hover {
    background: var(--chanv-beige);
    border-color: var(--chanv-beige);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Code blocks with Prism */
.ai-code-block {
    margin: 12px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
}

.ai-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: #2d2d2d;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ai-code-lang {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-code-copy {
    background: rgba(255,255,255,0.1);
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.ai-code-copy:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

.ai-code-block pre {
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    font-size: 13px !important;
    max-height: 400px;
    overflow: auto;
}

/* Feedback buttons */
.ai-feedback-btn {
    opacity: 0.5;
    transition: all 0.15s !important;
}

.ai-feedback-btn:hover {
    opacity: 1 !important;
}

.ai-feedback-btn.active {
    opacity: 1;
    background: var(--chanv-beige) !important;
    border-color: var(--chanv-beige) !important;
}

/* --- Markdown elements in AI messages --- */

/* Tables */
.ai-table-wrap {
    overflow-x: auto;
    margin: 12px 0;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.1);
}

.ai-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ai-table th {
    background: var(--chanv-terre, #2D2A26);
    color: #F1EADA;
    padding: 8px 14px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    white-space: nowrap;
}

.ai-table td {
    padding: 8px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    vertical-align: top;
}

.ai-table tbody tr:nth-child(even) {
    background: rgba(200,173,127,0.05);
}

.ai-table tbody tr:hover {
    background: rgba(200,173,127,0.1);
}

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

.ai-table code {
    background: rgba(0,0,0,0.06);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
}

/* Blockquotes */
.ai-msg blockquote {
    margin: 10px 0;
    padding: 8px 16px;
    border-left: 3px solid var(--chanv-beige, #C9A876);
    background: rgba(200,173,127,0.06);
    border-radius: 0 8px 8px 0;
    color: inherit;
    font-style: italic;
}

/* Horizontal rules */
.ai-msg hr {
    border: none;
    border-top: 1px solid rgba(0,0,0,0.1);
    margin: 16px 0;
}

/* Ordered lists */
.ai-msg ol {
    margin: 8px 0;
    padding-left: 24px;
}

.ai-msg ol li {
    margin-bottom: 4px;
}

/* Unordered lists — improved spacing */
.ai-msg ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-msg ul li {
    margin-bottom: 4px;
}

/* Strikethrough */
.ai-msg del {
    text-decoration: line-through;
    opacity: 0.6;
}

/* Checkboxes */
.ai-msg .ai-checkbox {
    list-style: none;
    margin-left: -20px;
}

.ai-msg .ai-cb {
    margin-right: 4px;
    font-size: 15px;
}

.ai-msg .ai-checkbox.checked .ai-cb {
    color: #2ecc71;
}

/* Headings in messages */
.ai-msg h2, .ai-msg h3, .ai-msg h4, .ai-msg h5 {
    margin: 12px 0 6px 0;
    line-height: 1.3;
}

.ai-msg h2 { font-size: 1.2em; }
.ai-msg h3 { font-size: 1.1em; }
.ai-msg h4 { font-size: 1em; }
.ai-msg h5 { font-size: 0.95em; opacity: 0.8; }

/* Message bubbles */
.ai-msg {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
    position: relative;
}

.ai-msg-user {
    align-self: flex-end;
    background: var(--chanv-terre);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-msg-assistant {
    align-self: flex-start;
    background: var(--chanv-fibre);
    color: var(--chanv-terre);
    border-bottom-left-radius: 4px;
}

.ai-msg-model-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    opacity: 0.6;
}

.ai-msg-user .ai-msg-model-badge {
    color: rgba(255,255,255,0.6);
}

/* Streaming loader */
.ai-loader-wrap {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.ai-loader-hint {
    font-size: 13px;
    color: #6B5E47;
    font-style: italic;
}

.ai-msg-streaming {
    min-height: auto;
}

/* --- Input Area --- */
.ai-chat-input {
    padding: 12px 24px 20px;
    border-top: 1px solid var(--chanv-fibre);
    background: white;
    flex-shrink: 0;
    position: relative;
    margin-bottom: 4px;
}

.ai-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

/* File preview zone */
/* Drag & drop overlay */
.ai-chat-main {
    position: relative;
}

.ai-chat-main.ai-drag-over::after {
    content: '📎 Déposer les fichiers ici';
    position: absolute;
    inset: 0;
    background: rgba(99, 102, 241, 0.12);
    border: 2.5px dashed rgba(99, 102, 241, 0.5);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(99, 102, 241, 0.9);
    z-index: 100;
    pointer-events: none;
    backdrop-filter: blur(2px);
}

.ai-file-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 10px;
}

.ai-file-thumb {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--chanv-fibre);
}

.ai-file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-file-thumb-doc {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f7f5f0;
    gap: 2px;
}

.ai-file-thumb-doc span {
    font-size: 22px;
}

.ai-file-thumb-name {
    font-size: 8px;
    color: #666;
    text-align: center;
    max-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-file-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Attach button */
.ai-attach-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--chanv-fibre);
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.ai-attach-btn:hover {
    background: var(--chanv-fibre);
    transform: scale(1.05);
}

/* File chips in messages */
.ai-msg-files {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.ai-msg-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(201, 168, 118, 0.15);
    color: #6B5E47;
}

.ai-msg-user .ai-msg-file-chip {
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.9);
}

/* Generated images */
.ai-msg-generated-image {
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    max-width: 512px;
    position: relative;
}

.ai-msg-generated-image img {
    width: 100%;
    display: block;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ai-msg-generated-image img:hover {
    opacity: 0.85;
}

.ai-img-download-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.ai-msg-generated-image:hover .ai-img-download-btn {
    opacity: 1;
}

.ai-img-download-btn:hover {
    background: rgba(0,0,0,0.8);
}

.ai-img-open-btn {
    right: 52px;
}

.ai-img-provider-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.55);
    color: rgba(255,255,255,0.85);
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 500;
    letter-spacing: 0.3px;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

/* Generated PDFs */
.ai-msg-generated-pdf {
    margin-top: 10px;
}

.ai-pdf-download-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #E8D5B7 0%, #C9A876 100%);
    color: var(--chanv-terre, #2D2A26);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(201, 168, 118, 0.3);
}

.ai-pdf-download-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(201, 168, 118, 0.4);
    filter: brightness(1.05);
}

.ai-gen-img-btn {
    background: linear-gradient(135deg, #E8D5B7 0%, #C9A876 100%);
    border-color: #C9A876;
}

.ai-gen-img-btn:hover {
    background: linear-gradient(135deg, #C9A876 0%, #a88c5e 100%);
}

/* Message actions */
.ai-msg-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.ai-msg:hover .ai-msg-actions {
    opacity: 1;
}

.ai-msg-actions button {
    padding: 3px 10px;
    border: 1px solid var(--chanv-fibre);
    border-radius: 8px;
    background: white;
    color: #6B5E47;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.ai-msg-actions button:hover {
    background: var(--chanv-fibre);
    border-color: var(--chanv-beige);
}

/* TTS button states */
.ai-tts-btn {
    transition: all 0.2s ease;
}

.ai-tts-playing {
    background: rgba(46, 204, 113, 0.12) !important;
    border-color: #2ecc71 !important;
    color: #2ecc71 !important;
    animation: ai-tts-pulse 1.5s ease-in-out infinite;
}

.ai-tts-loading {
    opacity: 0.7;
    animation: ai-tts-spin 1s linear infinite;
}

.ai-tts-paused {
    background: rgba(230, 126, 34, 0.12) !important;
    border-color: #e67e22 !important;
    color: #e67e22 !important;
}

@keyframes ai-tts-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.3); }
    50% { box-shadow: 0 0 0 4px rgba(46, 204, 113, 0); }
}

@keyframes ai-tts-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ai-chat-textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--chanv-fibre);
    border-radius: 16px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    resize: none;
    min-height: 44px;
    max-height: 150px;
    transition: var(--transition);
}

.ai-chat-textarea:focus {
    border-color: var(--chanv-beige);
}

.ai-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--chanv-terre);
    color: white;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.ai-chat-send:hover {
    background: #1a1a1a;
    transform: scale(1.05);
}

.ai-chat-send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.ai-chat-send.ai-chat-stop {
    background: #e74c3c;
    font-size: 14px;
    animation: ai-stop-pulse 1.5s ease-in-out infinite;
}

.ai-chat-send.ai-chat-stop:hover {
    background: #c0392b;
    transform: scale(1.05);
}

@keyframes ai-stop-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
}

/* Voice input active state */
.ai-voice-active {
    background: #e74c3c !important;
    color: white !important;
    animation: ai-voice-pulse 1s ease-in-out infinite;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.25);
}

@keyframes ai-voice-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.25); }
    50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(231, 76, 60, 0.1); }
}

/* ===== Voice Recording Overlay ===== */
.ai-voice-overlay {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 6px;
    background: rgba(30, 27, 22, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(196, 169, 125, 0.2);
    padding: 16px;
    z-index: 50;
    animation: ai-voice-slide-up 0.25s ease-out;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
}

.ai-voice-overlay.hidden {
    display: none;
}

@keyframes ai-voice-slide-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Top bar: status + controls */
.ai-voice-overlay-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ai-voice-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #F1EADA;
}

.ai-voice-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e74c3c;
    animation: ai-voice-dot-blink 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

.ai-voice-dot.countdown {
    background: #e67e22;
    animation: ai-voice-dot-blink 0.6s ease-in-out infinite;
}

@keyframes ai-voice-dot-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.ai-voice-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-voice-lang {
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(196, 169, 125, 0.3);
    background: rgba(196, 169, 125, 0.1);
    color: #DDCBA4;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.ai-voice-lang:hover {
    background: rgba(196, 169, 125, 0.2);
    border-color: rgba(196, 169, 125, 0.5);
}

.ai-voice-cancel {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(231, 76, 60, 0.3);
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-voice-cancel:hover {
    background: rgba(231, 76, 60, 0.25);
    border-color: rgba(231, 76, 60, 0.5);
}

/* Audio level bar */
.ai-voice-level-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.ai-voice-level {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    border-radius: 2px;
    transition: width 0.08s linear;
}

/* Transcript area */
.ai-voice-transcript {
    min-height: 36px;
    max-height: 80px;
    overflow-y: auto;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.5;
    color: #F1EADA;
}

.ai-voice-placeholder {
    color: rgba(241, 234, 218, 0.35);
    font-style: italic;
}

.ai-voice-interim {
    color: rgba(241, 234, 218, 0.5);
    font-style: italic;
}

/* Footer: countdown + send */
.ai-voice-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-voice-countdown {
    font-size: 12px;
    font-weight: 600;
    color: #e67e22;
    animation: ai-voice-countdown-pulse 0.8s ease-in-out infinite;
}

.ai-voice-countdown.hidden {
    display: none;
}

@keyframes ai-voice-countdown-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ai-voice-send-now {
    padding: 6px 16px;
    border-radius: 10px;
    border: none;
    background: var(--chanv-terre, #282828);
    color: #F1EADA;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    margin-left: auto;
}

.ai-voice-send-now:hover {
    background: #3D3425;
    transform: scale(1.03);
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    #ai-chat-view {
        height: 100dvh;
        height: calc(100vh - 56px);
    }

    .ai-chat-main {
        margin-left: 0;
        height: 100%;
    }

    #ai-chat-view.sidebar-collapsed .ai-chat-main {
        margin-left: 0;
    }

    .ai-sidebar-toggle {
        display: none;
    }

    .ai-sidebar {
        left: -300px;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .ai-sidebar.open {
        left: 0;
    }

    .ai-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .ai-sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    /* Header — compact */
    .ai-chat-header {
        padding: 8px 12px;
        gap: 6px;
    }

    .ai-model-select {
        min-width: 0;
        max-width: 140px;
        font-size: 12px;
        padding: 6px 8px;
    }

    .ai-model-label {
        display: none;
    }

    .ai-active-agent-badge {
        font-size: 10px;
        padding: 2px 6px;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ai-share-btn {
        padding: 4px 8px;
        font-size: 12px;
    }

    .ai-voice-mode-btn {
        padding: 4px 8px;
        font-size: 14px;
    }

    .ai-mobile-menu-btn {
        display: flex !important;
    }

    /* Messages — proper spacing */
    .ai-chat-messages {
        padding: 12px 12px 16px;
        gap: 10px;
    }

    .ai-msg {
        max-width: 92%;
        padding: 10px 14px;
        font-size: 13px;
        line-height: 1.5;
    }

    .ai-msg-model-badge {
        font-size: 9px;
        margin-bottom: 4px;
    }

    .ai-msg-actions {
        opacity: 1;
        gap: 3px;
        flex-wrap: wrap;
    }

    .ai-msg-actions button {
        font-size: 10px;
        padding: 2px 8px;
    }

    /* Generated images — fit mobile */
    .ai-msg-generated-image {
        max-width: 100%;
    }

    .ai-img-download-btn {
        opacity: 1;
    }

    /* Input area — compact, safe bottom */
    .ai-chat-input {
        padding: 8px 10px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .ai-input-row {
        gap: 6px;
    }

    .ai-chat-textarea {
        padding: 10px 12px;
        font-size: 14px;
        min-height: 40px;
        border-radius: 14px;
    }

    .ai-attach-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .ai-chat-send {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    /* File previews — smaller */
    .ai-file-thumb {
        width: 52px;
        height: 52px;
    }

    /* Welcome screen — compact */
    .ai-chat-welcome {
        padding: 24px 16px;
        gap: 8px;
    }

    .ai-chat-welcome-icon {
        font-size: 36px;
    }

    .ai-chat-welcome h3 {
        font-size: 18px;
    }

    .ai-chat-welcome p {
        font-size: 13px;
    }

    .ai-suggestions {
        gap: 6px;
    }

    .ai-suggestion {
        font-size: 12px;
        padding: 8px 12px;
    }

    /* Code blocks — prevent overflow */
    .ai-code-block pre {
        font-size: 11px !important;
        max-height: 300px;
    }

    /* Voice mode controls */
    .ai-voice-recording-bar {
        padding: 8px 12px;
    }
}

@media (min-width: 769px) {
    .ai-mobile-menu-btn {
        display: none !important;
    }

    .ai-sidebar-overlay {
        display: none !important;
    }
}

/* Mobile menu button */
.ai-mobile-menu-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--chanv-fibre);
    background: white;
    cursor: pointer;
    font-size: 16px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-mobile-menu-btn:hover {
    background: var(--chanv-fibre);
}

/* ============================================== */
/* --- AGENT IA — Admin Panel                 --- */
/* ============================================== */

.ai-admin-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ai-stat-card {
    background: var(--chanv-fibre);
    border-radius: 12px;
    padding: 20px 24px;
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.ai-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--chanv-terre);
    font-family: 'Outfit', sans-serif;
}

.ai-stat-label {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-admin-section {
    margin-bottom: 28px;
}

.ai-admin-section h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--chanv-terre);
    margin-bottom: 12px;
}

.ai-admin-hint {
    font-size: 13px;
    color: #999;
    margin-top: 8px;
}

.ai-block-form {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.ai-block-input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid var(--chanv-fibre);
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.ai-block-input:focus {
    border-color: var(--chanv-beige);
}

.ai-blocked-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--chanv-fibre);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid var(--chanv-fibre);
    background: white;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.btn-sm:hover {
    background: var(--chanv-fibre);
}

/* Syntheses list */
.ai-syntheses-list {
    margin-top: 12px;
}

.ai-synthesis-item {
    padding: 12px 16px;
    background: var(--chanv-fibre);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.ai-synthesis-item:hover {
    background: var(--chanv-beige);
    transform: translateX(2px);
}

.ai-synthesis-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--chanv-terre);
}

.ai-synthesis-meta {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* Synthesis & Convo Detail Modals */
.ai-synthesis-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ai-synthesis-modal.hidden {
    display: none;
}

.ai-synthesis-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-bold);
}

.ai-synthesis-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: var(--transition);
}

.ai-synthesis-close:hover {
    color: var(--chanv-terre);
}

.ai-synthesis-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    color: var(--chanv-terre);
    margin-bottom: 8px;
}

.ai-synthesis-meta-detail {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #888;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--chanv-fibre);
}

.ai-synthesis-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--chanv-terre);
}

.ai-synthesis-text h2 { font-size: 18px; margin: 20px 0 8px; font-family: 'Outfit', sans-serif; }
.ai-synthesis-text h3 { font-size: 16px; margin: 16px 0 6px; font-family: 'Outfit', sans-serif; }
.ai-synthesis-text h4 { font-size: 14px; margin: 12px 0 4px; font-family: 'Outfit', sans-serif; }
.ai-synthesis-text ul { padding-left: 20px; margin: 8px 0; }
.ai-synthesis-text li { margin-bottom: 4px; }

/* Conversation detail */
.ai-detail-info {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--chanv-fibre);
}

.ai-detail-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-detail-msg {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.ai-detail-user {
    background: var(--chanv-terre);
    color: white;
    align-self: flex-end;
    margin-left: 40px;
}

.ai-detail-assistant {
    background: var(--chanv-fibre);
    color: var(--chanv-terre);
    margin-right: 40px;
}

.ai-detail-meta {
    font-size: 10px;
    opacity: 0.6;
    margin-bottom: 4px;
}

.ai-detail-badge {
    background: rgba(255,255,255,0.2);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-detail-content {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ============================================== */
/* --- AGENT IA — Agents personnalisés        --- */
/* ============================================== */

.ai-agent-manage-btn {
    background: none;
    border: 1px solid var(--chanv-fibre);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    flex-shrink: 0;
}

.ai-agent-manage-btn:hover {
    background: var(--chanv-fibre);
}

.ai-agent-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--chanv-fibre);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: var(--transition);
}

.ai-agent-card:hover {
    transform: translateX(2px);
}

.ai-agent-card-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

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

.ai-agent-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--chanv-terre);
}

.ai-agent-card-desc {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-agent-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.ai-agent-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--chanv-fibre);
}

.ai-agent-form .form-group {
    margin-bottom: 12px;
}

.ai-agent-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--chanv-terre);
    margin-bottom: 4px;
}

.ai-agent-form input,
.ai-agent-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--chanv-fibre);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: var(--transition);
}

.ai-agent-form input:focus,
.ai-agent-form textarea:focus {
    border-color: var(--chanv-beige);
}

.ai-agent-form textarea {
    resize: vertical;
    min-height: 80px;
}

.ai-agent-form select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--chanv-fibre);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.ai-agent-form select:focus {
    border-color: var(--chanv-beige);
}

/* Form row (side by side) */
.ai-agent-form-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

/* AI generate prompt button */
.ai-generate-prompt-btn {
    margin-top: 6px;
    background: linear-gradient(135deg, #f0e6d6 0%, #e8d5b7 100%);
    border: 1px solid var(--chanv-fibre);
    color: var(--chanv-terre);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.ai-generate-prompt-btn:hover {
    background: linear-gradient(135deg, #e8d5b7 0%, #C9A876 100%);
    transform: translateY(-1px);
}

.ai-generate-prompt-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* Agent modal wider */
.ai-agent-modal-content {
    max-width: 620px !important;
}

/* Templates gallery */
.ai-agent-templates {
    margin-bottom: 20px;
    padding: 14px;
    background: rgba(201,168,118,0.06);
    border: 1px solid rgba(201,168,118,0.15);
    border-radius: 12px;
}

.ai-agent-templates-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--chanv-terre);
    margin-bottom: 10px;
}

.ai-agent-templates-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.ai-agent-template {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border-radius: 10px;
    border: 1px solid rgba(201,168,118,0.2);
    background: white;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 22px;
}

.ai-agent-template span {
    font-size: 10px;
    font-weight: 600;
    color: #666;
    text-align: center;
    line-height: 1.2;
}

.ai-agent-template:hover {
    border-color: var(--chanv-fibre);
    background: rgba(201,168,118,0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Agent card stats */
.ai-agent-card-stats {
    font-size: 10px;
    color: var(--chanv-fibre);
    margin-top: 2px;
}

/* Google Drive section */
.ai-agent-drive-info {
    padding: 12px;
    background: rgba(66,133,244,0.06);
    border: 1px solid rgba(66,133,244,0.15);
    border-radius: 10px;
}

.ai-agent-drive-info p {
    font-size: 12px;
    color: #666;
    margin: 0 0 8px;
    line-height: 1.4;
}

.ai-drive-btn {
    background: linear-gradient(135deg, #4285f4 0%, #356ac3 100%) !important;
    color: white !important;
    border: none !important;
}

.ai-drive-btn:hover {
    opacity: 0.9;
}

.ai-drive-connected {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #34a853;
    font-weight: 600;
}

.ai-drive-folder-link {
    color: #4285f4;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}

.ai-drive-folder-link:hover {
    text-decoration: underline;
}

/* Drive dropzone area */
.ai-drive-dropzone-area {
    margin-top: 8px;
}

.ai-drive-dropzone {
    border: 2px dashed rgba(66,133,244,0.3);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    background: rgba(66,133,244,0.03);
}

.ai-drive-dropzone:hover,
.ai-drive-dropzone.dragover {
    border-color: #4285f4;
    background: rgba(66,133,244,0.08);
}

.ai-drive-dropzone.dragover {
    transform: scale(1.01);
}

.ai-drive-dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #888;
    font-size: 13px;
}

.ai-drive-dropzone-icon {
    font-size: 28px;
    margin-bottom: 2px;
}

.ai-drive-dropzone-or {
    font-size: 10px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Drive file list */
.ai-drive-file-list {
    margin-bottom: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.ai-drive-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(66,133,244,0.05);
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 13px;
    transition: background 0.15s;
}

.ai-drive-file-item:hover {
    background: rgba(66,133,244,0.1);
}

.ai-drive-file-icon {
    flex-shrink: 0;
}

.ai-drive-file-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}

.ai-drive-file-size {
    color: #888;
    font-size: 11px;
    white-space: nowrap;
}

.ai-drive-empty {
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: #999;
    line-height: 1.5;
}

.ai-drive-upload-status {
    font-size: 12px;
    color: #4285f4;
    font-weight: 500;
    min-height: 18px;
    margin-top: 4px;
}

/* Drive sync row */
.ai-drive-sync-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(52,168,83,0.06);
    border: 1px solid rgba(52,168,83,0.15);
    border-radius: 8px;
}

.ai-drive-sync-btn {
    background: linear-gradient(135deg, #34a853 0%, #2d8f47 100%) !important;
    color: white !important;
    border: none !important;
    font-weight: 600;
    white-space: nowrap;
}

.ai-drive-sync-btn:hover {
    opacity: 0.9;
}

.ai-drive-sync-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.ai-drive-sync-status {
    font-size: 12px;
    color: #666;
    flex: 1;
}

.ai-drive-sync-status.ai-drive-synced {
    color: #34a853;
    font-weight: 500;
}

/* --- Agent Knowledge Documents --- */
.agent-docs-list {
    margin: 8px 0;
    max-height: 200px;
    overflow-y: auto;
}

.agent-doc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.04);
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 13px;
}

.agent-doc-icon {
    flex-shrink: 0;
}

.agent-doc-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-doc-size {
    color: #888;
    font-size: 11px;
    white-space: nowrap;
}

.agent-doc-delete {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.agent-doc-delete:hover {
    opacity: 1;
}

.agent-doc-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.agent-doc-status {
    font-size: 12px;
    color: #C9A876;
}

/* --- Image Generation Loading Indicator --- */
.ai-img-generating {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-top: 12px;
    background: linear-gradient(135deg, rgba(201,168,118,0.08) 0%, rgba(232,213,183,0.12) 100%);
    border: 1px solid rgba(201,168,118,0.2);
    border-radius: 10px;
    color: #C9A876;
    font-size: 13px;
    font-weight: 500;
    animation: imgGenPulse 2s ease-in-out infinite;
}

.ai-img-generating-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(201,168,118,0.3);
    border-top: 2px solid #C9A876;
    border-radius: 50%;
    animation: imgGenSpin 0.8s linear infinite;
}

@keyframes imgGenSpin {
    to { transform: rotate(360deg); }
}

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

/* --- Message Timestamps --- */
.ai-msg-timestamp {
    display: block;
    font-size: 10px;
    color: #b0a89a;
    margin-top: 4px;
    padding-top: 4px;
    text-align: right;
    opacity: 0.5;
    line-height: 1;
}

.ai-msg-user .ai-msg-timestamp {
    color: rgba(255,255,255,0.4);
}

/* =====================================================================
 * --- MÉMOIRE UTILISATEUR PERSISTANTE (panneau 🧠) ---
 * ===================================================================== */

.ai-memory-btn {
    background: none;
    border: 1px solid var(--chanv-fibre);
    color: var(--chanv-terre);
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
    position: relative;
}

.ai-memory-btn:hover {
    background: linear-gradient(135deg, rgba(201,168,118,0.15), rgba(201,168,118,0.3));
    border-color: var(--chanv-beige);
    transform: scale(1.05);
}

.ai-memory-panel {
    position: absolute;
    top: 56px;
    right: 16px;
    width: 380px;
    max-height: calc(100vh - 120px);
    z-index: 200;
    border-radius: 16px;
    background: rgba(255,255,255,0.97);
    border: 1px solid rgba(201,168,118,0.3);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(201,168,118,0.1);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    animation: ai-memory-slide-in 0.25s ease-out;
    overflow: hidden;
}

@keyframes ai-memory-slide-in {
    from { opacity: 0; transform: translateY(-10px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-memory-panel.hidden {
    display: none;
}

.ai-memory-panel-content {
    display: flex;
    flex-direction: column;
    max-height: inherit;
}

.ai-memory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(201,168,118,0.15);
}

.ai-memory-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--chanv-terre);
    margin: 0;
}

.ai-memory-close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.ai-memory-close:hover {
    background: rgba(0,0,0,0.06);
    color: var(--chanv-terre);
}

.ai-memory-hint {
    padding: 8px 20px 12px;
    font-size: 12px;
    color: #888;
    line-height: 1.5;
    margin: 0;
}

.ai-memory-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 16px 12px;
    max-height: 420px;
}

.ai-memory-list::-webkit-scrollbar {
    width: 4px;
}

.ai-memory-list::-webkit-scrollbar-thumb {
    background: rgba(201,168,118,0.3);
    border-radius: 4px;
}

.ai-memory-loading {
    text-align: center;
    padding: 32px 16px;
    color: #aaa;
    font-size: 13px;
}

.ai-memory-empty {
    text-align: center;
    padding: 32px 16px;
    color: #aaa;
    font-size: 13px;
    line-height: 1.6;
}

.ai-memory-category {
    margin-bottom: 16px;
}

.ai-memory-category-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--chanv-beige);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px 4px 6px;
    border-bottom: 1px solid rgba(201,168,118,0.12);
    margin-bottom: 6px;
}

.ai-memory-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    overflow: hidden;
}

.ai-memory-item:hover {
    background: rgba(201,168,118,0.08);
}

.ai-memory-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-memory-text {
    font-size: 13px;
    color: var(--chanv-terre);
    line-height: 1.45;
    word-break: break-word;
}

.ai-memory-date {
    font-size: 10px;
    color: #bbb;
}

.ai-memory-delete {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #ccc;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    opacity: 0;
    flex-shrink: 0;
    margin-top: 2px;
}

.ai-memory-item:hover .ai-memory-delete {
    opacity: 1;
}

.ai-memory-delete:hover {
    background: rgba(255,107,107,0.12);
    color: #ff6b6b;
}

.ai-memory-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px 14px;
    border-top: 1px solid rgba(201,168,118,0.12);
}

.ai-memory-count {
    font-size: 12px;
    color: #aaa;
    font-weight: 500;
}

.btn-danger-sm {
    background: transparent;
    border: 1px solid rgba(255,107,107,0.3);
    color: #ff6b6b;
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-danger-sm:hover {
    background: rgba(255,107,107,0.1);
    border-color: #ff6b6b;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-memory-panel {
        width: calc(100vw - 32px);
        right: 16px;
        top: 48px;
    }

    .ai-memory-btn {
        padding: 4px 8px;
        font-size: 16px;
    }
}

/* ============================================== */
/* --- Image Preview Overlay                  --- */
/* ============================================== */

.ai-img-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease;
    cursor: zoom-out;
}

.ai-img-preview-overlay.visible {
    background: rgba(0, 0, 0, 0.85);
}

.ai-img-preview-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.ai-img-preview-close:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.ai-img-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 80vw;
    max-height: 80vh;
    cursor: default;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ai-img-preview-overlay.visible .ai-img-preview-container {
    opacity: 1;
    transform: scale(1);
}

.ai-img-preview-img {
    max-width: 80vw;
    max-height: 72vh;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.ai-img-preview-download {
    padding: 10px 28px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
    letter-spacing: 0.5px;
}

.ai-img-preview-download:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .ai-img-preview-container {
        max-width: 95vw;
        max-height: 90vh;
    }
    .ai-img-preview-img {
        max-width: 95vw;
        max-height: 80vh;
    }
    .ai-img-preview-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

/* ==================== STUDIO CHANV IMAGE PICKER ==================== */

.ai-studio-btn {
    position: relative;
}
.ai-studio-btn::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: #667eea;
    border-radius: 50%;
}

.ai-studio-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: aiStudioFadeIn .2s ease;
}
@keyframes aiStudioFadeIn { from { opacity: 0; } to { opacity: 1; } }

.ai-studio-modal {
    background: #1e1e1e;
    border-radius: 16px;
    width: min(90vw, 840px);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    border: 1px solid #333;
    overflow: hidden;
}
.ai-studio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
}
.ai-studio-header h3 {
    margin: 0;
    font-size: 16px;
    color: #fff;
    font-weight: 600;
}
.ai-studio-close {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all .15s;
}
.ai-studio-close:hover { color: #fff; background: #333; }

.ai-studio-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.ai-studio-back {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 0;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color .15s;
}
.ai-studio-back:hover { color: #fff; }

.ai-studio-project-label {
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.ai-studio-projects {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.ai-studio-project-card {
    background: #2a2a2a;
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    border: 1px solid #3a3a3a;
    transition: all .2s;
}
.ai-studio-project-card:hover {
    border-color: #667eea;
    background: #2e2e3e;
    transform: translateY(-2px);
}
.ai-studio-project-card h4 {
    margin: 0 0 6px;
    font-size: 14px;
    color: #fff;
    font-weight: 600;
}
.ai-studio-project-card span {
    font-size: 12px;
    color: #888;
}

.ai-studio-assets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.ai-studio-asset {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .2s;
}
.ai-studio-asset:hover {
    border-color: #667eea;
    transform: scale(1.03);
}
.ai-studio-asset img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ai-studio-asset-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: #fff;
    font-size: 11px;
    padding: 16px 6px 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-studio-loading {
    text-align: center;
    color: #888;
    padding: 40px;
    font-size: 14px;
}
.ai-studio-empty {
    text-align: center;
    color: #666;
    padding: 40px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-studio-modal {
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }
    .ai-studio-projects {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .ai-studio-assets {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 6px;
    }
    .ai-studio-body { padding: 12px; }
    .ai-studio-header { padding: 12px 14px; }
}
@media (max-width: 480px) {
    .ai-studio-projects { grid-template-columns: 1fr; }
    .ai-studio-assets { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}

/* ── Studio Save Button on generated images ── */
.ai-img-studio-btn {
    background: rgba(102,126,234,0.15) !important;
}
.ai-img-studio-btn:hover {
    background: #667eea !important;
    color: #fff !important;
}

/* ── Save modal extras ── */
.ai-studio-name-row {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #333;
}
.ai-studio-name-label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ai-studio-name-input {
    width: 100%;
    padding: 10px 14px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color .2s;
}
.ai-studio-name-input:focus {
    border-color: #667eea;
    outline: none;
}
.ai-studio-save-subtitle {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 12px;
    font-weight: 500;
}
