/* IDP Kit — Intelligent Document Processing Toolkit */

[x-cloak] { display: none !important; }

/* ========== Variables ========== */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --success: #059669;
    --success-light: #ecfdf5;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --info: #0891b2;
    --info-light: #ecfeff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #4f46e5;
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
}

/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== App Layout ========== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.content {
    flex: 1;
    padding: 24px 32px;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
    max-width: 100%;
    overflow-x: hidden;
}

.sidebar.collapsed ~ .content {
    margin-left: var(--sidebar-collapsed);
}

/* ========== Sidebar ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
    z-index: 100;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed span { display: none; }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i { color: var(--primary); font-size: 1.5rem; }

.toggle-btn {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    font-size: 1rem;
}
.toggle-btn:hover { background: rgba(255,255,255,0.1); }

.nav-links {
    list-style: none;
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}

.nav-links li a:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.nav-links li a.active {
    background: rgba(79,70,229,0.15);
    color: #fff;
    border-left-color: var(--primary);
}

.nav-links li a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--sidebar-text);
}

.user-info i { font-size: 1.2rem; }

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--sidebar-text);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.logout-btn:hover {
    background: rgba(220,38,38,0.15);
    border-color: var(--danger);
    color: #fca5a5;
}

/* ========== Auth Layout ========== */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container { width: 100%; max-width: 420px; padding: 20px; }

.auth-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 4px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-link {
    text-align: center;
    margin-top: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--bg-white);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-group input:disabled {
    background: var(--border-light);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { background: var(--border-light); text-decoration: none; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; padding: 12px; }
.btn-close { background: none; border: none; cursor: pointer; padding: 4px 8px; color: var(--text-secondary); font-size: 1rem; }
.btn-close:hover { color: var(--text); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== Alerts ========== */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #a7f3d0; }

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
    text-transform: uppercase;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-uploaded { background: var(--info-light); color: var(--info); }
.status-indexing { background: var(--warning-light); color: var(--warning); }
.status-indexed { background: var(--success-light); color: var(--success); }
.status-failed { background: var(--danger-light); color: var(--danger); }
.status-pending { background: var(--border-light); color: var(--text-secondary); }
.status-running { background: var(--warning-light); color: var(--warning); }
.status-completed { background: var(--success-light); color: var(--success); }

/* ========== Page Header ========== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h2 i { color: var(--primary); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========== Stats Grid (Dashboard) ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.indexed { background: var(--success-light); color: var(--success); }
.stat-icon.processing { background: var(--warning-light); color: var(--warning); }

.stat-value { font-size: 1.75rem; font-weight: 700; display: block; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); }

/* ========== Documents Table ========== */
.documents-table {
    grid-column: 1 / -1;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.documents-table h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

tbody tr:hover { background: var(--border-light); }

.doc-link { font-weight: 500; }
.actions { display: flex; gap: 6px; }
.empty-state { text-align: center; padding: 40px 12px !important; color: var(--text-muted); }

/* ========== Upload ========== */
.upload-container { max-width: 700px; }

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    background: var(--bg-white);
    transition: all var(--transition);
    cursor: pointer;
}

.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.upload-zone h3 { margin-bottom: 4px; }

.file-label {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}

.file-label:hover { text-decoration: underline; }

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.file-list {
    margin-top: 24px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.file-list h3 { margin-bottom: 12px; }

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius);
    margin-bottom: 6px;
    background: var(--bg);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.file-size { color: var(--text-muted); font-size: 0.8rem; }

.progress-bar {
    width: 100px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
}

.upload-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    cursor: pointer;
}

/* ========== Document View ========== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.info-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.info-card label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
}

.description-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.description-card h3 { margin-bottom: 8px; }

/* Tree Section */
.tree-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tree-outline { max-height: 600px; overflow-y: auto; }

.outline-node {
    padding: 6px 12px;
    border-radius: 4px;
    margin-bottom: 2px;
}

.outline-node:hover { background: var(--border-light); }

.node-id {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 1px 6px;
    border-radius: 4px;
}

.page-ref {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 8px;
}

.node-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}

