/* ========================================
   Enterprise Knowledge Base Demo - Styles
   ======================================== */

/* CSS Variables */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-bg: #eff6ff;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #0891b2;
    --info-bg: #cffafe;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --sidebar-width: 240px;
    --topbar-height: 56px;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

/* Layout */
.app-container { display: flex; height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: var(--gray-300);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s;
}

.sidebar-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--gray-700);
}

.sidebar-header .logo {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: white; font-weight: 700;
}

.sidebar-header .title { font-size: 15px; font-weight: 600; color: white; }
.sidebar-header .subtitle { font-size: 11px; color: var(--gray-500); }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; margin: 2px 0;
    border-radius: var(--radius);
    cursor: pointer; transition: all 0.2s;
    color: var(--gray-400); font-size: 13px; font-weight: 500;
}

.nav-item:hover { background: var(--gray-800); color: var(--gray-200); }
.nav-item.active { background: var(--primary); color: white; }
.nav-item .icon { width: 18px; text-align: center; font-size: 15px; }
.nav-item .badge {
    margin-left: auto; background: var(--danger); color: white;
    font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600;
}

.sidebar-footer {
    padding: 12px 16px; border-top: 1px solid var(--gray-700);
    display: flex; align-items: center; gap: 10px;
}

.sidebar-footer .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--gray-600); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
}

.sidebar-footer .user-info { flex: 1; }
.sidebar-footer .user-name { font-size: 12px; color: var(--gray-200); font-weight: 500; }
.sidebar-footer .user-role { font-size: 10px; color: var(--gray-500); }

/* Main Area */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; flex-shrink: 0;
}

.topbar .page-title { font-size: 16px; font-weight: 600; color: var(--gray-800); }
.topbar .topbar-actions { display: flex; align-items: center; gap: 12px; }

