/* ========================================
   Sidebar & Layout Restructure
   ======================================== */

/* Source Filter Dropdown */
.source-filter-dropdown {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.source-filter-select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%23a78bfa' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.source-filter-select:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.6);
}

.source-filter-select option {
    background: #1e293b;
    color: #e2e8f0;
}

/* Source Filter Tabs (legacy, keep for backwards compatibility) */
.source-filter-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}

.source-filter-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.source-filter-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.source-filter-tab.active {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    color: #a78bfa;
}

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

.header-nav-buttons {
    display: flex;
    align-items: center;
}

.return-btn {
    font-size: 11px;
    color: white !important;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
}

.return-btn:hover {
    opacity: 1;
}

.document-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
}

.document-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.document-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

.document-card.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: #7c3aed;
}

.doc-card-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #ffffff !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.doc-card-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    gap: 8px;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff !important;
}

.document-list .empty-state {
    color: #ffffff !important;
    opacity: 0.8;
}

#pdf-filename, #viewport-doc-name {
    color: #ffffff !important;
}

.page-info {
    color: #ffffff !important;
}

#page-input {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    text-align: center;
}

/* ========================================
   URL Input Section
   ======================================== */

.url-input-section {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.url-input-header {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    font-weight: 500;
}

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

.url-text-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 13px;
}

.url-text-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.url-text-input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.6);
    background: rgba(255, 255, 255, 0.15);
}

.url-add-btn {
    padding: 8px;
    background: linear-gradient(135deg, #1e40af, #7c3aed);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.url-add-btn:hover {
    background: linear-gradient(135deg, #1e3a8a, #6d28d9);
    transform: translateY(-1px);
}

/* ========================================
   Source Badges
   ======================================== */

.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

.source-badge.web {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.source-badge.upload {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.source-badge.updated {
    background: rgba(234, 179, 8, 0.3);
    color: #fde047;
    font-weight: 600;
}

/* ========================================
   History Button
   ======================================== */

.history-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: rgba(234, 179, 8, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.history-btn:hover {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
}

/* ========================================
   Diff Panel & Overlay
   ======================================== */

.diff-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
}

.diff-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 1000px;
    max-height: 80vh;
    background: #1e293b;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.diff-header h3 {
    margin: 0;
    color: white;
    font-size: 16px;
}

.close-diff-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.close-diff-btn:hover {
    color: white;
}

.diff-summary {
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.diff-content {
    flex: 1;
    overflow: auto;
    padding: 20px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.diff-content table {
    width: 100%;
    border-collapse: collapse;
}

.diff-content td {
    padding: 4px 12px;
    vertical-align: top;
    white-space: pre-wrap;
    word-break: break-word;
}

.diff-content .diff_header {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    font-weight: 600;
    text-align: center;
}

.diff-content .diff_next {
    background: rgba(59, 130, 246, 0.1);
}

.diff-content .diff_add {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.diff-content .diff_chg {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
}

.diff-content .diff_sub {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* ========================================
   Chat Filters
   ======================================== */

.chat-filters {
    display: flex;
    gap: 8px;
    margin-left: auto;
    margin-right: 12px;
}

.chat-filter-select {
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 12px;
    cursor: pointer;
}

.chat-filter-select:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.6);
}

.chat-filter-select option {
    background: #1e293b;
    color: white;
}

/* ========================================
   Compliance Disclaimer
   ======================================== */

.compliance-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 6px;
    margin: 8px 12px;
    font-size: 11px;
    line-height: 1.5;
    color: #fde047;
}

.disclaimer-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

/* ========================================
   Library Version Bar
   ======================================== */

.library-version-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

.version-label {
    color: rgba(255, 255, 255, 0.5);
}

.version-value {
    color: #a78bfa;
    font-weight: 500;
}

/* ========================================
   Source Metadata & Version Badge
   ======================================== */

.source-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

.source-metadata-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.source-metadata-item svg {
    width: 10px;
    height: 10px;
    opacity: 0.7;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 5px;
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 500;
}

/* ========================================
   Refresh Button
   ======================================== */

.refresh-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.refresh-btn.refreshing svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* ========================================
   Version History Modal
   ======================================== */

.version-history-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
}

.version-history-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: #1e293b;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.version-history-header h3 {
    margin: 0;
    color: white;
    font-size: 16px;
}

.version-history-header .doc-name {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

.close-history-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.close-history-btn:hover {
    color: white;
}

.version-history-content {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

.version-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.version-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.version-history-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(139, 92, 246, 0.3);
}

.version-history-item.has-changes {
    border-left: 3px solid #fde047;
}

.version-history-item.failed {
    border-left: 3px solid #ef4444;
}

.version-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.version-number {
    font-size: 14px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.version-hash {
    font-size: 10px;
    font-family: 'Monaco', 'Menlo', monospace;
    color: rgba(139, 92, 246, 0.8);
    background: rgba(139, 92, 246, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

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

.version-error {
    font-size: 10px;
    color: rgba(239, 68, 68, 0.8);
    margin-top: 4px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   Diff & Pin Buttons
   ======================================== */

.view-diff-btn {
    padding: 6px 12px;
    background: rgba(234, 179, 8, 0.2);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 6px;
    color: #fde047;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-diff-btn:hover {
    background: rgba(234, 179, 8, 0.3);
    border-color: rgba(234, 179, 8, 0.5);
}

.view-diff-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pin-version-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    margin-left: auto;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 4px;
    color: #a78bfa;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.pin-version-btn:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}

.pin-version-btn.pinned {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.pin-version-btn svg {
    width: 12px;
    height: 12px;
}

/* ========================================
   Changes & Pinned Badges
   ======================================== */

.changes-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

.pinned-indicator {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    padding: 2px 6px;
    background: rgba(139, 92, 246, 0.2);
    border-radius: 4px;
    font-size: 10px;
    color: #a78bfa;
}

/* ========================================
   Refresh Status Badges
   ======================================== */

.refresh-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

.refresh-status-badge.processing {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
}

.refresh-status-badge.processing .spinner {
    width: 10px;
    height: 10px;
    border: 2px solid rgba(234, 179, 8, 0.3);
    border-top-color: #fde047;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.refresh-status-badge.ready {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.refresh-status-badge.failed {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ========================================
   Retry Button
   ======================================== */

.retry-btn {
    padding: 4px 10px;
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 4px;
    color: #a855f7;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.retry-btn:hover {
    background: rgba(168, 85, 247, 0.3);
    border-color: rgba(168, 85, 247, 0.5);
}

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

.retry-btn.retrying svg {
    animation: spin 1s linear infinite;
}

/* ========================================
   Confidence Banners
   ======================================== */

.confidence-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    margin-bottom: 8px;
}

.confidence-banner.high {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.confidence-banner.medium {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.confidence-banner.low {
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: #fde047;
}

.confidence-banner.not_found {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.confidence-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.pdf-sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.sidebar-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-tab.active {
    color: #a78bfa;
    border-bottom-color: #7c3aed;
    background: rgba(139, 92, 246, 0.1);
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.tab-content.active {
    display: block;
}

.thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.thumbnail-item {
    cursor: pointer;
    transition: transform 0.2s;
}

.thumbnail-item:hover {
    transform: scale(1.05);
}

.thumbnail-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.thumbnail-item.active .thumbnail-wrapper {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.4);
}

.thumbnail-page-num {
    display: block;
    text-align: center;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

.thumbnail-item.active .thumbnail-page-num {
    color: #a78bfa;
    font-weight: 600;
}

.sections-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
}

.section-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 10px 16px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    margin-left: 0;
}

.section-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--page-color, #8b5cf6);
    border-radius: 0 2px 2px 0;
    transition: width 0.2s ease;
}

.section-nav-item .heading-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-nav-item:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.05);
}

.section-nav-item:hover::before {
    width: 5px;
}

.section-nav-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.section-nav-item.active::before {
    width: 6px;
}

.section-nav-item.active .page-badge {
    color: #ffffff;
}

.section-nav-item .page-badge {
    flex-shrink: 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    background: transparent;
    padding: 3px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.section-nav-item.scroll-pulse {
    animation: sectionPulse 0.4s ease-out;
}

@keyframes sectionPulse {
    0% { background: rgba(255, 255, 255, 0.15); }
    50% { background: rgba(255, 255, 255, 0.25); }
    100% { background: rgba(255, 255, 255, 0.1); }
}

.explain-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    margin-top: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.explain-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}

.explain-btn.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}

.explain-btn svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
}

.explain-btn.active svg {
    transform: rotate(180deg);
}

.explain-drawer {
    display: none;
    margin-top: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 12px;
}

.explain-drawer.open {
    display: block;
    animation: slideDown 0.2s ease-out;
}

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

.explain-section {
    margin-bottom: 12px;
}

.explain-section:last-child {
    margin-bottom: 0;
}

.explain-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 6px;
}

.explain-section-value {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
}

.explain-scope-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 4px;
    color: #a78bfa;
    font-size: 11px;
    font-weight: 500;
}

.explain-pinned-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.explain-pinned-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 4px;
    font-size: 11px;
    color: #86efac;
}

.explain-reason-text {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid rgba(139, 92, 246, 0.5);
    border-radius: 0 4px 4px 0;
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
}

.no-pinned-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

/* ========================================
   Chunk Explanation Table
   ======================================== */

.explain-chunks-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
}

.explain-chunks-table th,
.explain-chunks-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.explain-chunks-table th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
}

