* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #0b0f19;
    color: #f1f5f9;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
    width: 320px;
    min-width: 320px;
    background-color: #0f172a;
    border-right: 1px solid #1e293b;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.brand-logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}
.brand-logo span { color: #6366f1; }
.brand-subtitle {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
}

.sidebar-divider {
    border: 0;
    border-top: 1px solid #1e293b;
    margin: 4px 0;
}

.section-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.sub-label {
    display: block;
    font-size: 0.72rem;
    color: #64748b;
    margin: 6px 0 4px;
}

.custom-select, .custom-file-input {
    width: 100%;
    padding: 8px 12px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #f8fafc;
    font-size: 0.85rem;
    outline: none;
    transition: 0.2s ease;
}
.custom-select:focus { border-color: #6366f1; }
.custom-file-input { padding: 6px; font-size: 0.8rem; }

.btn-primary {
    width: 100%;
    padding: 10px;
    background: #4f46e5;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 10px;
    transition: 0.2s;
}
.btn-primary:hover { background: #4338ca; }

.btn-danger {
    margin-top: auto;
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: 0.2s;
}
.btn-danger:hover {
    background: #ef4444;
    color: #fff;
}

.status-msg {
    font-size: 0.75rem;
    color: #a5b4fc;
    margin-top: 6px;
}

/* =========================================================
   DOC LIST & BADGES
   ========================================================= */
.doc-list-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
}

.doc-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
}
.doc-list-item:hover {
    border-color: #6366f1;
    background: #252e48;
}

.level-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}
.level-badge.umum { background: #065f46; color: #6ee7b7; }
.level-badge.internal { background: #1e40af; color: #93c5fd; }
.level-badge.pimpinan { background: #991b1b; color: #fca5a5; }

.tag-badge {
    display: inline-block;
    background: #1e293b;
    border: 1px solid #4338ca;
    color: #a5b4fc;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    margin-right: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: 0.2s;
}
.tag-badge:hover {
    background: #4338ca;
    color: #fff;
}

/* =========================================================
   WORKSPACE
   ========================================================= */
.main-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header-bar {
    padding: 14px 24px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header-title h2 { font-size: 1.1rem; color: #fff; }
.header-title p { font-size: 0.78rem; color: #64748b; }
.role-badge-text { color: #34d399; }

.workspace-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

.doc-pane {
    background: #0b0f19;
    border-right: 1px solid #1e293b;
    padding: 20px;
    overflow-y: auto;
}
.empty-state {
    text-align: center;
    color: #64748b;
    margin-top: 60px;
    font-size: 0.88rem;
}

.para-card {
    background: #131b2e;
    border: 1px solid #1e293b;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 10px;
}
.para-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: #6366f1;
    margin-bottom: 4px;
}

/* =========================================================
   CHAT PANE & AI ANSWER ALA GEMINI
   ========================================================= */
.chat-pane {
    background: #0d121f;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 12px 20px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
}
.cache-badge { font-size: 0.72rem; color: #34d399; font-weight: 600; }

.voice-bar {
    padding: 8px 20px;
    background: #131b2e;
    border-bottom: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.btn-voice {
    background: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
}
.btn-voice:hover { border-color: #6366f1; color: #fff; }
.voice-status { font-size: 0.72rem; color: #a5b4fc; margin-top: 4px; }

.chat-stream {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* User Message */
.message-node.user { align-self: flex-end; max-width: 80%; }
.message-node.user .bubble {
    background: #4f46e5;
    color: #fff;
    padding: 10px 16px;
    border-radius: 14px 14px 2px 14px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* AI Answer Card Style (Gemini Polish) */
.ai-answer-card {
    background: #131b2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    position: relative;
}

.ai-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #1e293b;
}

.ai-card-identity {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-avatar-sparkle {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ai-name-label {
    font-weight: 700;
    color: #f8fafc;
    font-size: 0.88rem;
    letter-spacing: -0.2px;
}

.engine-pill {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 700;
}
.engine-pill.gemini { background: #1e3a8a; color: #93c5fd; }
.engine-pill.groq { background: #7c2d12; color: #fdba74; }
.engine-pill.cache { background: #064e3b; color: #6ee7b7; }

/* Copy Answer Button */
.btn-copy-ans {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: 0.2s;
}
.btn-copy-ans:hover {
    background: #334155;
    color: #fff;
}

/* =========================================================
   MARKDOWN TYPOGRAPHY (RAPI, BERSTRUKTUR, JERNIH)
   ========================================================= */
.formatted-markdown {
    font-size: 0.92rem;
    line-height: 1.75;
    color: #cbd5e1;
}

.formatted-markdown p {
    margin-bottom: 14px;
}

.formatted-markdown h1,
.formatted-markdown h2,
.formatted-markdown h3,
.formatted-markdown h4 {
    color: #f8fafc;
    font-weight: 700;
    margin-top: 18px;
    margin-bottom: 10px;
    letter-spacing: -0.3px;
}

.formatted-markdown h3 {
    font-size: 1.05rem;
    color: #93c5fd; /* Soft Blue Header ala Gemini */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
}

.formatted-markdown ol {
    margin-left: 20px;
    margin-bottom: 16px;
}

.formatted-markdown ol > li {
    margin-bottom: 12px;
    padding-left: 4px;
    font-weight: 600;
    color: #f1f5f9;
}

.formatted-markdown ul {
    margin-left: 18px;
    margin-top: 6px;
    margin-bottom: 10px;
    list-style-type: disc;
}

.formatted-markdown ul > li {
    font-weight: normal;
    color: #cbd5e1;
    margin-bottom: 5px;
    line-height: 1.6;
}

.formatted-markdown strong {
    color: #e2e8f0;
    font-weight: 700;
}

.formatted-markdown blockquote {
    border-left: 3px solid #6366f1;
    padding: 8px 14px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 0 6px 6px 0;
    margin: 12px 0;
    color: #cbd5e1;
}

/* =========================================================
   REFERENSI KUTIPAN DOKUMEN & CHIPS
   ========================================================= */
.sources-container {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
}
.sources-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #818cf8;
    margin-bottom: 8px;
}
.sources-chips-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ref-link-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #0b0f19;
    border: 1px solid #1e293b;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    color: #cbd5e1;
    transition: all 0.2s ease;
}
.ref-link-chip:hover {
    background: #1e293b;
    border-color: #6366f1;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.ref-doc-title {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}
.ref-para-tag {
    background: #312e81;
    color: #c7d2fe;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Chat Input Bar */
.chat-input-bar {
    padding: 14px 20px;
    background: #0f172a;
    border-top: 1px solid #1e293b;
    display: flex;
    gap: 10px;
}
.chat-input-bar input {
    flex: 1;
    background: #1e293b;
    border: 1px solid #334155;
    padding: 12px 16px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: 0.2s;
}
.chat-input-bar input:focus { border-color: #6366f1; }
.btn-send {
    background: #4f46e5;
    color: #fff;
    border: none;
    padding: 0 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.btn-send:hover { background: #4338ca; }

/* =========================================================
   MODAL OVERLAY & HIGHLIGHT KUNING
   ========================================================= */
.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}
.custom-modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
}
.custom-modal-content {
    position: relative;
    background: #0f172a;
    border: 1px solid #334155;
    width: 90%;
    max-width: 850px;
    max-height: 85vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    z-index: 10;
}
.custom-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}
.modal-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}
.modal-close-btn:hover { color: #ef4444; }

.custom-modal-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-para-box {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}
.modal-para-num {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 4px;
}
.modal-para-text {
    font-size: 0.88rem;
    color: #cbd5e1;
    line-height: 1.6;
}

/* Highlight Paragraf Terpilih (Kuning Menyala) */
.modal-para-box.highlight-yellow {
    background: #fef08a !important;
    border: 2px solid #ca8a04 !important;
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.45);
}
.modal-para-num.highlight-num {
    color: #854d0e !important;
    font-weight: 800;
}
.modal-para-text.highlight-text {
    color: #1e293b !important;
    font-weight: 600 !important;
}