.json-view {
    max-height: 600px;
    overflow: auto;
}

.json-view pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    line-height: 1.5;
    overflow-x: auto;
}

.tree-viz {
    min-height: 400px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: auto;
}

.tree-link { stroke: var(--border); stroke-width: 1.5; }

/* Query Section */
.query-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.query-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.query-input {
    display: flex;
    gap: 8px;
}

.query-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.query-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.answer-card {
    margin-top: 16px;
    padding: 16px;
    background: var(--primary-light);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.answer-card h4 { margin-bottom: 8px; font-size: 0.9rem; color: var(--primary); }

/* ========== Chat ========== */
.chat-container {
    display: flex;
    height: calc(100vh - 120px);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.chat-sidebar {
    width: 240px;
    border-right: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    transition: width var(--transition), padding var(--transition), opacity var(--transition);
}

.chat-sidebar.sidebar-hidden {
    width: 0;
    padding: 0;
    overflow: hidden;
    border-right: none;
    opacity: 0;
    pointer-events: none;
}

/* Sidebar toggle button — inside chat-main, top-left corner */
.sidebar-toggle-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

.sidebar-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Conversation search */
.conv-search {
    position: relative;
    margin-bottom: 8px;
}

.conv-search-icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.72rem;
    pointer-events: none;
}

.conv-search input {
    width: 100%;
    padding: 6px 10px 6px 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.78rem;
    background: var(--bg-white);
    color: var(--text);
}

.conv-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.1);
}

.chat-sidebar h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.doc-selector { display: flex; flex-direction: column; gap: 4px; }

.doc-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

.doc-check:hover { background: var(--border-light); }

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.welcome-msg {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.welcome-msg i { font-size: 3rem; color: var(--primary); margin-bottom: 12px; display: block; }
.welcome-msg h3 { margin-bottom: 8px; color: var(--text); }

.suggestions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.suggestion-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-white);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.suggestion-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.chat-msg {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.msg-user .msg-avatar { background: var(--primary-light); color: var(--primary); }
.msg-assistant .msg-avatar { background: var(--success-light); color: var(--success); }
.msg-tool .msg-avatar { background: var(--warning-light); color: var(--warning); }

.tool-accordion {
    width: 100%;
}

.tool-accordion-header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: all var(--transition);
}

.tool-accordion-header:hover {
    background: var(--border-light);
    color: var(--text);
}

.tool-accordion-header i:first-child {
    font-size: 0.7rem;
    color: var(--warning);
}

.tool-accordion-arrow {
    margin-left: auto;
    font-size: 0.6rem;
    transition: transform 0.15s ease;
}

.tool-accordion-arrow.open {
    transform: rotate(180deg);
}

.tool-accordion-body {
    margin-top: 6px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.tool-accordion-body pre {
    margin: 0;
    padding: 10px 12px;
    font-size: 0.75rem;
    line-height: 1.5;
    background: var(--bg);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.msg-content { flex: 1; min-width: 0; }

.msg-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.msg-body {
    font-size: 0.9rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.msg-body h1 { font-size: 1.4rem; font-weight: 700; margin: 16px 0 8px; }
.msg-body h2 { font-size: 1.2rem; font-weight: 700; margin: 14px 0 6px; }
.msg-body h3 { font-size: 1.05rem; font-weight: 600; margin: 12px 0 6px; }
.msg-body h4 { font-size: 0.95rem; font-weight: 600; margin: 10px 0 4px; }

.msg-body p { margin: 6px 0; }

.msg-body ul, .msg-body ol {
    margin: 6px 0;
    padding-left: 24px;
}

.msg-body li { margin-bottom: 4px; }
.msg-body li > ul, .msg-body li > ol { margin-top: 4px; }

.msg-body code {
    background: var(--border-light);
    color: var(--danger);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.msg-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    overflow-x: auto;
    margin: 8px 0;
}

.msg-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

.msg-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.85rem;
}

.msg-body table th, .msg-body table td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
}

.msg-body table th {
    background: var(--border-light);
    font-weight: 600;
}

.msg-body table tr:hover { background: var(--border-light); }

.msg-body blockquote {
    border-left: 3px solid var(--primary);
    margin: 8px 0;
    padding: 6px 14px;
    color: var(--text-secondary);
    background: var(--primary-light);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.msg-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 0;
}

.msg-body a { color: var(--primary); text-decoration: underline; }
.msg-body a:hover { color: var(--primary-hover); }

.msg-body img { max-width: 100%; border-radius: var(--radius); margin: 8px 0; }

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.chat-input-area {
    border-top: 1px solid var(--border);
    background: var(--bg);
    padding: 12px 20px 16px;
}

.chat-upload-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.chat-upload-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    max-width: 220px;
}