.explain-chunks-table td {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
}

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

.chunk-score {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 3px;
    color: #93c5fd;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 10px;
}

.chunk-heading {
    color: #a78bfa;
    font-size: 10px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chunk-preview {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.8;
}

/* ========================================
   Metrics Panel
   ======================================== */

.metrics-panel {
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.08);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.metrics-panel.collapsed {
    max-height: 0;
    padding: 0 12px;
    border-bottom: none;
}

.metrics-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 10px;
    cursor: pointer;
    padding: 2px 4px;
    margin-left: auto;
    transition: color 0.2s;
}

.metrics-toggle:hover {
    color: #a78bfa;
}

.metrics-toggle svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
}

.metrics-toggle.expanded svg {
    transform: rotate(180deg);
}

.metrics-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.metric-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 4px;
    color: #a78bfa;
    font-size: 10px;
    font-weight: 500;
}

.metric-value {
    color: white;
}

/* ========================================
   Bulk Actions Bar
   ======================================== */

.bulk-actions-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.15);
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
}

.bulk-actions-bar.visible {
    display: flex;
}

.bulk-selection-info {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-right: auto;
}

.bulk-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.bulk-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.bulk-btn.primary {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
    color: #c4b5fd;
}

.bulk-btn.primary:hover {
    background: rgba(139, 92, 246, 0.4);
}

.bulk-btn svg {
    width: 12px;
    height: 12px;
}

/* ========================================
   Select All Container
   ======================================== */

.select-all-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.source-checkbox {
    width: 14px;
    height: 14px;
    accent-color: #a78bfa;
}

/* ========================================
   Onboarding Wizard
   ======================================== */

.onboarding-wizard {
    padding: 16px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.onboarding-header {
    margin-bottom: 12px;
}

.onboarding-header h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: white;
    font-weight: 600;
}

.onboarding-header p {
    margin: 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.starter-sources {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.pinning-section {
    padding: 10px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 6px;
}

.pinning-section h5 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px 0;
    font-size: 11px;
    color: #a78bfa;
    font-weight: 600;
}

.pinning-section p {
    margin: 0 0 8px 0;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
}

.pinning-examples {
    margin: 0;
    padding-left: 16px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

.pinning-examples li {
    margin-bottom: 4px;
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
    padding: 20px 12px;
    text-align: center;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    color: rgba(139, 92, 246, 0.5);
}

.empty-state h4 {
    margin: 0 0 6px 0;
    color: white;
    font-size: 14px;
}

.empty-state p {
    margin: 0 0 16px 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* ========================================
   Suggestion Box
   ======================================== */

.suggestion-box {
    margin-top: 12px;
    padding: 12px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 6px;
}

.suggestion-box-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 500;
    color: #93c5fd;
}

.suggestion-box-header svg {
    width: 14px;
    height: 14px;
}

.suggestion-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}

.keyword-tag {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 3px;
    font-size: 10px;
    color: #93c5fd;
}

.suggestion-urls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.suggestion-url-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.suggestion-url-title {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
}

.suggestion-add-btn {
    padding: 3px 8px;
    background: rgba(59, 130, 246, 0.3);
    border: none;
    border-radius: 3px;
    color: #93c5fd;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-add-btn:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* ========================================
   Not Found Message
   ======================================== */

.not-found-message {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid rgba(239, 68, 68, 0.5);
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.not-found-message .message-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #fca5a5;
}

.not-found-message .message-header svg {
    width: 16px;
    height: 16px;
}

/* ========================================
   Compliance Guidance Banner Override
   ======================================== */

.compliance-disclaimer + .guidance-banner,
.chat-panel .guidance-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    margin-bottom: 12px;
}

.chat-panel .guidance-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1;
    width: auto;
    height: auto;
    background: none;
    border-radius: 0;
}

.chat-panel .guidance-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
}

.chat-panel .guidance-text strong {
    color: white;
    font-weight: 600;
    display: inline;
    margin-bottom: 0;
}

/* ========================================
   Starter Source Items (Onboarding)
   ======================================== */

.starter-source-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    transition: all 0.2s;
}

.starter-source-item:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(139, 92, 246, 0.5);
}

.starter-source-info {
    flex: 1;
    min-width: 0;
}

.starter-source-title {
    font-size: 12px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
}

