* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(160deg, #edf2ff 0%, #e8f0fd 55%, #fef9e7 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 40px 20px;
    color: #1d1d1f;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 60px;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1D52CC 0%, #1641AA 60%, #2E6FE8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.2rem;
    color: #6e6e73;
    font-weight: 400;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Main Two-Column Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.left-column,
.right-column {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 24px rgba(29, 82, 204, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(29, 82, 204, 0.07);
}

.left-column h2,
.right-column h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 24px;
}

/* Left Column: Fields to Extract (Static) */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-field {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #d2d2d7;
    border-radius: 8px;
    font-size: 1rem;
    color: #86868b;
    background: white;
    transition: all 0.2s ease;
}

.input-field:not(:disabled):hover {
    border-color: #b0b0b5;
}

.input-field:not(:disabled):focus {
    outline: none;
    border-color: #1D52CC;
    box-shadow: 0 0 0 3px rgba(29, 82, 204, 0.1);
}

.btn-add-input {
    width: 100%;
    padding: 14px;
    border: 2px dashed #d2d2d7;
    border-radius: 8px;
    background: white;
    color: #86868b;
    font-size: 1rem;
    cursor: not-allowed;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.btn-submit {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 8px;
    background: #1d1d1f;
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: not-allowed;
    opacity: 0.4;
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Right Column: Upload Area */
.upload-area {
    border: 2px dashed #d2d2d7;
    border-radius: 12px;
    padding: 80px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    margin-bottom: 24px;
}

.upload-area:hover {
    border-color: #1D52CC;
    background: #e8f0fd;
}

.upload-icon {
    color: #86868b;
    margin-bottom: 20px;
}

.upload-icon svg {
    width: 64px;
    height: 64px;
}

.upload-text {
    font-size: 1.1rem;
    color: #1d1d1f;
    font-weight: 500;
    margin-bottom: 8px;
}

.file-types {
    font-size: 0.95rem;
    color: #86868b;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f5f5f7;
    border-radius: 8px;
    border: 1px solid #d2d2d7;
    margin-bottom: 24px;
}

.file-name {
    font-size: 1rem;
    color: #1d1d1f;
    font-weight: 500;
}

.btn-remove {
    background: #ff3b30;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: #d62d22;
    transform: translateY(-1px);
}

/* Action Buttons */
.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn {
    padding: 16px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-summarize {
    background: #1d1d1f;
    color: white;
}

.btn-summarize:hover {
    background: #0d0d0d;
    transform: translateY(-2px);
}

.btn-ask {
    background: white;
    color: #1d1d1f;
    border: 1.5px solid #d2d2d7;
}

.btn-ask:hover {
    border-color: #1d1d1f;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Result Sections */
.result-section,
.qa-section {
    background: white;
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(29, 82, 204, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(29, 82, 204, 0.07);
}

.result-section h2,
.qa-section h2 {
    color: #1d1d1f;
    margin-bottom: 24px;
    font-size: 1.5rem;
    font-weight: 600;
}

.result-box {
    background: #f5f5f7;
    border-radius: 12px;
    padding: 24px;
    min-height: 100px;
    border: 1px solid #e5e5e7;
}

.summary-content {
    line-height: 1.8;
    color: #1d1d1f;
    font-size: 1rem;
}

.summary-content p {
    margin-bottom: 16px;
}

/* Loading Spinner */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
}

.loading p {
    color: #86868b;
    font-size: 1rem;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1d1d1f;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.spinner-small {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1d1d1f;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Q&A Section */
.qa-input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.question-input {
    flex: 1;
    padding: 14px 16px;
    border: 1.5px solid #d2d2d7;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    resize: vertical;
    min-height: 50px;
    max-height: 200px;
    line-height: 1.5;
}

.question-input:focus {
    outline: none;
    border-color: #1D52CC;
    box-shadow: 0 0 0 3px rgba(29, 82, 204, 0.1);
}

.btn-ask-submit {
    background: white;
    color: #1d1d1f;
    border: 1.5px solid #d2d2d7;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-ask-submit:hover {
    border-color: #1d1d1f;
    background: #fafafa;
}

.qa-history {
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.qa-item {
    background: #f5f5f7;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e5e5e7;
}

.question {
    margin-bottom: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    color: #1d1d1f;
    font-weight: 500;
    border: 1px solid #e5e5e7;
}

.answer {
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    color: #1d1d1f;
    line-height: 1.7;
    border: 1px solid #e5e5e7;
}

.answer p {
    margin-bottom: 12px;
}

.loading-answer {
    display: flex;
    align-items: center;
    color: #86868b;
    padding: 12px 16px;
}

.error {
    color: #ff3b30;
    background: #fff5f5 !important;
    border-color: #ffcccc !important;
}

/* Footer */
footer {
    text-align: center;
    color: #1D52CC;
    padding: 32px 20px;
    font-size: 0.95rem;
}

/* Scrollbar Styling */
.qa-history::-webkit-scrollbar {
    width: 8px;
}

.qa-history::-webkit-scrollbar-track {
    background: #f5f5f7;
    border-radius: 10px;
}

.qa-history::-webkit-scrollbar-thumb {
    background: #d2d2d7;
    border-radius: 10px;
}

.qa-history::-webkit-scrollbar-thumb:hover {
    background: #b0b0b5;
}

/* Document Type Selector */
.doc-type-section {
    margin-bottom: 24px;
}

.doc-type-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1d1d1f;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.doc-type-optional {
    font-weight: 400;
    color: #86868b;
    text-transform: none;
    letter-spacing: 0;
}

.doc-type-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.doc-type-btn {
    flex: 1;
    min-width: 70px;
    padding: 9px 14px;
    border: 1.5px solid #d2d2d7;
    border-radius: 20px;
    background: white;
    color: #1d1d1f;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.doc-type-btn:hover {
    border-color: #1d1d1f;
    background: #fafafa;
}

.doc-type-btn.active {
    background: #1D52CC;
    color: white;
    border-color: #1D52CC;
}

.input-field.template-field {
    background: #f5f5f7;
    color: #1d1d1f;
    font-weight: 500;
}

/* Field Extraction Styles */
#fieldsList {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.field-row {
    position: relative;
    display: flex;
    align-items: center;
}

.field-row .input-field {
    flex: 1;
    margin: 0;
    padding-right: 36px;
}

.btn-remove-field {
    position: absolute;
    right: 10px;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #b0b0b5;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    transition: all 0.15s ease;
}

.btn-remove-field:hover {
    color: #ff3b30;
    background: rgba(255, 59, 48, 0.08);
}

.btn-add-field {
    width: 100%;
    padding: 14px;
    border: 2px dashed #d2d2d7;
    border-radius: 8px;
    background: white;
    color: #1d1d1f;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 16px;
}

.btn-add-field:hover {
    border-color: #1d1d1f;
    background: #fafafa;
}

.btn-extract {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 8px;
    background: #1d1d1f;
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-extract:hover {
    background: #0d0d0d;
    transform: translateY(-2px);
}

.btn-extract:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Extraction Results */
.extraction-results {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e7;
}

.extraction-results h3 {
    font-size: 1.2rem;
    color: #1d1d1f;
    margin-bottom: 16px;
}

.extracted-field-item {
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 2px solid #e5e5e7;
    transition: all 0.2s ease;
}

.extracted-field-item.high-confidence {
    border-color: #00c853;
    background: #f1f8f4;
}

.extracted-field-item.medium-confidence {
    border-color: #ffa500;
    background: #fff8f0;
}

.extracted-field-item.low-confidence {
    border-color: #ff3b30;
    background: #fff5f5;
}

.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.field-name {
    font-weight: 600;
    color: #1d1d1f;
}

.confidence-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.confidence-badge.high-confidence {
    background: #00c853;
    color: white;
}

.confidence-badge.medium-confidence {
    background: #ffa500;
    color: white;
}

.confidence-badge.low-confidence {
    background: #ff3b30;
    color: white;
}

.field-value {
    font-size: 1rem;
    color: #1d1d1f;
    margin-bottom: 6px;
    font-weight: 500;
}

.field-reason {
    font-size: 0.85rem;
    color: #6e6e73;
    font-style: italic;
}

.confidence-overall {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f5f5f7;
    border-radius: 8px;
    font-size: 0.95rem;
}

.confidence-reason {
    color: #6e6e73;
    font-weight: normal;
}

/* Document Viewer */
.document-viewer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e7;
}

.document-viewer h3 {
    font-size: 1.2rem;
    color: #1d1d1f;
    margin-bottom: 16px;
}

.viewer-container {
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    overflow: auto;
    max-height: 600px;
    background: #fafafa;
}

#documentCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.viewer-legend {
    margin-top: 16px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #1d1d1f;
}

.legend-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid;
}

.legend-box.high-confidence {
    border-color: #00c853;
    background: rgba(0, 200, 83, 0.2);
}

.legend-box.medium-confidence {
    border-color: #ffa500;
    background: rgba(255, 165, 0, 0.2);
}

.legend-box.low-confidence {
    border-color: #ff3b30;
    background: rgba(255, 59, 48, 0.2);
}

/* ============================================================
   TAB BAR
   ============================================================ */

.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 40px;
    background: rgba(29, 82, 204, 0.08);
    border-radius: 12px;
    padding: 4px;
    width: fit-content;
}

.tab-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #1D52CC;
    background: rgba(29, 82, 204, 0.06);
}

.tab-btn.active {
    background: white;
    color: #1D52CC;
    box-shadow: 0 1px 6px rgba(29, 82, 204, 0.18);
    font-weight: 600;
    border-bottom: 2.5px solid #F5C200;
}

.tab-panel {
    min-width: 0;
}

/* ============================================================
   ANALYTICS SECTION LAYOUT
   ============================================================ */

.analytics-section {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 24px rgba(29, 82, 204, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(29, 82, 204, 0.07);
    margin-bottom: 24px;
}

.analytics-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 8px;
}

.analytics-subtitle {
    font-size: 0.95rem;
    color: #6e6e73;
    margin-bottom: 28px;
    line-height: 1.5;
}

/* In-page error banner */
.analytics-error-banner {
    padding: 14px 18px;
    background: #fff5f5;
    border: 1.5px solid #ffcccc;
    border-radius: 8px;
    color: #c0392b;
    font-size: 0.92rem;
    font-weight: 500;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Upload Area (reuses .upload-area styles, just override specifics) */
.analytics-upload-area {
    border: 2px dashed #d2d2d7;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.analytics-upload-area:hover,
.analytics-upload-area:focus-visible {
    border-color: #1D52CC;
    background: #e8f0fd;
    outline: none;
}

.analytics-upload-area.drag-over {
    border-color: #1D52CC;
    background: #edf2ff;
}

/* ============================================================
   SELECTED FILES LIST
   ============================================================ */

.analytics-selected-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.analytics-file-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1d1d1f;
}

.analytics-file-limit {
    font-size: 0.85rem;
    color: #86868b;
}

.analytics-files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    max-height: 280px;
    overflow-y: auto;
}

.analytics-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f5f5f7;
    border-radius: 8px;
    border: 1px solid #e5e5e7;
    min-width: 0;
}

/* Reset absolute positioning from the shared .btn-remove-field rule */
.analytics-file-row .btn-remove-field {
    position: static;
    flex-shrink: 0;
}

.analytics-file-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.analytics-file-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1d1d1f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.analytics-file-size {
    flex-shrink: 0;
    font-size: 0.82rem;
    color: #86868b;
}

.analytics-upload-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-analyze {
    flex: 1;
    min-width: 160px;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    background: #1d1d1f;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-analyze:hover {
    background: #0d0d0d;
    transform: translateY(-2px);
}

.btn-analyze:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-clear-files {
    padding: 14px 20px;
    border: 1.5px solid #d2d2d7;
    border-radius: 8px;
    background: white;
    color: #1d1d1f;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-files:hover {
    border-color: #ff3b30;
    color: #ff3b30;
    background: #fff5f5;
}

/* ============================================================
   RESULTS TABLE
   ============================================================ */

.analytics-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.analytics-results-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1d1d1f;
}

.btn-new-session {
    padding: 8px 18px;
    border: 1.5px solid #1D52CC;
    border-radius: 8px;
    background: white;
    color: #1D52CC;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-new-session:hover {
    background: #1D52CC;
    color: white;
}

.analytics-docs-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e5e5e7;
}