.chat-upload-tag.uploading { background: var(--warning-light); color: var(--warning); }
.chat-upload-tag.indexing { background: var(--info-light); color: var(--info); }
.chat-upload-tag.ready { background: var(--success-light); color: var(--success); }
.chat-upload-tag.failed { background: var(--danger-light); color: var(--danger); }

.chat-upload-tag .tag-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-upload-tag .fa-spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.chat-input {
    display: flex;
    gap: 8px;
}

.chat-input input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--bg-white);
}

.chat-input input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.btn-upload {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 12px;
    font-size: 1rem;
    transition: all var(--transition);
}

.btn-upload:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* ========== Tools ========== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.tool-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
}

.tool-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.tool-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.tool-card h3 { font-size: 1rem; margin-bottom: 4px; }
.tool-card p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.4; margin-bottom: 8px; }

.tool-phase {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--success);
    background: var(--success-light);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ========== Modal ========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1.1rem; }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.tool-result {
    margin-top: 16px;
}

.tool-result h4 { margin-bottom: 8px; }

.tool-result pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    max-height: 400px;
    overflow: auto;
    line-height: 1.5;
}

/* ========== Batch ========== */
.batch-controls {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.doc-checklist {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
}

.batch-results {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.batch-results h3 { margin-bottom: 12px; }

.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    margin-bottom: 4px;
    background: var(--bg);
}

/* ========== Settings ========== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.settings-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.settings-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 1rem;
}

.api-key-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.api-key-display code {
    flex: 1;
    font-size: 0.8rem;
    word-break: break-all;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ========== IDA Hero Banner ========== */
.ida-hero {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #6366f1 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 28px;
}

.ida-hero-content h3 { font-size: 1.35rem; font-weight: 700; margin-bottom: 6px; }
.ida-hero-content p { font-size: 0.9rem; opacity: 0.9; max-width: 520px; line-height: 1.5; }

.ida-hero .btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    padding: 10px 24px;
    font-weight: 600;
    flex-shrink: 0;
}
.ida-hero .btn:hover { background: rgba(255,255,255,0.3); }

/* ========== Dashboard Sections ========== */
.dashboard-section { margin-bottom: 32px; }

.dashboard-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

.dashboard-section-header i { color: var(--primary); font-size: 1rem; }

/* ========== Feature Tile Grid ========== */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ========== Feature Tile ========== */
.feature-tile {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
    text-decoration: none;
    color: var(--text);
    display: block;
}

.feature-tile:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-light);
    text-decoration: none;
}

.tile-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 12px;
}

.feature-tile h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.feature-tile p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; margin: 0; }

.feature-tile.quick-action { text-align: center; padding: 24px 16px; }
.feature-tile.quick-action .tile-icon { margin: 0 auto 12px; width: 48px; height: 48px; font-size: 1.2rem; }
.feature-tile.quick-action h4 { font-size: 1rem; }