.starter-source-desc {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.starter-add-btn {
    padding: 4px 10px;
    background: linear-gradient(135deg, #1e40af, #7c3aed);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.starter-add-btn:hover {
    background: linear-gradient(135deg, #1e3a8a, #6d28d9);
    transform: translateY(-1px);
}

.starter-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.starter-add-btn.added {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

/* ========================================
   Select All Container Label
   ======================================== */

.select-all-container label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
}

/* ========================================
   Bulk Button Disabled State
   ======================================== */

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

/* ========================================
   Upload Actions Container
   ======================================== */

.upload-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 12px;
}

.upload-actions .bulk-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    min-width: fit-content;
}

.upload-actions .bulk-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.upload-actions .bulk-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.upload-actions .bulk-btn.primary {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    color: white;
}

.upload-actions .bulk-btn.primary:hover {
    background: linear-gradient(135deg, #6d28d9, #9333ea);
}

/* ========================================
   Library Link (Sidebar Header)
   ======================================== */

.library-nav-buttons {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.library-link {
    padding: 3px 8px;
    background: rgba(139, 92, 246, 0.25);
    border-radius: 6px;
    font-size: 0.65rem;
    color: #c4b5fd;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: all 0.2s;
    white-space: nowrap;
}

.library-link:hover {
    background: rgba(139, 92, 246, 0.35);
    color: #e9d5ff;
}

/* ========================================
   Welcome Panel Text Styles
   ======================================== */

.welcome-subtext {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.welcome-examples-label {
    margin-top: 12px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

.welcome-examples-label strong {
    color: rgba(255, 255, 255, 0.9);
}

.welcome-examples-list {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    padding: 0 0 0 20px;
    margin: 4px 0;
}

.welcome-examples-list li {
    margin-bottom: 4px;
}

/* ========================================
   Figures Panel Text
   ======================================== */

.figures-intro-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin: 8px 0;
    line-height: 1.5;
}

/* ========================================
   Onboarding Example Steps
   ======================================== */

.onboarding-steps {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    padding: 0 0 0 20px;
    margin: 8px 0;
}

.onboarding-steps li {
    margin-bottom: 6px;
}

/* ========================================
   DEPRECATED: 4-Pane Comparison Mode Layout
   ======================================== 
   
   NOTE: These styles are deprecated as of Jan 2026.
   The new single-viewport layout uses .main-content-area,
   .pdf-viewport, .annotations-rail, and .chat-panel.
   Keeping these for backward compatibility with any
   legacy code that may still reference them.
   
   Layout: PDF | Chat | PDF | Chat
   Each document pair (PDF + Chat) forms a "comparison column"
   
   ======================================== */

.compare-mode .split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.compare-mode .comparison-column {
    display: flex;
    min-width: 0;
    border-left: 1px solid rgba(139, 92, 246, 0.3);
}

.compare-mode .comparison-column:first-child {
    border-left: none;
}

.compare-mode .comparison-column .pdf-panel {
    flex: 0 0 50%;
    min-width: 200px;
}

.compare-mode .comparison-column .chat-panel {
    flex: 1;
    min-width: 200px;
}

.compare-mode .comparison-column .resize-handle-h {
    flex-shrink: 0;
}

.compare-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.95) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.compare-column-header.primary {
    border-bottom-color: rgba(139, 92, 246, 0.4);
}

.compare-column-header.secondary {
    border-bottom-color: rgba(234, 179, 8, 0.4);
}

.compare-column-header .column-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.compare-column-header .column-label .badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.compare-column-header.primary .badge {
    background: rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
}

.compare-column-header.secondary .badge {
    background: rgba(234, 179, 8, 0.25);
    color: #fde047;
}

.compare-column-header .doc-title {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compare-column-header .swap-btn {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.compare-column-header .swap-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.compare-mode .pdf-toolbar {
    padding: 6px 10px;
    gap: 8px;
}

.compare-mode .pdf-toolbar .pdf-zoom {
    margin-left: auto;
}

.compare-mode .pdf-filename {
    display: none;
}

.compare-mode .chat-header h3 {
    font-size: 0.8rem;
}

.compare-mode .guidance-banner {
    padding: 8px 12px;
    font-size: 11px;
}

.compare-mode .guidance-banner .guidance-icon {
    font-size: 14px;
}

.compare-divider {
    width: 4px;
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.4) 0%, rgba(234, 179, 8, 0.4) 100%);
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
}

.compare-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 1px;
}

.compare-divider:hover {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.6) 0%, rgba(234, 179, 8, 0.6) 100%);
}

.compare-divider:hover::before {
    background: rgba(255, 255, 255, 0.5);
}

.compare-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.1) 0%, rgba(234, 179, 8, 0.1) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.compare-toolbar .compare-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.compare-toolbar .compare-title svg {
    width: 16px;
    height: 16px;
    color: #a78bfa;
}

.compare-toolbar .exit-compare-btn {
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #fca5a5;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.compare-toolbar .exit-compare-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

@media (max-width: 1200px) {
    .compare-mode .split-view {
        grid-template-columns: 1fr;
    }
    
    .compare-mode .comparison-column {
        border-left: none;
        border-top: 1px solid rgba(139, 92, 246, 0.3);
    }
    
    .compare-mode .comparison-column:first-child {
        border-top: none;
    }
    
    .compare-divider {
        width: 100%;
        height: 4px;
        cursor: row-resize;
    }
    
    .compare-divider::before {
        width: 40px;
        height: 2px;
    }
}

/* ========================================
   Text-to-Chat Selection Popup
   ======================================== */

.text-selection-popup {
    display: flex;
    animation: popupFadeIn 0.15s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.text-selection-popup button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.text-selection-popup button:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.5);
    color: #e9d5ff;
}

.text-selection-popup button svg {
    flex-shrink: 0;
}

.text-selection-popup .send-to-chat-btn {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(109, 40, 217, 0.3));
    border-color: rgba(139, 92, 246, 0.4);
}

.text-selection-popup .send-to-chat-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.5), rgba(109, 40, 217, 0.5));
}

/* ========================================
   Reader Mode - Focused Document View
   ======================================== */

.reader-mode .docqa-sidebar {
    display: none !important;
}

.reader-mode .docqa-main {
    width: 100%;
}

.reader-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(30, 41, 59, 0.95);
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
    backdrop-filter: blur(10px);
}

.back-to-library-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.back-to-library-btn:hover,
.back-to-workspace-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: #e9d5ff;
}

.back-to-workspace-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.reader-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reader-actions {
    display: flex;
    gap: 8px;
}

.reader-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reader-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: #e9d5ff;
}

.reader-mode .split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - 120px);
}

.reader-mode .pdf-panel,
.reader-mode .chat-panel {
    height: 100%;
    min-width: 0;
}

/* ========================================
   Collapsible Sidebar Sections
   ======================================== */

.collapsible-section {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    transition: background 0.2s ease;
}

.collapsible-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.collapse-chevron {
    transition: transform 0.2s ease;
}

.collapsible-section.collapsed .collapse-chevron {
    transform: rotate(-90deg);
}

.collapsible-content {
    padding: 0 12px 12px 12px;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.2s ease, padding 0.2s ease;
}

.collapsible-section.collapsed .collapsible-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.filter-row {
    margin-bottom: 8px;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.sidebar-filter {
    width: 100%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.sidebar-filter:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(139, 92, 246, 0.3);
}

.sidebar-filter:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.1);
}

.sidebar-filter option {
    background: #1e293b;
    color: rgba(255, 255, 255, 0.9);
}

