/* ============================================================================
   kb_chat_v2.css — Design system v2 overrides for the chat page
   Layers on top of kb_document_v2.css (base) + kb_chat_messaging.css (messages)
   ============================================================================ */

/* ---------- Legacy variable fallbacks (used by kb_chat_messaging.css modals) ---------- */
.v2-chat-app {
    --color-background: #ffffff;
    --color-surface: #ffffff;
    --color-border: #dadce0;
    --color-text-primary: #202124;
    --color-text-secondary: #5f6368;
    --color-secondary: #f8f9fa;
    --border-radius: 8px;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --font-primary: var(--font-sans, 'Inter', system-ui, sans-serif);
}

/* ---------- Layout override ---------- */
.v2-chat-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--color-gray-50, #F9FAFB);
}

/* ---------- Sidebar override ---------- */
.v2-chat-sidebar {
    width: 256px;
    min-width: 256px;
    max-width: 256px;
    background: var(--color-sidebar, #141414);
    display: flex;
    flex-direction: column;
    padding: 16px 16px 0;
    border-right: none;
    position: relative;
    z-index: 30;
    flex-shrink: 0;
}

.v2-chat-sidebar .v2-sidebar-logo {
    padding: 0 8px;
    margin-bottom: 40px;
}

.v2-chat-btn-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 48px);
    margin: 0 auto 16px;
    padding: 10px 16px;
    background: var(--color-primary, #2563EB);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
    box-sizing: border-box;
}