/* ========== Batch History Banner ========== */
.batch-history-banner {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #6366f1 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.batch-history-banner .banner-content h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.batch-history-banner .banner-content p {
    font-size: 0.85rem;
    opacity: 0.9;
}

.batch-history-banner .banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.batch-history-banner .btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    padding: 8px 20px;
    font-weight: 600;
}

.batch-history-banner .btn:hover {
    background: rgba(255,255,255,0.3);
}

/* ========== Model Search / Provider Select ========== */
.model-search-container {
    position: relative;
}

.model-search-container .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 2;
}

.model-search-container input {
    padding-left: 34px !important;
}

.model-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 50;
}

.model-dropdown .model-option {
    padding: 8px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.model-dropdown .model-option:hover,
.model-dropdown .model-option.highlighted {
    background: var(--primary-light);
    color: var(--primary);
}

.model-dropdown .model-option.selected {
    background: var(--primary);
    color: #fff;
}

.model-dropdown .model-option .provider-tag {
    font-size: 0.7rem;
    opacity: 0.7;
}

.model-dropdown .no-results {
    padding: 12px 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* ========== File Tags ========== */
.file-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.file-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    max-width: 250px;
}

.file-tag .tag-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-tag .tag-size {
    font-size: 0.7rem;
    opacity: 0.7;
    white-space: nowrap;
}

.file-tag .tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    font-size: 0.75rem;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.file-tag .tag-remove:hover {
    opacity: 1;
}

/* ========== Prompt Actions ========== */
.prompt-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.prompt-actions select {
    flex: 1;
    padding: 6px 10px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
}

.prompt-actions .btn {
    padding: 5px 12px;
    font-size: 0.78rem;
}

/* ========== Document Search ========== */
.doc-search {
    position: relative;
    margin-bottom: 8px;
}

.doc-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.doc-search input {
    width: 100%;
    padding: 8px 14px 8px 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--bg-white);
}

.doc-search.model-search-right .search-icon {
    left: auto;
    right: 12px;
}

.doc-search.model-search-right input {
    padding: 8px 34px 8px 14px;
}

.doc-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* ========== Tab Toggle (pills) ========== */
.tab-toggle {
    display: inline-flex;
    background: var(--border-light);
    border-radius: var(--radius);
    padding: 3px;
    gap: 2px;
}

.tab-toggle button {
    padding: 7px 18px;
    border: none;
    background: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.tab-toggle button.active {
    background: var(--bg-white);
    color: var(--primary);
    box-shadow: var(--shadow);
    font-weight: 600;
}

.tab-toggle button:hover:not(.active) {
    color: var(--text);
}

/* ========== Section Card ========== */
.section-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.section-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.section-card h3 i { color: var(--primary); }

/* ========== Utilities ========== */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }

/* ========== Chat Sources Panel ========== */
.chat-sources-panel {
    width: 280px;
    border-left: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
    background: var(--bg);
    flex-shrink: 0;
}

.chat-sources-panel h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-sources-panel h4 i { color: var(--primary); font-size: 0.8rem; }

.source-card {
    display: block;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: var(--bg-white);
    transition: all var(--transition);
    text-decoration: none;
    color: var(--text);
}

.source-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.1);
    text-decoration: none;
}

.source-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
}

.source-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.source-filename {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.source-pages {
    background: var(--primary-light);
    color: var(--primary);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
    white-space: nowrap;
}

.source-summary {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== Source Detail Modal ========== */
.source-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 20px;
}

.source-modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.source-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border-light);
}

.source-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text);
}

.source-modal-meta {
    display: flex;
    gap: 16px;
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.source-modal-meta i {
    margin-right: 4px;
    color: var(--primary);
}

.source-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.source-modal-summary {
    margin-bottom: 16px;
}

.source-modal-summary h4,
.source-modal-text h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 8px;
}

.source-modal-summary p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.source-modal-text pre {
    margin: 0;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 0.82rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
    color: var(--text);
}