/* ========================================
   Snap Animation for Panels
   ======================================== */

.snapped {
    transition: flex-basis 0.15s ease-out, width 0.15s ease-out !important;
}

.snapped::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid rgba(139, 92, 246, 0.4);
    border-radius: 4px;
    pointer-events: none;
    animation: snapPulse 0.3s ease-out;
}

@keyframes snapPulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.01);
    }
}

/* ========================================
   Chat Header & Clear Button
   ======================================== */

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.chat-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
}

.clear-chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-chat-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.clear-chat-btn:active {
    transform: scale(0.97);
}

.clear-chat-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ========================================
   Viewport Focus Ring Animation
   ======================================== */

.viewport-active {
    position: relative;
}

.viewport-active::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid rgba(139, 92, 246, 0.6);
    border-radius: 8px;
    pointer-events: none;
    z-index: 10;
    animation: viewportFocusRing 0.5s ease-out forwards;
}

@keyframes viewportFocusRing {
    0% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.8);
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.3);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
        opacity: 1;
    }
}

.viewport-active.fade-ring::before {
    animation: viewportFocusFade 2s ease-out forwards;
}

@keyframes viewportFocusFade {
    0% {
        box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3);
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* ========================================
   Dual Viewport Layout System
   ======================================== */

/* Sidebar collapse toggle - consolidated in bottom bar section */

/* Chat Collapse Toggle */
.chat-collapse-toggle {
    position: absolute;
    right: 350px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    width: 24px;
    height: 48px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-collapse-toggle:hover {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.chat-collapse-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.docqa-main.chat-collapsed .chat-collapse-toggle {
    right: 0;
}

.docqa-main.chat-collapsed .chat-collapse-toggle svg {
    transform: rotate(180deg);
}

.docqa-main.chat-collapsed .chat-panel {
    width: 0;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: none;
}

/* Chat Panel (350px fixed width) */
.chat-panel {
    width: 350px;
    min-width: 350px;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

/* Viewport Panels */
.viewport-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.98);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    min-width: 300px;
    transition: flex 0.2s ease;
}

/* Hide viewport-header in compliance-chat - buttons are duplicated in PDF viewer component */
.docqa-container .viewport-header,
.docqa-container .pdf-viewport > .viewport-header,
#pdf-viewport > .viewport-header {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    visibility: hidden !important;
}

.viewport-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    flex-shrink: 0;
}

.viewport-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(139, 92, 246, 0.8);
    letter-spacing: 0.5px;
}

.viewport-doc-name {
    flex: 1;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewport-fullscreen-btn,
.viewport-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.viewport-fullscreen-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.viewport-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* DEPRECATED: Viewport Divider - replaced by annotations-rail border */
.viewport-divider {
    width: 6px;
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.3), rgba(234, 179, 8, 0.3));
    cursor: col-resize;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.viewport-divider:hover {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.5), rgba(234, 179, 8, 0.5));
}

.viewport-divider .divider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 40px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

/* Placeholder Hint */
.placeholder-hint {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 8px;
}

/* ========================================
   Main Content Area (Single Viewport Layout)
   ======================================== */

.main-content-area {
    display: flex;
    flex-direction: row;
    flex: 1;
    height: 100%;
    width: 100%;
    gap: 0;
    position: relative;
    min-height: 0;
}

/* ========================================
   PDF Viewport (Single Viewport)
   ======================================== */

.pdf-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.98);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    min-width: 300px;
    min-height: 0;
    height: 100%;
    transition: flex 0.2s ease;
}

/* PDF Viewer Wrapper - Contains PDFViewerComponent */
.pdf-viewer-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.pdf-viewer-wrapper .pdf-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    z-index: 5;
}

.pdf-viewer-wrapper .pdf-viewer-component {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.pdf-viewer-wrapper .pdf-toolbar {
    flex-shrink: 0;
}

.pdf-viewer-wrapper .pdf-canvas-container {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.annotation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    display: none;
    cursor: default;
    pointer-events: none;
}

.annotation-overlay.active,
body.pin-mode-active .annotation-overlay {
    display: block;
    cursor: crosshair;
    pointer-events: auto;
}

/* ========================================
   Annotations Rail
   ======================================== */

.annotations-rail {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.98);
    border-left: 2px solid rgba(139, 92, 246, 0.3);
    overflow: hidden;
    transition: all 0.3s ease;
}

.annotations-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(139, 92, 246, 0.08);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    flex-shrink: 0;
}

.annotations-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #a78bfa;
}

.annotations-collapse-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.annotations-collapse-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

/* Annotations Collapse Toggle */
.annotations-collapse-toggle {
    position: absolute;
    z-index: 100;
    width: 24px;
    height: 48px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px 0 0 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    right: 650px;
    top: 50%;
    transform: translateY(-50%);
}

.annotations-collapse-toggle:hover {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.annotations-collapse-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

/* Annotations Collapsed State */
.docqa-main.annotations-collapsed .annotations-collapse-toggle {
    right: 350px;
}

.docqa-main.annotations-collapsed .annotations-collapse-toggle svg {
    transform: rotate(180deg);
}

.docqa-main.annotations-collapsed .annotations-rail {
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    overflow: hidden;
    border: none;
}

/* When both annotations and chat are collapsed */
.docqa-main.annotations-collapsed.chat-collapsed .annotations-collapse-toggle {
    right: 0;
}

/* ========================================
   Emoji Pins Section
   ======================================== */

.emoji-pins-section {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.emoji-pins-section .section-header,
.paragraph-notes-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.emoji-pins-section .section-header h4,
.paragraph-notes-section .section-header h4 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.add-pin-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 4px;
    color: #a78bfa;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.add-pin-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.5);
}

.emoji-pins-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.emoji-pins-list .empty-state,
.notes-list .empty-state {
    padding: 16px 12px;
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
}

.emoji-pin-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.emoji-pin-item:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
}

.emoji-pin-item .pin-emoji {
    font-size: 18px;
    flex-shrink: 0;
}

.emoji-pin-item .pin-page {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-left: auto;
}

.emoji-pin-item .pin-delete {
    background: none;
    border: none;
    color: rgba(239, 68, 68, 0.5);
    cursor: pointer;
    padding: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.emoji-pin-item:hover .pin-delete {
    opacity: 1;
}

.emoji-pin-item .pin-delete:hover {
    color: #ef4444;
}

/* ========================================
   Emoji Picker
   ======================================== */

.emoji-picker {
    margin-top: 10px;
    padding: 10px;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.emoji-option {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.emoji-option:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    transform: scale(1.1);
}

/* ========================================
   Paragraph Notes Section
   ======================================== */

.paragraph-notes-section {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.note-input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: flex-end;
}

.note-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    padding: 8px 10px;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
}

.note-input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
}

.note-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.add-note-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    color: #a78bfa;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.add-note-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.5);
}

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

.notes-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.note-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.note-item:hover {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.2);
}

.note-colour-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 3px;
}

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