.v2-chat-btn-prompt:hover {
    background: var(--color-primary-hover, #1D4ED8);
}

/* Nav sections */
.v2-chat-nav-sections {
    padding: 0 8px;
    margin-bottom: 8px;
    border-top: 1px solid #2d2d2d;
    border-bottom: 1px solid #2d2d2d;
    padding-top: 8px;
    padding-bottom: 8px;
}

.v2-chat-sidebar .nav-section-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    color: var(--color-gray-400, #9CA3AF);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    position: relative;
}

.v2-chat-sidebar .nav-section-item:hover {
    background: var(--color-sidebar-hover, #2A2A2A);
    color: white;
}

.v2-chat-sidebar .nav-section-item.active {
    background: var(--color-sidebar-hover, #2A2A2A);
    color: white;
}

.v2-chat-sidebar .nav-section-item.drag-over,
.v2-chat-sidebar .nav-section-item.drag-over:hover {
    background: rgba(37, 99, 235, 0.15);
    border: 2px dashed var(--color-primary, #2563EB);
}

.v2-chat-sidebar .nav-section-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.v2-chat-sidebar .nav-section-menu {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.15s;
}

.v2-chat-sidebar .nav-section-item:hover .nav-section-menu {
    opacity: 1;
}

.v2-chat-sidebar .btn-trash-menu {
    background: none;
    border: none;
    color: var(--color-gray-500, #6B7280);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
}

.v2-chat-sidebar .btn-trash-menu:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Favorites section */
.v2-chat-favorites {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
    scrollbar-width: none;
}

.v2-chat-favorites::-webkit-scrollbar {
    display: none;
}

.v2-chat-favorites .favorites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 4px;
    color: var(--color-gray-500, #6B7280);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.v2-chat-favorites .btn-add-favorite {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary, #2563EB);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: white;
    padding: 0;
    transition: background 0.15s;
}

.v2-chat-favorites .btn-add-favorite:hover {
    background: var(--color-primary-hover, #1D4ED8);
}

.v2-chat-favorites .favorites-list {
    padding: 4px 0;
}

/* Sidebar footer */
.v2-chat-sidebar .v2-sidebar-footer {
    border-top: 1px solid #2d2d2d;
    padding: 8px;
    margin-top: auto;
}

/* ---------- Main area ---------- */
.v2-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* ---------- Header override ---------- */
.v2-chat-header {
    display: flex;
    align-items: center;
    height: 64px;
    padding: 0 32px;
    background: var(--color-white, #ffffff);
    border-bottom: 1px solid var(--color-gray-200, #E5E7EB);
    flex-shrink: 0;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 60;
    overflow: visible;
}

.v2-chat-header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-gray-600, #4B5563);
}

.v2-chat-header-nav .nav-item {
    text-decoration: none;
    color: var(--color-gray-600, #4B5563);
    transition: var(--transition);
    padding-bottom: 20px;
    margin-top: 20px;
}

.v2-chat-header-nav .nav-item:hover {
    color: var(--color-primary, #1D72F2);
}

.v2-chat-header-nav .nav-item.active {
    color: var(--color-primary, #1D72F2);
    border-bottom: 2px solid var(--color-primary, #1D72F2);
}

.v2-chat-header-right {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-left: auto;
}

/* ---------- Content area ---------- */
.v2-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-gray-50, #F9FAFB);
    padding: 0;
}

.content.messaging-content.v2-chat-content {
    z-index: 2 !important;
}

/* ---------- Actions bar ---------- */
.v2-chat-actions-bar {
    padding: 16px 32px;
    background: var(--color-gray-50, #F9FAFB);
    flex-shrink: 0;
}

.v2-chat-actions-bar .actions-top-mobile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.v2-chat-actions-bar .actions-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.v2-chat-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    margin-right: 16px;
}

.v2-chat-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
    background: white;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.15s;
}

.v2-chat-action-btn:hover {
    background: #F3F4F6;
    color: #374151;
}

/* Pagination */
.v2-chat-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6B7280;
}

.v2-chat-pagination .pagination-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
    background: white;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.15s;
}

.v2-chat-pagination .pagination-btn:hover:not(:disabled) {
    background: #F3F4F6;
    color: #374151;
}

.v2-chat-pagination .pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Remove actions-bar bottom border (header border-bottom handles separation) */
.v2-chat-actions-bar {
    border-bottom: none;
}

/* ---------- Conversations list header ---------- */
/* Header wrapper: same class as data list for consistent padding */
.v2-chat-conversations.v2-conversations-header-wrapper {
    flex: 0 0 auto;
    overflow: visible;
    padding-bottom: 0;
    border-bottom: 1px solid var(--color-gray-200, #E5E7EB);
}

/* Header row: inherits .conversation-item sizing, override for header look */
/* Specificity 0,3,0 to beat .v2-chat-conversations .conversation-item (0,2,0) */
.v2-chat-conversations .v2-chat-conversations-header.conversation-item {
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    cursor: default;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-gray-500, #6B7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: none;
    border-top: none;
    user-select: none;
    background: var(--color-gray-50, #F9FAFB);
    border-radius: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.v2-chat-conversations .v2-chat-conversations-header.conversation-item:hover {
    background: var(--color-gray-50, #F9FAFB);
}

.v2-chat-conversations .v2-chat-conversations-header .conversation-star {
    visibility: hidden;
}

.v2-chat-conversations .v2-chat-conversations-header .conversation-sender,
.v2-chat-conversations .v2-chat-conversations-header .conversation-subject,
.v2-chat-conversations .v2-chat-conversations-header .conversation-channel,
.v2-chat-conversations .v2-chat-conversations-header .conversation-model,
.v2-chat-conversations .v2-chat-conversations-header .conversation-time {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-gray-500, #6B7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Reset badge styling on header model column */
.v2-chat-conversations .v2-chat-conversations-header .conversation-model {
    background: transparent;
    padding: 3px 0;
    border-radius: 0;
    border: none;
}

/* ---------- Conversations list ---------- */
.v2-chat-conversations {
    flex: 1;
    overflow-y: auto;
    padding: 0 32px 16px;
    scrollbar-width: none;
}

.v2-chat-conversations::-webkit-scrollbar {
    display: none;
}

.v2-chat-conversations .conversation-item {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 52px;
    background: white;
    border-bottom: 1px solid #F3F4F6;
    cursor: pointer;
    transition: background 0.15s ease;
    border-radius: 0;
    gap: 0;
}

.v2-chat-conversations .conversation-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.v2-chat-conversations .conversation-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-bottom: none;
}

.v2-chat-conversations .conversation-item:hover {
    background: #F9FAFB;
}

.v2-chat-conversations .conversation-item.selected {
    background: #EFF6FF;
}

.v2-chat-conversations .conversation-checkbox {
    width: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.v2-chat-conversations .conversation-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid #D1D5DB;
    cursor: pointer;
    accent-color: var(--color-primary, #2563EB);
}

.v2-chat-conversations .conversation-star {
    width: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.v2-chat-conversations .conversation-star .btn-star {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #D1D5DB;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s;
}

.v2-chat-conversations .conversation-star .btn-star svg {
    width: 16px;
    height: 16px;
}

.v2-chat-conversations .conversation-star .btn-star:hover {
    color: #F59E0B;
}

.v2-chat-conversations .conversation-star .btn-star.active {
    color: #F59E0B;
}

.v2-chat-conversations .conversation-sender {
    width: 13%;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-gray-900, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 12px;
}

.v2-chat-conversations .conversation-subject {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--color-gray-700, #374151);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 120px;
}

.v2-chat-conversations .conversation-channel {
    width: 10%;
    flex-shrink: 0;
    font-size: 13px;
    color: var(--color-gray-700, #374151);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 24px;
}

.v2-chat-conversations .conversation-model {
    width: 20%;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    padding-right: 12px;
    display: flex;
    align-items: center;
}

.v2-chat-conversations .conversation-time {
    width: 10%;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--color-gray-500, #6B7280);
    text-align: right;
    padding-right: 20px;
}

/* ---------- Model badges ---------- */
.v2-chat-conversations .conversation-model {
    padding: 3px 10px;
    border-radius: 20px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    text-align: center;
    justify-content: center;
    background: var(--color-gray-100, #F3F4F6);
    color: var(--color-gray-500, #6B7280);
}

/* Provider-specific badge colors */
.v2-chat-conversations .conversation-model[data-provider="openai"] {
    background: #ECFDF5;
    color: #059669;
}

.v2-chat-conversations .conversation-model[data-provider="anthropic"] {
    background: #FFF7ED;
    color: #C2410C;
}

.v2-chat-conversations .conversation-model[data-provider="google"] {
    background: #EFF6FF;
    color: #2563EB;
}

.v2-chat-conversations .conversation-model[data-provider="mistral"] {
    background: #F5F3FF;
    color: #7C3AED;
}

.v2-chat-conversations .conversation-model[data-provider="meta"] {
    background: #EFF6FF;
    color: #1D4ED8;
}

.v2-chat-conversations .conversation-model[data-provider="deepseek"] {
    background: #ECFEFF;
    color: #0891B2;
}

/* ---------- Skeleton loading ---------- */
.v2-chat-skeleton-row {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 52px;
    background: white;
    border-bottom: 1px solid var(--color-gray-100, #F3F4F6);
    gap: 12px;
}

.v2-chat-skeleton-row:first-child { border-radius: 8px 8px 0 0; }
.v2-chat-skeleton-row:last-child { border-radius: 0 0 8px 8px; border-bottom: none; }

.v2-skeleton-bone {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--color-gray-100, #F3F4F6) 25%, var(--color-gray-200, #E5E7EB) 50%, var(--color-gray-100, #F3F4F6) 75%);
    background-size: 200% 100%;
    animation: v2SkeletonShimmer 1.5s ease-in-out infinite;
}

@keyframes v2SkeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.v2-skeleton-cb { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; }
.v2-skeleton-star { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.v2-skeleton-sender { width: 100px; flex-shrink: 0; }
.v2-skeleton-subject { flex: 1; }
.v2-skeleton-model { width: 80px; height: 20px; border-radius: 20px; flex-shrink: 0; }
.v2-skeleton-time { width: 50px; flex-shrink: 0; }

/* ---------- Empty state ---------- */
.v2-chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    color: var(--color-gray-400, #9CA3AF);
    text-align: center;
}

.v2-chat-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-gray-100, #F3F4F6);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.v2-chat-empty-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-gray-400, #9CA3AF);
}

.v2-chat-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-gray-700, #374151);
    margin-bottom: 4px;
}

.v2-chat-empty-text {
    font-size: 13px;
    color: var(--color-gray-400, #9CA3AF);
}

/* ---------- Footer ---------- */
.v2-chat-footer {
    flex-shrink: 0;
}

/* Hide footer + list header when in prompt or conversation view */
.v2-chat-app.in-prompt .v2-chat-footer,
.v2-chat-app.in-conversation .v2-chat-footer,
.v2-chat-app.in-prompt .v2-conversations-header-wrapper,
.v2-chat-app.in-conversation .v2-conversations-header-wrapper {
    display: none;
}

/* ---------- Modal overrides ---------- */
.v2-chat-app .modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.v2-chat-app .modal.hidden {
    display: none;
}

.v2-chat-app .modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
}

.v2-chat-app .modal-dialog {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 480px;
    width: 90%;
    padding: 0;
    animation: v2ChatModalIn 0.2s ease-out;
    z-index: 1;
}

@keyframes v2ChatModalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.v2-chat-app .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.v2-chat-app .modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.v2-chat-app .modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #9CA3AF;
    cursor: pointer;
    transition: all 0.15s;
}

.v2-chat-app .modal-close:hover {
    background: #F3F4F6;
    color: #374151;
}

.v2-chat-app .modal-body {
    padding: 20px 24px;
    font-size: 14px;
    color: #374151;
}

.v2-chat-app .modal-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.v2-chat-app .modal-input:focus {
    border-color: var(--color-primary, #2563EB);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.v2-chat-app .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 24px 20px;
}

.v2-chat-app .btn-primary {
    padding: 8px 16px;
    background: var(--color-primary, #2563EB);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.v2-chat-app .btn-primary:hover {
    background: var(--color-primary-hover, #1D4ED8);
}

.v2-chat-app .btn-secondary {
    padding: 8px 16px;
    background: white;
    color: #374151;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.v2-chat-app .btn-secondary:hover {
    background: #F9FAFB;
}

.v2-chat-app .btn-danger {
    padding: 8px 16px;
    background: #DC2626;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.v2-chat-app .btn-danger:hover {
    background: #B91C1C;
}

/* Email modal */
.v2-chat-app .email-dialog {
    max-width: 540px;
}

.v2-chat-app .form-group {
    margin-bottom: 16px;
}

.v2-chat-app .form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.v2-chat-app .form-input,
.v2-chat-app .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.v2-chat-app .form-input:focus,
.v2-chat-app .form-textarea:focus {
    border-color: var(--color-primary, #2563EB);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.v2-chat-app .form-hint {
    font-size: 12px;
    color: #9CA3AF;
    margin-top: 4px;
}

/* ---------- Search in actions-center (mobile) ---------- */
.v2-chat-actions-bar .actions-center {
    display: none;
}

/* ---------- Context menus ---------- */
.v2-chat-app .favorite-context-menu,
.v2-chat-app .trash-context-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 4px;
    z-index: 1001;
    min-width: 120px;
}

.v2-chat-app .favorite-menu-item,
.v2-chat-app .trash-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #374151;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background 0.1s;
    font-family: inherit;
}

.v2-chat-app .favorite-menu-item:hover,
.v2-chat-app .trash-menu-item:hover {
    background: #F3F4F6;
}

.v2-chat-app .favorite-menu-item.delete {
    color: #DC2626;
}

/* ---------- Skeleton loading ---------- */
.v2-chat-skeleton {
    padding: 0 32px;
}

.v2-chat-skeleton-row {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 52px;
    background: var(--color-white, #fff);
    border-bottom: 1px solid var(--color-gray-100, #F3F4F6);
    gap: 12px;
}

.v2-chat-skeleton-row:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.v2-chat-skeleton-row:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-bottom: none;
}

.v2-skel {
    background: linear-gradient(90deg, var(--color-gray-100, #F3F4F6) 25%, var(--color-gray-50, #F9FAFB) 50%, var(--color-gray-100, #F3F4F6) 75%);
    background-size: 200% 100%;
    animation: v2-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.v2-skel-cb { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; }
.v2-skel-star { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.v2-skel-sender { width: 100px; height: 12px; flex-shrink: 0; }
.v2-skel-subject { flex: 1; height: 12px; }
.v2-skel-model { width: 80px; height: 20px; border-radius: 20px; flex-shrink: 0; }
.v2-skel-time { width: 50px; height: 10px; flex-shrink: 0; }

@keyframes v2-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- Empty state v2 ---------- */
.v2-chat-conversations .conversations-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.v2-chat-conversations .conversations-empty .empty-icon,
.v2-chat-conversations .conversations-empty .trash-empty-icon,
.v2-chat-conversations .conversations-empty .important-empty-icon {
    width: 64px;
    height: 64px;
    background: var(--color-gray-100, #F3F4F6);
    border-radius: var(--radius-full, 9999px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.v2-chat-conversations .conversations-empty .empty-icon svg,
.v2-chat-conversations .conversations-empty .trash-empty-icon svg,
.v2-chat-conversations .conversations-empty .important-empty-icon svg {
    width: 32px;
    height: 32px;
}

.v2-chat-conversations .conversations-empty h2 {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-gray-500, #6B7280);
    margin-bottom: 4px;
}

.v2-chat-conversations .conversations-empty p {
    font-size: 14px;
    color: var(--color-gray-400, #9CA3AF);
}

/* ---------- Footer / header visibility in sub-views ---------- */
.v2-chat-app.in-prompt .v2-chat-footer,
.v2-chat-app.in-conversation .v2-chat-footer {
    display: none;
}

.v2-chat-app.in-prompt .v2-conversations-header-wrapper,
.v2-chat-app.in-conversation .v2-conversations-header-wrapper {
    display: none;
}

/* ---------- Toast override ---------- */
.v2-chat-app .toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ---------- Responsive: hide desktop search-bar on mobile ---------- */
@media (max-width: 1024px) {
    .v2-chat-header-right .v2-search-wrapper {
        display: none;
    }

    .v2-chat-actions-bar .actions-center {
        display: block;
        margin-top: 12px;
    }

    .v2-chat-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: left 0.3s ease;
    }

    .v2-chat-sidebar.open {
        left: 0;
    }

    .v2-chat-title {
        font-size: 16px;
    }

    .v2-chat-conversations {
        padding: 0 16px 16px;
    }

    .v2-conversations-header-wrapper {
        display: none;
    }

    .v2-chat-actions-bar {
        padding: 12px 16px;
    }

    .header-logo-mobile {
        display: flex;
    }

    .btn-mobile-menu {
        display: flex;
    }
}

/* ---------- Share Options Popup ---------- */
.share-wrapper {
    position: relative;
    display: inline-flex;
}

.share-options-popup {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 260px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 100;
    padding: 6px;
    animation: sharePopupIn 0.15s ease-out;
}

.share-options-popup.hidden {
    display: none;
}

@keyframes sharePopupIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.share-options-header {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: #9ca3af;
    text-transform: uppercase;
    padding: 10px 14px 6px;
}

.share-option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.share-option-item:hover {
    background: #f3f4f6;
}

.share-option-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.share-option-icon-iq {
    background: #eff6ff;
    color: #3b82f6;
}

.share-option-icon-email {
    background: #f0fdf4;
    color: #22c55e;
}

.share-option-icon-slack {
    background: #f3f0ff;
    color: #7c3aed;
}

.share-option-icon-whatsapp {
    background: #ecfdf5;
    color: #10b981;
}

.share-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.share-option-label {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.share-option-sub {
    font-size: 12px;
    color: #6b7280;
}

/* ---------- IQ Share Modal ---------- */
.v2-chat-app .iq-share-dialog {
    max-width: 540px;
    width: 90%;
}

.iq-share-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 200px;
    overflow-y: auto;
    z-index: 110;
    margin-top: 4px;
}

.iq-share-suggestions.hidden {
    display: none;
}

.iq-share-suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.12s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.iq-share-suggestion-item:hover {
    background: #f3f4f6;
}

.iq-share-suggestion-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

.iq-share-suggestion-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.iq-share-suggestion-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}

.iq-share-suggestion-name {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.iq-share-suggestion-email {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.iq-share-selected-users {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.iq-share-selected-users:empty {
    display: none;
}

.iq-share-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #1d4ed8;
}

.iq-share-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: #bfdbfe;
    color: #1d4ed8;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0;
    transition: background 0.12s;
}

.iq-share-chip-remove:hover {
    background: #93c5fd;
}

#iq-share-send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#iq-share-send-btn svg {
    flex-shrink: 0;
}

.v2-chat-app .iq-share-dialog .form-group {
    position: relative;
}

/* ---------- Notification overlay z-index fix ---------- */
.v2-chat-app .v2-notif-overlay {
    z-index: 70;
}

@media (min-width: 1025px) {
    .header-logo-mobile {
        display: none;
    }

    .btn-mobile-menu {
        display: none;
    }
}

/* Animation Boutons Partage (Slack/WhatsApp) */
.v2-chat-app .btn-primary.is-loading {
    background-color: #8da4f7 !important;
    color: white !important;
    pointer-events: none;
    opacity: 1 !important;
}

.v2-chat-app .btn-primary.is-success {
    background-color: #059669 !important;
    color: white !important;
    pointer-events: none;
    opacity: 1 !important;
    transition: background-color 0.3s ease;
}

@keyframes spin-share {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