.source-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-top: 1px solid var(--border-light);
}

/* ========== Chat Tag Selector ========== */
.tag-selector {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tag-check {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.82rem;
    cursor: pointer;
}

.tag-check:hover { background: var(--border-light); }

.tag-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ========== Knowledge Base ========== */
.kb-upload-zone {
    max-width: 100%;
    margin-bottom: 0;
}

.kb-tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.kb-tag-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.kb-tag-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.kb-tag-card h4 { font-size: 0.95rem; margin: 0 0 2px; }

.tag-color-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kb-doc-list {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow);
}

.kb-doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
}

.kb-doc-item:last-child { border-bottom: none; }
.kb-doc-item:hover { background: var(--border-light); border-radius: var(--radius); }

.tag-detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========== Conversation List ========== */
.conv-list {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 4px;
}

.conv-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background var(--transition);
}

.conv-item:hover {
    background: var(--border-light);
}

.conv-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.conv-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.conv-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 3px;
    opacity: 0;
    transition: all var(--transition);
    flex-shrink: 0;
}

.conv-item:hover .conv-delete {
    opacity: 1;
}

.conv-delete:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* ========== Sources Badge ========== */
.sources-badge {
    font-size: 0.7rem;
    color: var(--primary);
    margin-left: 6px;
    font-weight: 500;
}

/* ========== Attach Modal ========== */
.attach-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attach-modal {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    width: 520px;
    max-width: 92vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.attach-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-light);
}

.attach-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.attach-modal-header h3 i {
    color: var(--primary);
}

.attach-modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-light);
    padding: 0 20px;
}

.attach-tab {
    flex: 1;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--transition);
}

.attach-tab:hover {
    color: var(--primary);
}

.attach-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.attach-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 12px 20px 0;
    min-height: 280px;
}

.attach-modal-search {
    position: relative;
    margin-bottom: 10px;
}

.attach-modal-search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.attach-modal-search input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--bg);
    box-sizing: border-box;
}

.attach-modal-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.attach-modal-select-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 2px 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.attach-clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0;
}

.attach-clear-btn:hover {
    text-decoration: underline;
}

.attach-modal-list {
    overflow-y: auto;
    max-height: 240px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.attach-modal-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.84rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
}

.attach-modal-item:hover {
    background: var(--bg);
}

.attach-modal-item.selected {
    background: var(--primary-light);
    border-color: var(--primary);
}

.attach-modal-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.attach-modal-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.attach-modal-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.attach-modal-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.attach-modal-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.attach-modal-empty i {
    font-size: 1.6rem;
}

.attach-upload-zone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-secondary);
    text-align: center;
}

.attach-upload-zone i {
    font-size: 2rem;
    color: var(--primary);
}

.attach-upload-zone p {
    margin: 0;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
}

.attach-upload-zone span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.attach-upload-zone:hover,
.attach-upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.attach-upload-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.attach-upload-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 0.82rem;
    border-radius: 4px;
    background: var(--bg);
}

.attach-upload-item.ready i { color: var(--success); }
.attach-upload-item.failed i { color: var(--danger); }
.attach-upload-item.uploading i { color: var(--primary); }

.attach-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
}

/* ========== Mention Popup ========== */
.mention-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 20px 80px;
    backdrop-filter: blur(2px);
}

.mention-popup {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.mention-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
}

.mention-popup-header i {
    margin-right: 6px;
    color: var(--primary);
}

.mention-popup-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 4px;
    line-height: 1;
}

.mention-popup-close:hover {
    color: var(--text);
}

.mention-popup-search {
    width: 100%;
    padding: 10px 18px;
    border: none;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    outline: none;
    background: var(--bg);
}

.mention-popup-search:focus {
    background: var(--bg-white);
}

.mention-popup-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 4px 0;
}

.mention-popup-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background var(--transition);
}