.note-preview {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-page {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
}

.note-delete {
    background: none;
    border: none;
    color: rgba(239, 68, 68, 0.5);
    cursor: pointer;
    padding: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

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

.note-delete:hover {
    color: #ef4444;
}

/* ========================================
   Colour Palette
   ======================================== */

.colour-palette {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.palette-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-right: 4px;
}

.colour-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
}

.colour-swatch:hover {
    transform: scale(1.15);
}

.colour-swatch.active {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.5);
}

/* Pin mode indicator */
body.pin-mode-active {
    cursor: crosshair !important;
}

body.pin-mode-active .annotation-overlay {
    pointer-events: auto;
    cursor: crosshair;
}

/* Delete buttons in annotation rail */
.pin-delete-btn,
.note-delete-btn {
    background: none;
    border: none;
    color: rgba(239, 68, 68, 0.5);
    cursor: pointer;
    padding: 4px;
    opacity: 0;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    margin-left: auto;
}

.emoji-pin-item:hover .pin-delete-btn,
.note-item:hover .note-delete-btn {
    opacity: 1;
}

.pin-delete-btn:hover,
.note-delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Note colour indicator bar */
.note-colour-indicator {
    width: 4px;
    height: 100%;
    min-height: 30px;
    border-radius: 2px;
    flex-shrink: 0;
}

.note-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
}

.note-meta {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
}

/* ========================================
   Annotation Overlay (PDF Highlights)
   ======================================== */

.annotation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    display: none;
}

.annotation-highlight {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    border-radius: 2px;
    transition: opacity 0.15s ease;
}

.annotation-highlight:hover {
    opacity: 0.9;
}

.annotation-highlight.yellow { background: rgba(255, 235, 59, 0.4); }
.annotation-highlight.green { background: rgba(76, 175, 80, 0.4); }
.annotation-highlight.blue { background: rgba(33, 150, 243, 0.4); }
.annotation-highlight.orange { background: rgba(255, 152, 0, 0.4); }
.annotation-highlight.pink { background: rgba(233, 30, 99, 0.4); }
.annotation-highlight.purple { background: rgba(156, 39, 176, 0.4); }

.annotation-emoji-pin {
    position: absolute;
    font-size: 24px;
    transform: translate(-50%, -100%);
    cursor: pointer;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    pointer-events: auto;
    transition: transform 0.15s ease;
}

.annotation-emoji-pin:hover {
    transform: translate(-50%, -100%) scale(1.2);
}

/* Chat Header Actions */
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-doc-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    font-size: 11px;
    color: #a78bfa;
}

.chat-doc-indicator svg {
    stroke: currentColor;
}

/* Document Row Viewport Selector */
.doc-viewport-selector {
    display: none;
    gap: 4px;
    margin-top: 6px;
}

.doc-viewport-selector.always-visible {
    display: flex;
}

.document-item:hover .doc-viewport-selector,
.document-item:focus-within .doc-viewport-selector,
.document-item.show-selector .doc-viewport-selector {
    display: flex;
}

.viewport-load-btn {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.viewport-load-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}

.viewport-load-btn.active {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.5);
    color: #a78bfa;
}

.viewport-load-btn svg {
    width: 10px;
    height: 10px;
}

/* Viewport Badge on Document Row */
.doc-viewport-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    margin-left: 6px;
}

.doc-viewport-badge.v1 {
    background: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}

.doc-viewport-badge.v2 {
    background: rgba(234, 179, 8, 0.3);
    color: #fde047;
}

/* National Source Layout */
.national-source-item {
    flex-direction: column;
    align-items: stretch;
}

.national-source-item .national-source-info {
    margin-bottom: 8px;
}

/* Viewport Focus Rings on Sidebar Items */
.document-item.in-viewport-left {
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.7), 0 0 12px rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    background: rgba(168, 85, 247, 0.08);
}

.document-item.in-viewport-right {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.08);
}

.document-item.in-viewport-both {
    box-shadow: 
        0 0 0 2px rgba(168, 85, 247, 0.5),
        0 0 0 4px rgba(59, 130, 246, 0.5),
        0 0 16px rgba(168, 85, 247, 0.2);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(59, 130, 246, 0.08));
}

/* Always show viewport buttons when loaded */
.document-item.in-viewport-left .doc-viewport-selector,
.document-item.in-viewport-right .doc-viewport-selector,
.document-item.in-viewport-both .doc-viewport-selector {
    display: flex;
}

/* Color the active viewport buttons */
.document-item.in-viewport-left .viewport-load-btn.left,
.document-item.in-viewport-both .viewport-load-btn.left {
    background: rgba(168, 85, 247, 0.3);
    border-color: rgba(168, 85, 247, 0.6);
    color: #c4b5fd;
}

.document-item.in-viewport-right .viewport-load-btn.right,
.document-item.in-viewport-both .viewport-load-btn.right {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.6);
    color: #93c5fd;
}

/* Fix viewport button layout - prevent shifting */
.doc-viewport-selector {
    min-height: 26px;
    flex-shrink: 0;
}

.viewport-load-btn {
    min-width: 40px;
    flex: 1 1 50%;
}

/* Chat Panel Linked to Viewport */
#chat-panel.linked-to-left {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.15);
}

#chat-panel.linked-to-right {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.chat-doc-indicator.left-doc {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.4);
    color: #c4b5fd;
}

.chat-doc-indicator.right-doc {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}

/* ========================================
   Colour Stream Connection System
   ======================================== */

.color-picker-pill {
    width: 16px;
    height: 16px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    position: relative;
}

.color-picker-pill:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.6);
}

.color-picker-popup {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: rgba(30, 41, 59, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    min-width: 180px;
}

.color-picker-popup.open {
    display: block;
}

.color-picker-popup::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 12px;
    width: 10px;
    height: 10px;
    background: rgba(30, 41, 59, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    transform: rotate(45deg);
}

.color-picker-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-preset-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.color-preset {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.color-preset.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.color-custom-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.color-custom-input {
    width: 32px;
    height: 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    padding: 0;
}

.color-custom-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-custom-input::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.color-custom-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Document card with custom color theming */
.document-item[data-doc-color] {
    border-left: 3px solid var(--doc-color, transparent);
}

.document-item[data-doc-color]:hover {
    border-left-color: var(--doc-color);
}

/* Viewport buttons with custom color */
.viewport-load-btn.color-synced {
    background: var(--doc-color-faded, rgba(139, 92, 246, 0.15)) !important;
    border-color: var(--doc-color, rgba(139, 92, 246, 0.4)) !important;
}

/* Chat sidebar with custom color glow */
#sidebar.color-themed {
    border-color: var(--doc-color, rgba(139, 92, 246, 0.3));
    box-shadow: 0 0 30px var(--doc-color-glow, rgba(139, 92, 246, 0.1));
}

/* Chat panel linked to custom color */
#chat-panel.color-themed {
    border-color: var(--doc-color, rgba(139, 92, 246, 0.5));
    box-shadow: 0 0 20px var(--doc-color-glow, rgba(139, 92, 246, 0.15));
}