.topbar .global-search {
    width: 280px; padding: 6px 12px 6px 32px;
    border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: 13px; outline: none; transition: border-color 0.2s;
    background: var(--gray-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%239ca3af' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") 10px center no-repeat;
}

.topbar .global-search:focus { border-color: var(--primary); background-color: white; }

.icon-btn {
    width: 34px; height: 34px; border-radius: var(--radius);
    border: 1px solid var(--gray-200); background: white;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: var(--gray-600); transition: all 0.2s;
}
.icon-btn:hover { background: var(--gray-50); color: var(--gray-800); }

/* Content Area */
.content-area { flex: 1; overflow-y: auto; padding: 24px; }

/* Views */
.view { display: none; }
.view.active { display: block; }

/* Cards */
.card {
    background: white; border-radius: var(--radius-lg);
    box-shadow: var(--shadow); border: 1px solid var(--gray-200);
    overflow: hidden;
}

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

.card-header h3 { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.card-header .actions { display: flex; gap: 8px; }
.card-body { padding: 20px; }

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

.stat-card {
    background: white; border-radius: var(--radius-lg);
    box-shadow: var(--shadow); border: 1px solid var(--gray-200);
    padding: 20px; transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card .stat-icon {
    width: 44px; height: 44px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; margin-bottom: 12px;
}

.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--gray-800); line-height: 1.2; }
.stat-card .stat-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.stat-card .stat-trend { font-size: 11px; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* Buttons */
.btn {
    padding: 7px 16px; border-radius: var(--radius);
    border: none; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.2s;
    display: inline-flex; align-items: center; gap: 6px;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: white; color: var(--gray-600); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); color: var(--gray-800); border-color: var(--gray-400); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}

.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-approved { background: var(--success-bg); color: var(--success); }
.badge-processing { background: var(--info-bg); color: var(--info); }
.badge-ready { background: var(--primary-light); color: var(--primary); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* Tables */
table { width: 100%; border-collapse: collapse; }

.data-table th {
    text-align: left; padding: 10px 16px;
    font-size: 12px; font-weight: 600; color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50); text-transform: uppercase; letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 16px; font-size: 13px;
    border-bottom: 1px solid var(--gray-100); color: var(--gray-700);
}

.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* File type icons */
.file-icon {
    width: 28px; height: 32px; border-radius: 4px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700; color: white;
    position: relative; flex-shrink: 0;
}
.file-icon::after {
    content: ''; position: absolute; top: 0; right: 0;
    width: 0; height: 0; border-left: 5px solid transparent;
    border-top: 5px solid rgba(255,255,255,0.3);
}
.file-icon.pdf { background: #dc2626; }
.file-icon.docx { background: #2563eb; }
.file-icon.xlsx { background: #16a34a; }
.file-icon.txt { background: #6b7280; }
.file-icon.img { background: #7c3aed; }
.file-icon.scan { background: #d97706; }

/* Pipeline */
.pipeline-container { display: flex; flex-direction: column; gap: 0; }

.pipeline-step {
    display: flex; gap: 16px; position: relative;
    padding-bottom: 32px;
}

.pipeline-step:not(:last-child)::before {
    content: ''; position: absolute; left: 19px; top: 40px;
    width: 2px; height: calc(100% - 20px);
    background: var(--gray-200);
}

.pipeline-step.completed:not(:last-child)::before { background: var(--success); }
.pipeline-step.active:not(:last-child)::before { background: var(--primary); }

.pipeline-step .step-marker {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0; z-index: 1;
    border: 2px solid var(--gray-200); background: white; color: var(--gray-400);
    transition: all 0.3s;
}

.pipeline-step.completed .step-marker {
    border-color: var(--success); background: var(--success); color: white;
}
.pipeline-step.active .step-marker {
    border-color: var(--primary); background: var(--primary); color: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.pipeline-step .step-content { flex: 1; padding-top: 4px; }
.pipeline-step .step-title { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.pipeline-step .step-desc { font-size: 12px; color: var(--gray-500); margin-bottom: 8px; }
.pipeline-step .step-result {
    background: var(--gray-50); border: 1px solid var(--gray-200);
    border-radius: var(--radius); padding: 12px; font-size: 12px;
    color: var(--gray-600); margin-top: 8px;
    max-height: 200px; overflow-y: auto;
}
.pipeline-step .step-result pre { white-space: pre-wrap; word-break: break-all; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px; line-height: 1.5; }

/* Chat */
.chat-container { display: flex; height: calc(100vh - var(--topbar-height) - 48px); gap: 16px; }

.chat-sidebar {
    width: 260px; background: white; border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200); box-shadow: var(--shadow);
    display: flex; flex-direction: column; flex-shrink: 0;
}

.chat-sidebar-header { padding: 16px; border-bottom: 1px solid var(--gray-200); }
.chat-sidebar-header h3 { font-size: 14px; font-weight: 600; color: var(--gray-700); margin-bottom: 12px; }

.chat-history-list { flex: 1; overflow-y: auto; padding: 8px; }

.chat-history-item {
    padding: 10px 12px; border-radius: var(--radius);
    cursor: pointer; transition: background 0.2s; margin-bottom: 4px;
}

.chat-history-item:hover { background: var(--gray-50); }
.chat-history-item.active { background: var(--primary-bg); }
.chat-history-item .q { font-size: 12px; color: var(--gray-700); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-item .t { font-size: 10px; color: var(--gray-400); margin-top: 2px; }

.chat-main {
    flex: 1; background: white; border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200); box-shadow: var(--shadow);
    display: flex; flex-direction: column; overflow: hidden;
}

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

.chat-msg { display: flex; gap: 12px; margin-bottom: 20px; }
.chat-msg.user { flex-direction: row-reverse; }

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

.chat-msg.user .avatar { background: var(--primary); color: white; }
.chat-msg.ai .avatar { background: linear-gradient(135deg, var(--primary), #7c3aed); color: white; }

.chat-msg .msg-content { max-width: 70%; }
.chat-msg .msg-bubble {
    padding: 12px 16px; border-radius: var(--radius-lg);
    font-size: 13px; line-height: 1.7;
}

.chat-msg.user .msg-bubble { background: var(--primary); color: white; border-top-right-radius: 4px; }
.chat-msg.ai .msg-bubble { background: var(--gray-50); color: var(--gray-800); border: 1px solid var(--gray-200); border-top-left-radius: 4px; }

.chat-msg .msg-bubble p { margin-bottom: 8px; }
.chat-msg .msg-bubble p:last-child { margin-bottom: 0; }

/* Source citations */
.source-citation {
    margin-top: 10px; padding: 10px 12px;
    background: var(--primary-bg); border: 1px solid var(--primary-light);
    border-radius: var(--radius); font-size: 12px;
}

.source-citation .source-title {
    font-weight: 600; color: var(--primary-dark); margin-bottom: 4px;
    display: flex; align-items: center; gap: 4px;
}

.source-citation .source-content {
    color: var(--gray-600); font-size: 11px; line-height: 1.5;
    padding: 6px 8px; background: white; border-radius: 4px;
    border-left: 3px solid var(--primary); margin-top: 4px;
}

.source-citation .source-meta {
    color: var(--gray-400); font-size: 10px; margin-top: 4px;
}

/* Chat input */
.chat-input-area {
    padding: 16px 24px; border-top: 1px solid var(--gray-200);
    display: flex; gap: 12px; align-items: flex-end;
}

.chat-input {
    flex: 1; padding: 10px 14px; border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg); font-size: 13px; outline: none;
    resize: none; min-height: 42px; max-height: 120px;
    transition: border-color 0.2s; font-family: inherit;
}

.chat-input:focus { border-color: var(--primary); }

.chat-send-btn {
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--primary); color: white; border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 16px; transition: all 0.2s; flex-shrink: 0;
}

.chat-send-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Suggested questions */
.suggested-questions { padding: 0 24px 12px; }
.suggested-questions .label { font-size: 11px; color: var(--gray-400); margin-bottom: 6px; }
.suggestion-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.suggestion-chip {
    padding: 5px 12px; border: 1px solid var(--gray-300);
    border-radius: 20px; font-size: 12px; color: var(--gray-600);
    cursor: pointer; transition: all 0.2s; background: white;
}

.suggestion-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; padding: 4px 0; }
.typing-indicator span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--gray-400); 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; }
}

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--gray-300); border-radius: var(--radius-lg);
    padding: 40px; text-align: center; cursor: pointer;
    transition: all 0.3s; background: var(--gray-50);
}

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

.upload-zone .upload-icon { font-size: 40px; color: var(--gray-400); margin-bottom: 12px; }
.upload-zone .upload-text { font-size: 14px; color: var(--gray-600); margin-bottom: 4px; }
.upload-zone .upload-hint { font-size: 12px; color: var(--gray-400); }

/* OA sync */
.oa-sync-card {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-lg); padding: 20px;
    display: flex; align-items: center; gap: 16px; margin-bottom: 16px;
}

.oa-sync-card .sync-icon {
    width: 48px; height: 48px; border-radius: var(--radius);
    background: white; display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: var(--info);
}

.oa-sync-card .sync-info { flex: 1; }
.oa-sync-card .sync-title { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.oa-sync-card .sync-desc { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.oa-sync-card .sync-status { font-size: 11px; color: var(--success); margin-top: 4px; }

/* Knowledge base chunks */
.chunk-card {
    background: white; border: 1px solid var(--gray-200);
    border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
    transition: all 0.2s;
}

.chunk-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }

.chunk-card .chunk-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}

.chunk-card .chunk-source { font-size: 12px; font-weight: 600; color: var(--primary); }
.chunk-card .chunk-meta { font-size: 10px; color: var(--gray-400); }

.chunk-card .chunk-text {
    font-size: 12px; color: var(--gray-600); line-height: 1.6;
    background: var(--gray-50); padding: 8px 10px; border-radius: 4px;
}

.chunk-card .chunk-vector {
    margin-top: 8px; display: flex; gap: 2px; align-items: center;
}

.chunk-card .vector-bar {
    width: 3px; height: 16px; border-radius: 1px;
    background: var(--primary); opacity: 0.6;
}

/* Progress bar */
.progress-bar {
    width: 100%; height: 6px; background: var(--gray-200);
    border-radius: 3px; overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%; border-radius: 3px;
    background: var(--primary); transition: width 0.5s ease;
}

.progress-bar .progress-fill.success { background: var(--success); }
.progress-bar .progress-fill.warning { background: var(--warning); }

/* Two column layout */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 16px; }
.tab {
    padding: 8px 16px; font-size: 13px; font-weight: 500;
    color: var(--gray-500); cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all 0.2s;
}
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Modal */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 1000;
    align-items: center; justify-content: center;
}