.analytics-docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.analytics-docs-table th {
    padding: 12px 16px;
    background: #f5f5f7;
    color: #6e6e73;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: left;
    border-bottom: 1px solid #e5e5e7;
    white-space: nowrap;
}

.analytics-docs-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f2;
    vertical-align: middle;
    color: #1d1d1f;
}

.analytics-docs-table tr:last-child td {
    border-bottom: none;
}

.analytics-docs-table tr:hover td {
    background: #fafafa;
}

.analytics-filename {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.analytics-total-cell {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.analytics-warning-row td {
    padding: 4px 16px 10px;
    background: #fffbf0;
    border-bottom: 1px solid #f0f0f2;
}

.analytics-warning-text {
    font-size: 0.82rem;
    color: #b25000;
}

/* ============================================================
   BADGES
   ============================================================ */

.analytics-badge-type {
    display: inline-block;
    padding: 3px 10px;
    background: #edf2ff;
    color: #1D52CC;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.analytics-badge-currency {
    display: inline-block;
    padding: 2px 8px;
    background: #e9f9ee;
    color: #0a7c42;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

.analytics-badge-warning {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #fff3e0;
    color: #b25000;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ============================================================
   ANALYTICS Q&A SECTION
   ============================================================ */

.analytics-qa-section {
    background: white;
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(29, 82, 204, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(29, 82, 204, 0.07);
}

.analytics-qa-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 8px;
}

.analytics-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.suggestion-chip {
    padding: 7px 14px;
    border: 1.5px solid #d2d2d7;
    border-radius: 20px;
    background: white;
    color: #1d1d1f;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.suggestion-chip:hover {
    border-color: #1D52CC;
    color: #1D52CC;
    background: #edf2ff;
}


.analytics-qa-history {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 16px;
}

/* Sticky input bar — stays at the bottom of the viewport as history grows */
.analytics-sticky-input {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 16px 0 4px;
    border-top: 1px solid #e5e5e7;
    margin-top: 8px;
    /* Bleed the white background to the edges of the card */
    margin-left: -40px;
    margin-right: -40px;
    padding-left: 40px;
    padding-right: 40px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}

.analytics-qa-item {
    background: #f5f5f7;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e5e5e7;
}

/* ============================================================
   CHART CONTAINER
   ============================================================ */

.analytics-chart-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e7;
}

.analytics-chart-canvas {
    display: block;
    max-height: 360px;
    width: 100% !important;
}

/* ============================================================
   ANALYTICS DATA TABLE (inside Q&A answers)
   ============================================================ */

.analytics-table-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 10px;
}

.analytics-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e5e5e7;
}

.analytics-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.analytics-data-table th {
    padding: 10px 14px;
    background: #f5f5f7;
    color: #6e6e73;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: left;
    border-bottom: 1px solid #e5e5e7;
    white-space: nowrap;
}

.analytics-data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f2;
    color: #1d1d1f;
    vertical-align: middle;
}