/* User message bubbles with custom color */
.chat-message.user-message.color-themed .message-content {
    background: var(--doc-color-faded, rgba(139, 92, 246, 0.12)) !important;
    border-color: var(--doc-color-subtle, rgba(139, 92, 246, 0.2)) !important;
}

/* Bot response bubbles with complementary color */
.chat-message.assistant-message.color-themed .message-content {
    background: var(--doc-color-complement-faded, rgba(52, 211, 153, 0.08)) !important;
    border-color: var(--doc-color-complement-subtle, rgba(52, 211, 153, 0.15)) !important;
}

/* Layout adjustments for color picker in cards */
.national-source-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.national-source-info .color-picker-pill {
    flex-shrink: 0;
}

.national-source-info .national-source-title {
    flex: 1;
    min-width: 0;
}

.doc-header .color-picker-pill {
    margin-right: 4px;
}

/* Viewport buttons inherit document color when loaded */
.viewport-load-btn.color-loaded {
    background: var(--btn-loaded-color, var(--doc-color)) !important;
    border-color: var(--btn-loaded-color, var(--doc-color)) !important;
    color: #fff !important;
}

/* Viewport focus ring with document color */
.pdf-viewport.viewport-active.color-linked {
    box-shadow: 0 0 0 3px var(--doc-color, rgba(139, 92, 246, 0.5)), 0 0 20px var(--doc-color-faded, rgba(139, 92, 246, 0.2)) !important;
}

.pdf-viewport.viewport-active.color-linked.linked-left {
    box-shadow: 0 0 0 3px var(--viewport-1-color, var(--doc-color, rgba(139, 92, 246, 0.5))), 0 0 20px rgba(139, 92, 246, 0.2) !important;
}

.pdf-viewport.viewport-active.color-linked.linked-right {
    box-shadow: 0 0 0 3px var(--viewport-2-color, var(--doc-color, rgba(59, 130, 246, 0.5))), 0 0 20px rgba(59, 130, 246, 0.2) !important;
}

/* Chat panel sidebar glow with document color */
#chat-panel.color-linked {
    border-color: var(--doc-color, rgba(139, 92, 246, 0.3)) !important;
    box-shadow: -2px 0 20px var(--doc-color-faded, rgba(139, 92, 246, 0.15)), 0 0 40px var(--doc-color-subtle, rgba(139, 92, 246, 0.08)) !important;
}

#chat-panel.color-linked.linked-to-left {
    --chat-link-color: var(--viewport-1-color, var(--doc-color, rgba(139, 92, 246, 0.5)));
}

#chat-panel.color-linked.linked-to-right {
    --chat-link-color: var(--viewport-2-color, var(--doc-color, rgba(59, 130, 246, 0.5)));
}

/* Chat header document indicator with color */
#chat-doc-indicator.color-themed {
    background: var(--doc-color-faded, rgba(139, 92, 246, 0.15)) !important;
    border-color: var(--doc-color-subtle, rgba(139, 92, 246, 0.25)) !important;
}

#chat-doc-indicator.color-themed::before {
    background-color: var(--doc-color, #8b5cf6) !important;
}

/* ========================================
   Bottom Bar (Full Width Footer)
   ======================================== */

/* Override docqa-container to use column layout for bottom bar */
.docqa-container {
    flex-direction: column;
}

/* Wrapper for sidebar + main content */
.docqa-container > .docqa-sidebar,
.docqa-container > .sidebar-collapse-toggle,
.docqa-container > .docqa-main {
    /* These stay in a row via inner wrapper - handled by existing flex */
}

/* Create inner row wrapper effect */
.docqa-container {
    display: flex;
    flex-direction: column;
    position: relative;
}

/* The sidebar and main should be in a row */
.docqa-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 48px;
    z-index: 10;
    background: rgba(15, 23, 42, 0.98);
    display: flex;
    flex-direction: column;
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid rgba(139, 92, 246, 0.2);
    overflow: hidden;
    transition: width 0.3s ease;
}

/* Sidebar resize handle - hidden for fixed layout */
.sidebar-resize-handle {
    display: none;
}

/* Text overflow for document titles */
.doc-card-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Sidebar collapse toggle - visible and positioned at sidebar edge */
.sidebar-collapse-toggle {
    display: flex !important;
    position: absolute;
    left: 280px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    width: 24px;
    height: 48px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: left 0.3s ease, background 0.2s ease, color 0.2s ease;
}

.sidebar-collapse-toggle:hover {
    background: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}

.sidebar-collapse-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

/* Annotations toggle stays hidden */
.annotations-collapse-toggle {
    display: none !important;
}

/* Sidebar Mode Toggle - Bottom Toggle Bar */
.sidebar-mode-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 2px;
}

.sidebar-mode-toggle .mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar-mode-toggle .mode-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-mode-toggle .mode-btn.active {
    background: #7c3aed;
    color: white;
}

.sidebar-mode-toggle .mode-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
}

.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.header-nav-buttons {
    display: flex;
    align-items: center;
}

.return-btn {
    font-size: 11px;
    color: white !important;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
}

.return-btn:hover {
    opacity: 1;
}

.document-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
}

.document-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.document-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

.document-card.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: #7c3aed;
}

.doc-card-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #ffffff !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.doc-card-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    gap: 8px;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff !important;
}

.document-list .empty-state {
    color: #ffffff !important;
    opacity: 0.8;
}

#pdf-filename, #viewport-doc-name {
    color: #ffffff !important;
}

.page-info {
    color: #ffffff !important;
}

#page-input {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    text-align: center;
}

.docqa-main {
    position: absolute;
    left: 280px;
    right: 0;
    top: 0;
    bottom: 48px;
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
}

/* Collapsed sidebar adjustments - !important overrides inline resize width */
.docqa-container.sidebar-collapsed .docqa-sidebar {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    border-right: none;
    overflow: hidden;
    visibility: hidden;
}

.docqa-container.sidebar-collapsed .docqa-main {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    transform: none !important;
}

.docqa-container.sidebar-collapsed .docqa-main .main-content-area {
    left: 0 !important;
    width: 100% !important;
    margin-left: 0 !important;
}

.docqa-container.sidebar-collapsed .docqa-main #pdf-viewport {
    left: 0 !important;
    width: 100% !important;
    flex: 1 !important;
    margin-left: 0 !important;
}

.docqa-container.sidebar-collapsed .sidebar-collapse-toggle {
    left: 0 !important;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0 8px 8px 0;
}

.docqa-container.sidebar-collapsed .sidebar-collapse-toggle svg {
    transform: rotate(180deg);
}

/* Ensure bottom bar also adjusts when collapsed */
.docqa-container.sidebar-collapsed .docqa-bottom-bar {
    left: 0 !important;
}

.docqa-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1001;
}

.view-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle-btn svg {
    opacity: 0.7;
}

.view-toggle-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.view-toggle-btn.active {
    background: #7c3aed;
    color: white;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.view-toggle-btn.active svg {
    opacity: 1;
}

.pdf-nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: all 0.2s;
}

.pdf-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.pdf-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#page-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: white;
    padding: 2px 6px;
    width: 45px;
    text-align: center;
}