.mention-popup-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* ========== Tag Chip ========== */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.tag-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: 0.85rem;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.7;
}

.tag-chip-remove:hover {
    opacity: 1;
}

/* ========== Source Type Banner ========== */
.source-type-banner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.banner-documents {
    background: var(--success-light);
    color: var(--success);
}

.banner-general_knowledge {
    background: #dbeafe;
    color: #2563eb;
}

.banner-mixed {
    background: var(--warning-light);
    color: var(--warning);
}

.banner-web {
    background: #ede9fe;
    color: #7c3aed;
}

/* ========== Search Attempt Cards ========== */
.search-attempt-card {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    background: var(--bg-white);
    font-size: 0.82rem;
}

.search-attempt-card .attempt-filename {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
    display: inline-block;
}

.search-attempt-card .attempt-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    padding-left: 22px;
}

.attempt-found {
    border-left: 3px solid var(--success);
}

.attempt-found i { color: var(--success); }

.attempt-no_results {
    border-left: 3px solid var(--warning);
}

.attempt-no_results i { color: var(--warning); }

.attempt-error {
    border-left: 3px solid var(--danger);
}

.attempt-error i { color: var(--danger); }

.attempt-not_searched {
    border-left: 3px solid var(--text-muted);
}

.attempt-not_searched i { color: var(--text-muted); }

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    .sidebar span { display: none; }
    .content { margin-left: var(--sidebar-collapsed); padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: repeat(2, 1fr); }
    .tools-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .chat-sidebar { display: none; }
    .chat-sources-panel { display: none; }
    .quick-actions-grid { grid-template-columns: 1fr; }
    .feature-grid { grid-template-columns: 1fr 1fr; }
    .ida-hero { flex-direction: column; text-align: center; padding: 24px; }
    .kb-tags-grid { grid-template-columns: 1fr; }
}

/* Indexing Progress */
.indexing-progress-card {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.indexing-progress-bar {
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.indexing-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.indexing-error-card {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

/* Pipeline Log Panel */
.pipeline-log-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}
.pipeline-log-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-light);
}
.pipeline-log-body {
    background: #1a1b26;
    max-height: 320px;
    overflow-y: auto;
    padding: 10px 14px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.6;
}
.log-entry {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}
.log-ts {
    color: #565f89;
    flex-shrink: 0;
}
.log-level {
    flex-shrink: 0;
    font-weight: 600;
    min-width: 42px;
}
.log-msg {
    color: #a9b1d6;
    white-space: pre-wrap;
    word-break: break-word;
}
.log-info .log-level { color: #7aa2f7; }
.log-error .log-level { color: #f7768e; }
.log-error .log-msg { color: #f7768e; }
.log-debug .log-level { color: #9ece6a; }
.log-warning .log-level { color: #e0af68; }

.pipeline-log-body::-webkit-scrollbar { width: 6px; }
.pipeline-log-body::-webkit-scrollbar-track { background: transparent; }
.pipeline-log-body::-webkit-scrollbar-thumb { background: #414868; border-radius: 3px; }

/* Job History Table */
.jobs-section {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.jobs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 0.85rem;
}

.jobs-table th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.jobs-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-light);
}

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

.btn-warning {
    background: var(--warning);
    color: #fff;
    border: none;
}

.btn-warning:hover {
    background: #b45309;
}

/* ========== Batch Processing Page ========== */
.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 2px;
}

.bp-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.bp-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
}

.bp-card-header.clickable {
    cursor: pointer;
    justify-content: space-between;
}

.bp-card-header.clickable:hover {
    background: var(--bg);
}

.bp-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.bp-card-desc {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin: 2px 0 0;
}

.bp-card-body {
    padding: 20px 24px;
}

.bp-step-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.bp-step-badge.running {
    background: var(--primary);
    animation: pulse-badge 1.5s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(79, 70, 229, 0); }
}

.bp-prompt-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.bp-prompt-select {
    flex: 1;
    max-width: 300px;
}

.bp-prompt-textarea {
    width: 100%;
    min-height: 100px;
    resize: vertical;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    transition: border-color var(--transition);
}

.bp-prompt-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.bp-prompt-hint {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.bp-prompt-hint i {
    color: var(--warning);
}

.bp-doc-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.bp-doc-tab {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition);
}

.bp-doc-tab:not(:last-child) {
    border-right: 1px solid var(--border);
}

.bp-doc-tab.active {
    background: var(--primary);
    color: #fff;
}

.bp-doc-tab:hover:not(.active) {
    background: var(--bg);
}

.bp-tab-count {
    background: rgba(79, 70, 229, 0.15);
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
}

.bp-doc-tab.active .bp-tab-count {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.bp-doc-panel {
    min-height: 100px;
}

.bp-doc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.bp-search-box {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.bp-search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.bp-search-box input {
    width: 100%;
    padding: 7px 10px 7px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.bp-search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.bp-doc-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.bp-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.bp-selected-count {
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.bp-doc-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

.bp-doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border-light);
}

.bp-doc-item:last-child { border-bottom: none; }

.bp-doc-item:hover { background: var(--bg); }

.bp-doc-item.selected { background: rgba(79, 70, 229, 0.06); }

.bp-doc-item.compact { padding: 5px 10px; }

.bp-doc-icon {
    width: 28px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.bp-doc-info {
    flex: 1;
    min-width: 0;
}

.bp-doc-name {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bp-doc-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.bp-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 0.88rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.bp-empty i {
    font-size: 1.5rem;
    opacity: 0.4;
}

.bp-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 12px;
}

.bp-upload-zone:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.02);
}

.bp-upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.06);
}