.modal-overlay.active { display: flex; }

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

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

.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 8px; }

/* Review panel */
.review-panel { display: grid; grid-template-columns: 1fr 280px; gap: 16px; }

.doc-preview {
    background: var(--gray-50); border: 1px solid var(--gray-200);
    border-radius: var(--radius); padding: 20px; min-height: 400px;
    font-size: 13px; color: var(--gray-600); line-height: 1.8;
}

.doc-meta-panel { display: flex; flex-direction: column; gap: 12px; }

.meta-item {
    padding: 10px 12px; background: var(--gray-50); border-radius: var(--radius);
}

.meta-item .label { font-size: 11px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px; }
.meta-item .value { font-size: 13px; color: var(--gray-700); font-weight: 500; margin-top: 2px; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.pulse { animation: pulse 1.5s ease-in-out infinite; }

/* Empty state */
.empty-state { text-align: center; padding: 40px; color: var(--gray-400); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state .text { font-size: 13px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-gray { color: var(--gray-500); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.font-bold { font-weight: 600; }
.hidden { display: none !important; }

/* Highlight mark */
mark { background: #fef08a; color: var(--gray-800); padding: 1px 2px; border-radius: 2px; }

/* Process animation bar */
.process-animation {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; background: var(--info-bg);
    border-radius: var(--radius); margin-top: 8px;
}

.process-animation .spinner {
    width: 14px; height: 14px; border: 2px solid var(--info);
    border-top-color: transparent; border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.process-animation .text { font-size: 12px; color: var(--info); font-weight: 500; }

/* Similarity score */
.similarity-score {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 600;
}

.similarity-bar {
    width: 60px; height: 4px; background: var(--gray-200);
    border-radius: 2px; overflow: hidden;
}

.similarity-bar .fill {
    height: 100%; border-radius: 2px;
    background: var(--success); transition: width 0.5s;
}

/* ========================================
   Role Switch Popup & Employee Interface
   ======================================== */

/* Clickable Sidebar Footer */
.sidebar-footer {
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.sidebar-footer:hover { background: var(--gray-800); }

.sidebar-footer .footer-chevron {
    font-size: 14px; color: var(--gray-500);
    transition: transform 0.2s, color 0.2s;
    flex-shrink: 0;
}

.sidebar-footer:hover .footer-chevron { color: var(--gray-300); }

.sidebar-footer.role-menu-open .footer-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

/* Role Switch Popup */
.role-popup {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 12px; right: 12px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    z-index: 100;
    animation: rolePopupIn 0.2s ease;
}

@keyframes rolePopupIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.role-popup.show { display: block; }

.role-popup-header {
    padding: 10px 16px;
    font-size: 11px; font-weight: 600;
    color: var(--gray-400); text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
}

.role-popup-option {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--gray-100);
}

.role-popup-option:last-child { border-bottom: none; }
.role-popup-option:hover { background: var(--primary-bg); }

.role-popup-option .icon {
    width: 36px; height: 36px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; background: var(--gray-100); flex-shrink: 0;
}

.role-popup-option.active .icon {
    background: var(--primary-light);
}

.role-popup-option .role-info { flex: 1; }
.role-popup-option .role-name {
    font-size: 14px; font-weight: 600; color: var(--gray-800);
}
.role-popup-option .role-desc {
    font-size: 11px; color: var(--gray-400); margin-top: 2px;
}

.role-popup-option .role-check {
    font-size: 14px; color: var(--primary); font-weight: 700;
    opacity: 0; transition: opacity 0.15s;
}

.role-popup-option.active .role-check { opacity: 1; }

/* Nav Groups */
.nav-group { display: none; }
.nav-group.active { display: block; }

/* Employee Welcome Banner */
.emp-welcome-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-lg); padding: 32px;
    margin-bottom: 24px; color: white;
    box-shadow: 0 4px 14px rgba(102,126,234,0.3);
}

.emp-welcome-banner .welcome-content { max-width: 700px; }
.emp-welcome-banner h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.emp-welcome-banner p { font-size: 13px; opacity: 0.9; margin-bottom: 20px; line-height: 1.6; }

.emp-welcome-banner .welcome-quick-ask {
    display: flex; gap: 8px; background: rgba(255,255,255,0.15);
    border-radius: var(--radius-lg); padding: 6px;
    backdrop-filter: blur(4px);
}

.emp-welcome-banner .quick-ask-input {
    flex: 1; padding: 10px 14px; border: none; border-radius: var(--radius);
    font-size: 13px; outline: none; background: rgba(255,255,255,0.95);
    color: var(--gray-700);
}

.emp-welcome-banner .quick-ask-input::placeholder { color: var(--gray-400); }
.emp-welcome-banner .btn-primary {
    background: white; color: var(--primary);
    padding: 10px 20px; font-weight: 600;
}
.emp-welcome-banner .btn-primary:hover { background: var(--gray-100); }

/* Hot Questions */
.hot-question-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 8px; border-radius: var(--radius);
    cursor: pointer; transition: all 0.2s;
    border-bottom: 1px solid var(--gray-100);
}

.hot-question-item:last-child { border-bottom: none; }
.hot-question-item:hover { background: var(--primary-bg); }

.hot-question-item .hot-rank {
    width: 20px; text-align: center; font-size: 14px; flex-shrink: 0;
}

.hot-question-item .hot-q-text {
    flex: 1; font-size: 13px; color: var(--gray-700); font-weight: 500;
}

.hot-question-item .hot-asks {
    font-size: 11px; color: var(--gray-400); flex-shrink: 0;
}

/* Knowledge Updates */
.update-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 8px; border-bottom: 1px solid var(--gray-100);
}

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

.update-item .update-icon {
    width: 36px; height: 36px; border-radius: var(--radius);
    background: var(--primary-light); display: flex;
    align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}

.update-item .update-info { flex: 1; }
.update-item .update-title { font-size: 13px; font-weight: 500; color: var(--gray-700); }
.update-item .update-meta { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* Knowledge Category Grid */
.category-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}

.category-card {
    display: flex; flex-direction: column; align-items: center;
    padding: 20px 16px; border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg); cursor: pointer;
    transition: all 0.2s; background: var(--gray-50);
}

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

.category-card .cat-icon {
    width: 52px; height: 52px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; margin-bottom: 10px;
}

.category-card .cat-name {
    font-size: 14px; font-weight: 600; color: var(--gray-700);
}

.category-card .cat-count {
    font-size: 11px; color: var(--gray-400); margin-top: 4px;
}

/* Employee question table badge */
.emp-q-tab { cursor: pointer; }

/* Employee Document Submission */
.emp-upload-area { min-height: 200px; }

.emp-upload-form {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.emp-form-row {
    display: flex; gap: 16px; margin-bottom: 16px;
}

.emp-form-group {
    flex: 1; display: flex; flex-direction: column; gap: 6px;
}

.emp-form-group label {
    font-size: 12px; font-weight: 600; color: var(--gray-600);
}

.emp-form-input {
    padding: 8px 12px; border: 1px solid var(--gray-300);
    border-radius: var(--radius); font-size: 13px; outline: none;
    transition: border-color 0.2s; background: white;
    font-family: inherit;
}

.emp-form-input:focus { border-color: var(--primary); }

.emp-form-actions {
    display: flex; justify-content: flex-end; gap: 8px;
    padding-top: 8px; border-top: 1px solid var(--gray-200);
}

.emp-doc-tab { cursor: pointer; }

/* ========================================
   H5 Responsive
   ======================================== */

/* Hamburger */
.hamburger-btn { display: none; }

/* Sidebar overlay */
.sidebar-overlay { display: none; }

/* Tablet: 768–1024px */
@media(max-width:1024px){
  .stats-grid{grid-template-columns:repeat(2,1fr)}
  .two-col{grid-template-columns:1fr}
  .three-col{grid-template-columns:1fr 1fr}
  .category-grid{grid-template-columns:1fr 1fr}
  .review-panel{grid-template-columns:1fr}
  .chat-container{flex-direction:column}
  .chat-sidebar{width:100%;max-height:200px}
  .topbar .global-search{width:180px}
  .emp-welcome-banner{padding:24px}
  .emp-welcome-banner h2{font-size:18px}
  .emp-form-row{flex-wrap:wrap}
}

/* Mobile: <768px */
@media(max-width:767px){
  body{overflow:auto}
  .app-container{flex-direction:column}

  /* Sidebar → overlay drawer */
  .sidebar{
    position:fixed;top:0;left:0;height:100%;z-index:200;
    width:260px;transform:translateX(-100%);
    transition:transform 0.3s ease;box-shadow:2px 0 12px rgba(0,0,0,0.3);
  }
  .sidebar.open{transform:translateX(0)}
  .sidebar-overlay{
    display:block;position:fixed;top:0;left:0;width:100%;height:100%;
    background:rgba(0,0,0,0.45);z-index:150;opacity:0;pointer-events:none;
    transition:opacity 0.3s ease;
  }
  .sidebar-overlay.show{opacity:1;pointer-events:auto}

  /* Hamburger */
  .hamburger-btn{
    display:flex;width:32px;height:32px;flex-direction:column;
    justify-content:center;gap:5px;padding:4px;cursor:pointer;
    flex-shrink:0;z-index:210;border:none;background:none;
  }
  .hamburger-btn span{
    display:block;height:2px;background:var(--gray-700);border-radius:1px;
    transition:all 0.3s ease;
  }
  .hamburger-btn.open span:nth-child(1){transform:rotate(45deg) translate(5px,5px)}
  .hamburger-btn.open span:nth-child(2){opacity:0}
  .hamburger-btn.open span:nth-child(3){transform:rotate(-45deg) translate(5px,-5px)}

  /* Main area */
  .main-area{overflow:visible}

  /* Topbar */
  .topbar{height:48px;padding:0 12px;gap:8px;position:sticky;top:0;z-index:20}
  .topbar .page-title{font-size:14px}
  .topbar .global-search{width:120px;font-size:11px;padding:4px 8px 4px 26px;background-position:6px center;background-size:12px}
  .topbar .icon-btn{width:30px;height:30px;font-size:13px}

  /* Content */
  .content-area{padding:12px}

  /* Stats */
  .stats-grid{grid-template-columns:1fr 1fr;gap:10px}
  .stat-card{padding:14px}
  .stat-card .stat-icon{width:36px;height:36px;font-size:16px;margin-bottom:8px}
  .stat-card .stat-value{font-size:22px}
  .stat-card .stat-label{font-size:11px}
  .stat-card .stat-trend{font-size:10px}

  /* Cards */
  .card-header{padding:12px 14px;flex-wrap:wrap;gap:6px}
  .card-header h3{font-size:13px}
  .card-body{padding:14px}

  /* Two/three-col → single */
  .two-col{grid-template-columns:1fr}
  .three-col{grid-template-columns:1fr}
  .category-grid{grid-template-columns:1fr 1fr;gap:10px}
  .category-card{padding:14px 10px}
  .category-card .cat-icon{width:40px;height:40px;font-size:20px}
  .category-card .cat-name{font-size:12px}

  /* Review panel */
  .review-panel{grid-template-columns:1fr}
  .doc-preview{min-height:250px;padding:14px;font-size:12px}

  /* Tables */
  .data-table{font-size:11px}
  .data-table th,.data-table td{padding:8px 10px;white-space:nowrap}
  .card-body{overflow-x:auto;-webkit-overflow-scrolling:touch}

  /* Chat */
  .chat-container{flex-direction:column;height:calc(100vh - 48px - 24px);gap:8px}
  .chat-sidebar{width:100%;max-height:150px;flex-shrink:1;overflow-y:auto}
  .chat-sidebar-header{padding:10px 14px}
  .chat-sidebar-header h3{font-size:13px;margin-bottom:6px}
  .chat-main{flex:1;min-height:0}
  .chat-messages{padding:16px}
  .chat-msg .msg-content{max-width:85%}
  .chat-msg .msg-bubble{padding:10px 14px;font-size:12px}
  .chat-msg .avatar{width:30px;height:30px;font-size:12px}
  .suggested-questions{padding:0 16px 8px}
  .suggestion-chip{font-size:11px;padding:4px 10px}
  .chat-input-area{padding:12px 16px;gap:8px}

  /* Welcome banner */
  .emp-welcome-banner{padding:20px}
  .emp-welcome-banner h2{font-size:16px}
  .emp-welcome-banner p{font-size:11px}
  .emp-welcome-banner .welcome-quick-ask{flex-direction:column;gap:6px}
  .emp-welcome-banner .quick-ask-input{width:100%}
  .emp-welcome-banner .btn-primary{width:100%;justify-content:center}

  /* Forms */
  .emp-form-row{flex-direction:column;gap:10px}
  .emp-form-group label{font-size:11px}
  .emp-form-input{padding:6px 10px;font-size:12px}

  /* Pipeline */
  .pipeline-step{gap:12px;padding-bottom:24px}
  .pipeline-step .step-marker{width:32px;height:32px;font-size:14px}
  .pipeline-step .step-title{font-size:12px}
  .pipeline-step .step-desc{font-size:11px}

  /* Tabs */
  .tabs{overflow-x:auto;-webkit-overflow-scrolling:touch}
  .tab{padding:6px 12px;font-size:12px;white-space:nowrap}

  /* Upload zone */
  .upload-zone{padding:24px 16px}
  .upload-zone .upload-icon{font-size:32px}
  .upload-zone .upload-text{font-size:13px}
  .upload-zone .upload-hint{font-size:11px}

  /* OA sync */
  .oa-sync-card{flex-direction:column;text-align:center;padding:16px;gap:10px}

  /* Modal */
  .modal{width:95vw;max-height:85vh;border-radius:10px}
  .modal-header{padding:12px 16px}
  .modal-body{padding:14px 16px}

  /* Buttons */
  .btn{padding:6px 12px;font-size:12px}
  .btn-sm{padding:3px 8px;font-size:11px}

  /* Knowledge chunks */
  .chunk-card{padding:10px}
  .chunk-card .chunk-text{font-size:11px}

  /* Hot questions / Updates */
  .hot-question-item{padding:8px 4px}
  .hot-question-item .hot-q-text{font-size:12px}
  .update-item{padding:8px 4px}
  .update-item .update-title{font-size:12px}

  /* Utility overrides */
  .hidden-mobile{display:none!important}
}

/* Small Mobile: <480px */
@media(max-width:480px){
  .stats-grid{grid-template-columns:1fr;gap:8px}
  .category-grid{grid-template-columns:1fr}
  .topbar .global-search{width:80px;font-size:10px}
  .topbar .page-title{font-size:13px}
  .topbar .icon-btn{width:28px;height:28px;font-size:12px}
  .sidebar{width:240px}
  .emp-welcome-banner{padding:16px}
  .emp-welcome-banner h2{font-size:15px}
  .content-area{padding:8px}
  .card-body{padding:10px}
  .chat-messages{padding:12px}
  .chat-msg .msg-content{max-width:90%}
  .chat-input-area{padding:10px 12px}
}