.bottom-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bottom-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ========================================
   Chat/Figures Toggle (In Bottom Bar)
   ======================================== */

.chat-view-toggle {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-view-toggle .view-toggle-btn {
    padding: 6px 14px;
    font-size: 0.75rem;
}

/* ========================================
   PDFViewerComponent Integration
   ======================================== */

/* Hide legacy toolbar when using PDFViewerComponent */
.pdf-container.pdf-viewer-component .pdf-toolbar,
.viewport-panel .pdf-viewer-component + .pdf-toolbar {
    display: none !important;
}

/* PDFViewerComponent fills the container */
.pdf-container .pdf-viewer-component {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
}

/* Hide legacy canvas when component is active */
.pdf-container.has-viewer-component > canvas,
.pdf-container.has-viewer-component > .textLayer,
.pdf-container.has-viewer-component > .pdf-placeholder {
    display: none !important;
}

/* Ensure component toolbar matches existing style */
.pdf-viewer-component .pdf-toolbar {
    background: linear-gradient(135deg, rgba(49, 46, 129, 0.3) 0%, rgba(30, 30, 45, 0.6) 100%);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

/* Viewport panel adjustment for embedded component */
.viewport-panel .pdf-container {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Search input in component toolbar */
.pdf-viewer-component .pdf-search-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: white;
}

.pdf-viewer-component .pdf-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.pdf-viewer-component .pdf-search-input:focus {
    border-color: rgba(139, 92, 246, 0.6);
    outline: none;
}

/* Hide legacy viewport toolbars when using PDFViewerComponent */
.viewport-panel:has(.has-viewer-component) .pdf-toolbar[id^="pdf-toolbar-"] {
    display: none !important;
}

.viewport-panel:has(.has-viewer-component) .page-thumbnails-rail {
    display: none !important;
}

/* Alternative for browsers without :has() support */
.pdf-container.has-viewer-component ~ .pdf-toolbar,
.pdf-container.has-viewer-component ~ .page-thumbnails-rail {
    display: none !important;
}

/* ========================================
   Sidebar Viewport Controls
   ======================================== */

.sidebar-viewport-controls {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    margin-top: auto;
}

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

.viewport-controls-label {
    font-size: 11px;
    font-weight: 600;
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.viewport-controls-doc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-page-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.sidebar-nav-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.sidebar-nav-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: white;
}

.sidebar-page-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.sidebar-page-input {
    width: 40px;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 12px;
    text-align: center;
}

.sidebar-page-input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
}

.sidebar-page-sep {
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-page-thumbnails {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0;
    max-height: 100px;
}

.sidebar-page-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.sidebar-page-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 2px;
}

/* ========================================
   Chat Panel Tabs
   ======================================== */

.chat-panel-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 3px;
}

.chat-panel-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.chat-panel-tab:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
}

.chat-panel-tab.active {
    background: rgba(139, 92, 246, 0.3);
    color: white;
}

.chat-panel-tab svg {
    stroke: currentColor;
    fill: none;
}

/* ========================================
   Right Viewport Controls Panel
   ======================================== */

.right-viewport-controls {
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.right-viewport-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.right-viewport-label {
    font-size: 12px;
    font-weight: 600;
    color: #a78bfa;
}

.right-viewport-doc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.right-page-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.right-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.right-nav-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: white;
}

.right-page-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.right-page-input {
    width: 50px;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 13px;
    text-align: center;
}

.right-page-input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
}

.right-page-sep {
    color: rgba(255, 255, 255, 0.5);
}

.right-zoom-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.right-zoom-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.right-zoom-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
}

.right-zoom-level {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    min-width: 40px;
    text-align: center;
}

.right-page-thumbnails {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 6px 0;
    max-height: 80px;
}

.right-page-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.right-page-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 2px;
}

/* Hide chat content when right-nav panel is active */
.chat-panel.show-right-nav .compliance-disclaimer,
.chat-panel.show-right-nav .library-version-bar,
.chat-panel.show-right-nav .guidance-banner,
.chat-panel.show-right-nav .chat-messages,
.chat-panel.show-right-nav .chat-input-container {
    display: none !important;
}

.chat-input-container {
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
    align-items: flex-end;
    position: relative;
    z-index: 10;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    color: white;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 44px;
    max-height: 150px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#chat-input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.send-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.5);
    filter: brightness(1.1);
}

.send-btn:active:not(:disabled) {
    transform: translateY(0);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.5);
    box-shadow: none;
}

.send-btn svg {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.chat-panel.show-right-nav .right-viewport-controls {
    display: block;
}

/* =========================================
   FULLSCREEN VIEWER MODAL
   ========================================= */

.fullscreen-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.fullscreen-viewer-modal {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    height: 100vh;
    width: 100vw;
}

.fullscreen-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(20, 20, 25, 0.95);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    flex-shrink: 0;
}

.fullscreen-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fullscreen-doc-name {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.fullscreen-nav-btn {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: rgba(255, 255, 255, 0.8);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.fullscreen-nav-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}

.fullscreen-page-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 8px;
}

.fullscreen-page-input {
    width: 50px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: white;
    font-size: 13px;
    text-align: center;
}

.fullscreen-page-sep {
    color: rgba(255, 255, 255, 0.4);
}

#fullscreen-page-count {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

.fullscreen-zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 16px;
    padding-left: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

#fullscreen-zoom-level {
    min-width: 50px;
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.fullscreen-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fullscreen-close-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.fullscreen-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.fullscreen-viewer-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.fullscreen-pdf-container {
    flex: 1;
    overflow: auto;
    background: #121212;
    position: relative;
}

.fullscreen-chat-panel {
    width: 360px;
    background: rgba(20, 20, 25, 0.95);
    border-left: 1px solid rgba(139, 92, 246, 0.2);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease;
}

.fullscreen-chat-panel.collapsed {
    width: 48px;
}

.fullscreen-chat-panel.collapsed .fullscreen-chat-messages,
.fullscreen-chat-panel.collapsed .fullscreen-chat-input-container,
.fullscreen-chat-panel.collapsed .fullscreen-chat-header h3 {
    display: none;
}

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

.fullscreen-chat-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.fullscreen-chat-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
}

.fullscreen-chat-toggle:hover {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.fullscreen-chat-panel.collapsed .fullscreen-chat-toggle svg {
    transform: rotate(180deg);
}

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

.fullscreen-chat-messages .welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.fullscreen-chat-messages .welcome-message p strong {
    color: rgba(255, 255, 255, 0.8);
}

.fullscreen-chat-messages .welcome-subtext {
    font-size: 13px;
    margin-top: 8px;
}

.fullscreen-chat-input-container {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#fullscreen-chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 12px;
    color: white;
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
}

#fullscreen-chat-input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
}

.fullscreen-send-btn {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.8), rgba(234, 179, 8, 0.6));
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.fullscreen-send-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 1), rgba(234, 179, 8, 0.8));
    transform: scale(1.05);
}

.fullscreen-return-options {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 25, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.return-options-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.return-options-content p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    margin: 0;
}

.return-option-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
}

.return-option-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: white;
}