.bp-upload-icon {
    font-size: 2.5rem;
    color: var(--primary);
    opacity: 0.5;
    margin-bottom: 10px;
}

.bp-upload-zone h4 {
    margin: 0 0 4px;
    color: var(--text);
}

.bp-upload-zone p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
}

.bp-upload-formats {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 3px 10px;
    border-radius: 20px;
}

.bp-file-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.bp-file-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--primary);
}

.bp-tag-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bp-tag-size {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.bp-tag-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 2px;
    font-size: 0.7rem;
}

.bp-tag-remove:hover { color: var(--danger); }

.bp-auto-index {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 12px;
    color: var(--text-secondary);
}

.bp-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 400;
}

.bp-ref-section {
    margin-top: 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.bp-ref-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg);
    font-size: 0.85rem;
}

.bp-ref-body {
    padding: 12px 14px;
    border-top: 1px solid var(--border-light);
}

.bp-ref-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 10px;
}

.bp-ref-search {
    position: relative;
    margin-bottom: 8px;
}

.bp-ref-search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.bp-ref-search input {
    width: 100%;
    padding: 6px 10px 6px 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.82rem;
}

.bp-ref-list {
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.bp-ref-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bp-ref-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: var(--success-light);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 16px;
    font-size: 0.75rem;
    color: var(--success);
}

.bp-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.bp-settings-grid.three-col {
    grid-template-columns: 2fr 1fr 1fr;
}

.bp-setting label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.bp-setting label i {
    color: var(--primary);
    font-size: 0.8rem;
}

.bp-setting select,
.bp-setting textarea {
    width: 100%;
}

.bp-setting-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.bp-model-row {
    display: flex;
    gap: 8px;
}

.bp-model-row select {
    flex: 1;
}