.analytics-data-table tr:last-child td {
    border-bottom: none;
}

.analytics-data-table tr:hover td {
    background: #fafafa;
}


/* Scrollbar for selected files list */
.analytics-files-list::-webkit-scrollbar { width: 6px; }
.analytics-files-list::-webkit-scrollbar-track { background: transparent; }
.analytics-files-list::-webkit-scrollbar-thumb { background: #d2d2d7; border-radius: 6px; }

/* ============================================================
   Responsive Design
   ============================================================ */

/* Responsive Design */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .upload-area {
        padding: 60px 30px;
    }
    
    .actions {
        grid-template-columns: 1fr;
    }
    
    .qa-input-container {
        flex-direction: column;
    }
    
    .btn-ask-submit {
        width: 100%;
    }
    
    .left-column,
    .right-column {
        padding: 24px;
    }

    .tab-bar {
        width: 100%;
    }

    .tab-btn {
        flex: 1;
        text-align: center;
        padding: 10px 12px;
        font-size: 0.88rem;
    }

    .analytics-section,
    .analytics-qa-section {
        padding: 24px;
    }

    .analytics-upload-area {
        padding: 40px 20px;
    }

    .analytics-upload-actions {
        flex-direction: column;
    }

    .btn-analyze,
    .btn-clear-files {
        width: 100%;
    }

    .analytics-qa-input {
        flex-direction: column;
    }

    .analytics-qa-input .btn-ask-submit {
        width: 100%;
    }

    .analytics-sticky-input {
        margin-left: -24px;
        margin-right: -24px;
        padding-left: 24px;
        padding-right: 24px;
    }
}