/* Fullscreen Chat Messages */
.fullscreen-chat-messages .chat-message {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.fullscreen-chat-messages .user-message {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.2);
    margin-left: 20px;
}

.fullscreen-chat-messages .assistant-message {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 20px;
}

.fullscreen-chat-messages .message-loading {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.fullscreen-chat-messages .message-loading span {
    width: 8px;
    height: 8px;
    background: rgba(139, 92, 246, 0.5);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.fullscreen-chat-messages .message-loading span:nth-child(1) { animation-delay: -0.32s; }
.fullscreen-chat-messages .message-loading span:nth-child(2) { animation-delay: -0.16s; }
.fullscreen-chat-messages .message-loading span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.fullscreen-chat-messages .citation-badge:hover {
    background: rgba(139, 92, 246, 0.4) !important;
}

/* ========================================
   Bbox Highlight Layer
   ======================================== */

.highlight-layer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 3;
}

.bbox-highlight {
    position: absolute;
    background: rgba(250, 204, 21, 0.35);
    border: 2px solid rgba(250, 204, 21, 0.8);
    border-radius: 3px;
    pointer-events: none;
    animation: highlight-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.4);
}

@keyframes highlight-pulse {
    0%, 100% {
        background: rgba(250, 204, 21, 0.35);
        border-color: rgba(250, 204, 21, 0.8);
    }
    50% {
        background: rgba(250, 204, 21, 0.5);
        border-color: rgba(250, 204, 21, 1);
    }
}

/* =============================================================================
   SIDEBAR COLLAPSED STATE - ULTRA HIGH SPECIFICITY OVERRIDES
   These rules MUST be at the very end of the file to win the cascade.
   Using body prefix + direct child combinator for maximum specificity.
   ============================================================================= */

/* Nuclear option: body prefix + direct child + doubled class */
body.fullscreen-page .docqa-container.sidebar-collapsed.sidebar-collapsed > .docqa-main,
body.fullscreen-page .docqa-container.sidebar-collapsed > .docqa-main,
.docqa-container.sidebar-collapsed.sidebar-collapsed > .docqa-main,
.docqa-container.sidebar-collapsed > .docqa-main {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    transform: none !important;
}

body.fullscreen-page .docqa-container.sidebar-collapsed > .docqa-sidebar,
.docqa-container.sidebar-collapsed > .docqa-sidebar {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    border-right: none !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

body.fullscreen-page .docqa-container.sidebar-collapsed > .sidebar-collapse-toggle,
.docqa-container.sidebar-collapsed > .sidebar-collapse-toggle {
    left: 0 !important;
}

/* Research Mode Toggle */
.research-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(71, 85, 105, 0.6);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: #e2e8f0;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(139, 92, 246, 0.7);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(16px);
    background: #fff;
}

.toggle-label {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    min-width: 32px;
    transition: color 0.3s ease;
}

.toggle-label.active {
    color: #a78bfa;
}


/* ========================================
   MOBILE RESPONSIVE STYLES (768px)
   ======================================== */
@media (max-width: 768px) {
  /* Main container - full height column layout */
  .docqa-container,
  .compliance-chat-container {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh;
    height: 100dvh;
    padding: 0 !important;
    gap: 0 !important;
    overflow: hidden;
  }
  
  /* Hide sidebar by default on mobile */
  .docqa-sidebar,
  .chat-sidebar {
    display: none !important;
  }
  
  /* Hide sidebar toggle on mobile */
  .sidebar-collapse-toggle {
    display: none !important;
  }
  
  /* Hide sidebar resize handle */
  .sidebar-resize-handle {
    display: none !important;
  }
  
  /* PDF viewport - collapsible, limited height */
  .pdf-viewport,
  .document-panel {
    max-height: 30vh !important;
    min-height: 0;
    overflow: auto;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  /* Hide annotations rail on mobile */
  .annotations-rail {
    display: none !important;
  }
  
  /* Hide annotations toggle on mobile */
  .annotations-collapse-toggle {
    display: none !important;
  }
  
  /* Hide chat collapse toggle on mobile */
  .chat-collapse-toggle {
    display: none !important;
  }
  
  /* Main content area - CRITICAL: Reset absolute positioning from desktop */
  .docqa-main {
    position: static !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .main-content-area {
    flex: 1;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0;
    overflow: hidden;
    width: 100% !important;
    left: 0 !important;
    margin: 0 !important;
  }
  
  /* Reset container positioning */
  .docqa-container,
  .compliance-chat-container {
    position: relative !important;
  }
  
  /* Ensure bottom bar doesn't offset content */
  .docqa-bottom-bar {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 100;
  }
  
  /* Chat panel - takes remaining space */
  .chat-panel,
  #chat-panel {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    order: 2;
  }
  
  /* Chat header - compact */
  .chat-header {
    padding: 10px 12px !important;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .chat-header h3 {
    font-size: 14px;
  }
  
  .chat-header-actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: wrap;
    gap: 6px;
  }
  
  /* Hide some header actions on mobile to save space */
  .ai-assistant-btn {
    display: none !important;
  }
  
  /* Compact disclaimer on mobile */
  .compliance-disclaimer {
    margin: 6px 10px !important;
    padding: 8px 10px !important;
    font-size: 10px !important;
  }
  
  /* Hide guidance banner on mobile to save space */
  .guidance-banner {
    display: none !important;
  }
  
  /* Chat messages - scrollable */
  .chat-messages,
  .messages-container {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 12px !important;
    min-height: 0 !important;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Message bubbles - proper sizing */
  .message-bubble,
  .chat-message {
    max-width: 88% !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
  }
  
  /* Welcome message - more compact */
  .welcome-message {
    padding: 16px !important;
    font-size: 14px !important;
  }
  
  .welcome-examples-list {
    font-size: 13px !important;
  }
  
  /* Chat input - sticky at bottom */
  .chat-input-container,
  .input-container {
    flex-shrink: 0 !important;
    padding: 10px 12px !important;
    padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
    background: rgba(15, 23, 42, 0.98) !important;
    border-top: 1px solid rgba(255,255,255,0.1) !important;
    display: flex !important;
    gap: 8px !important;
    align-items: flex-end !important;
  }
  
  .chat-input-container textarea,
  #chat-input {
    flex: 1 !important;
    min-height: 44px !important;
    max-height: 120px !important;
    font-size: 16px !important; /* Prevents iOS zoom */
    padding: 10px 12px !important;
    border-radius: 8px !important;
    resize: none !important;
  }
  
  .send-btn,
  .chat-input-container button {
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 14px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }
  
  /* Bottom bar - compact on mobile */
  .docqa-bottom-bar {
    padding: 8px 10px !important;
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .sidebar-mode-toggle {
    display: none !important;
  }
  
  .view-toggle {
    width: 100%;
    justify-content: center;
  }
  
  /* Hide figures panel on mobile by default */
  .figures-panel {
    display: none !important;
  }
  
  /* Modals - full width on mobile */
  .version-history-modal,
  .diff-panel {
    width: 95% !important;
    max-height: 85vh !important;
  }
}