.bp-model-badge {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.bp-model-badge i {
    color: var(--primary);
}

.bp-range {
    width: 100%;
    margin-top: 4px;
    accent-color: var(--primary);
}

.bp-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.bp-action-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.bp-action-summary i {
    color: var(--primary);
}

.bp-action-buttons {
    display: flex;
    gap: 8px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 0.95rem;
}

.bp-btn-count {
    background: rgba(255,255,255,0.25);
    color: #fff;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 6px;
}

.bp-progress-card {
    border: 2px solid var(--primary);
}

.bp-progress-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.bp-progress-bar {
    flex: 1;
    height: 10px;
    background: var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}

.bp-progress-fill {
    height: 100%;
    border-radius: 8px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.bp-progress-fill.failed {
    background: var(--danger);
}

.bp-progress-pct {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 40px;
    text-align: right;
}

.bp-progress-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.bp-stat i { margin-right: 4px; }
.bp-stat.success i { color: var(--success); }
.bp-stat.danger i { color: var(--danger); }

.bp-item-list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

.bp-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}

.bp-item:last-child { border-bottom: none; }

.bp-item-icon { width: 20px; text-align: center; flex-shrink: 0; }
.bp-item-pending .bp-item-icon { color: var(--text-muted); }
.bp-item-running .bp-item-icon { color: var(--primary); }
.bp-item-completed .bp-item-icon { color: var(--success); }
.bp-item-failed .bp-item-icon { color: var(--danger); }

.bp-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-item-error { color: var(--danger); font-size: 0.78rem; }

.bp-history-card { }

.bp-history-table {
    width: 100%;
    border-collapse: collapse;
}

.bp-history-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.bp-history-table td {
    padding: 10px 12px;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-light);
}

.bp-history-table tr:hover td {
    background: var(--bg);
}

.bp-date {
    font-size: 0.82rem !important;
    color: var(--text-secondary);
}

.bp-mini-progress {
    height: 6px;
    width: 80px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.bp-mini-progress > div {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.bp-job-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.bp-job-prompt {
    background: var(--bg);
    padding: 10px;
    border-radius: var(--radius);
    white-space: pre-wrap;
    max-height: 120px;
    overflow-y: auto;
    font-size: 0.82rem;
    border: 1px solid var(--border);
}

.bp-job-result {
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}

.bp-result-pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 10px;
    border-radius: var(--radius);
    font-size: 0.78rem;
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    .bp-settings-grid,
    .bp-settings-grid.three-col {
        grid-template-columns: 1fr;
    }
    .bp-action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .bp-model-row {
        flex-direction: column;
    }
}

/* ========== Document Verifier ========== */
.verifier-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.verifier-input-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.verifier-results-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 12px;
}

.drop-zone:hover,
.drop-zone.drop-active {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.04);
}

.drop-zone-content p {
    margin: 0;
    font-weight: 600;
    color: var(--text);
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.file-item-info i {
    color: var(--primary);
    flex-shrink: 0;
}

.file-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item-size {
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.btn-icon-sm {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.btn-icon-sm:hover {
    color: var(--danger);
    background: rgba(220, 53, 69, 0.08);
}

.expectation-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.expectation-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text);
}

.expectation-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.verifier-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text);
    margin-top: 4px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.verifier-loading {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

.result-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: var(--card-bg);
    border-left: 4px solid var(--border);
}

.result-ok {
    border-left-color: var(--success);
}

.result-not_ok {
    border-left-color: var(--danger);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.result-status-icon i {
    font-size: 1.3rem;
}

.result-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.result-filename {
    font-weight: 600;
    font-size: 0.95rem;
}

.result-status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-ok {
    background: var(--success-light);
    color: var(--success);
}

.badge-not_ok {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

.result-summary {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.result-matches {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.match-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--border);
}

.match-icon {
    flex-shrink: 0;
    padding-top: 2px;
}

.match-details {
    flex: 1;
}

.match-expected {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.match-explanation {
    font-size: 0.83rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.confidence-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 8px;
    margin-top: 4px;
    font-weight: 600;
}

.conf-high {
    background: var(--success-light);
    color: var(--success);
}

.conf-medium {
    background: var(--warning-light);
    color: var(--warning);
}

.conf-low {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

.verifier-summary-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .verifier-layout {
        grid-template-columns: 1fr;
    }
}
