/**
 * Talia v14 - Base Styling
 * Modular CSS for component-based UI
 */

/* ========== CSS VARIABLES (DESIGN TOKENS) ========== */
:root {
    /* Brand Colors */
    --primary: #0070F3;
    --success: #50E3C2;
    --warning: #F5A623;
    --error: #E00;

    /* Grays */
    --gray-1: #FAFAFA;
    --gray-2: #EAEAEA;
    --gray-3: #999999;
    --gray-4: #888888;
    --gray-5: #666666;
    --gray-6: #444444;
    --gray-7: #333333;
    --gray-8: #111111;

    /* Fonts */
    --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Helvetica Neue', sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Consolas', monospace;

    /* Spacing */
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;

    /* Table */
    --table-header-bg: #333333;
    --table-header-text: white;
    --table-row-hover: #FAFAFA;
    --table-border: #EAEAEA;
    --table-cell-padding: 12px 16px;
}

/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* ========== LAYOUT ========== */
body {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ========== VERCEL-STYLE SIDEBAR (Compact, Dark, Minimal) ========== */
#sidebar {
    width: 200px;
    background: #0A0A0A;
    color: #A1A1AA;
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    border-right: 1px solid #1F1F23;
}

#sidebar .logo {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #6B7B8F;
    letter-spacing: -0.3px;
    padding: 0 8px;
}

#sidebar .nav-menu {
    list-style: none;
}

#sidebar .nav-menu li {
    margin-bottom: 2px;
}

#sidebar .nav-link {
    display: block;
    padding: 10px 12px;
    color: #A1A1AA;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
    font-size: 14px;
    font-weight: 500;
    border-left: 2px solid transparent;
}

#sidebar .nav-link:hover {
    background: #18181B;
    color: #E4E4E7;
}

#sidebar .nav-link.active {
    background: #3D5A80;
    color: #FFFFFF;
    border-left: 2px solid #5B8FB9;
    font-weight: 600;
}

#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

/* ========== SECTIONS ========== */
.section {
    max-width: 1200px;
    margin: 0 auto;
}

.section.hidden {
    display: none;
}

.section h1 {
    font-size: 32px;
    margin-bottom: 30px;
    color: #2c3e50;
}

/* ========== UPLOAD ZONE ========== */
.upload-zone {
    border: 3px dashed #bdc3c7;
    border-radius: 10px;
    padding: 60px;
    text-align: center;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 30px;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: #3498db;
    background: #ecf0f1;
}

.upload-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.upload-text {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 10px;
}

.upload-subtext {
    font-size: 14px;
    color: #7f8c8d;
}

/* ========== FILE LIST ========== */
.file-list {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.file-list h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.file-list ul {
    list-style: none;
}

.file-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #ecf0f1;
}

.file-list li:last-child {
    border-bottom: none;
}

.file-list button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}

/* ========== BUTTONS ========== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

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

.btn-llm-review {
    background: #8b5cf6;
    color: white;
    border: none;
}

.btn-llm-review:hover {
    background: #7c3aed;
}

.upload-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-bottom: 30px;
}

/* ========== PROGRESS ========== */
.progress-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
}

.progress-container h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.progress-item {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    background: #ecf0f1;
}

.progress-item.success {
    background: #d5f4e6;
    color: #27ae60;
}

.progress-item.error {
    background: #fadbd8;
    color: #e74c3c;
}

/* ========== REVIEW QUEUE ========== */
.review-table {
    width: 100%;
    background: white;
    border-radius: 10px;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
}

.review-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
    table-layout: auto;
}

.review-table th {
    background: #2c3e50;
    color: white;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

.review-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #ecf0f1;
    font-size: 13px;
}

/* Compact column widths */
.review-table td:nth-child(1) { width: 30px; } /* Checkbox */
.review-table td:nth-child(2) { width: 120px; } /* Source */
.review-table td:nth-child(3) { width: 180px; } /* Message */
.review-table td:nth-child(4) { width: 200px; } /* Watch */
.review-table td:nth-child(5) { width: 100px; } /* Price */
.review-table td:nth-child(6) { width: 70px; } /* Confidence */
.review-table td:nth-child(7) { width: auto; } /* Actions */

.source-cell {
    font-size: 11px;
}

.source-cell > div {
    margin-bottom: 4px;
}

.review-table td small {
    display: block;
    word-break: break-word;
    white-space: normal;
}

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

.review-actions {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
}

.review-actions button {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.empty-state {
    background: white;
    padding: 60px;
    text-align: center;
    border-radius: 10px;
}

.empty-state p {
    font-size: 18px;
    color: #7f8c8d;
}

/* ========== UTILITIES ========== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

/* ========== PRICING DASHBOARD ========== */
.pricing-dashboard {
    padding: 20px;
}

.stats-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    flex: 1;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: #2c3e50;
}

.stat-label {
    font-size: 14px;
    color: #7f8c8d;
    margin-top: 5px;
}

/* Workflow State Stat Card Colors */
.stat-card.stat-needs-calc {
    background: #fff3cd;
    border-left: 4px solid #f59e0b;
}

.stat-card.stat-needs-calc .stat-value {
    color: #d97706;
}

.stat-card.stat-blocked {
    background: #e9ecef;
    border-left: 4px solid #6c757d;
}

.stat-card.stat-blocked .stat-value {
    color: #495057;
}

.stat-card.stat-ready-approval {
    background: #fef3c7;
    border-left: 4px solid #fbbf24;
}

.stat-card.stat-ready-approval .stat-value {
    color: #f59e0b;
}

.stat-card.stat-ready-publish {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
}

.stat-card.stat-ready-publish .stat-value {
    color: #2563eb;
}

.stat-card.stat-published {
    background: #d1fae5;
    border-left: 4px solid #10b981;
}

.stat-card.stat-published .stat-value {
    color: #059669;
}

.stat-card.stat-stale {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
}

.stat-card.stat-stale .stat-value {
    color: #dc2626;
}

/* Calculate All Modal */
.calculate-all-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.calculate-all-modal {
    background: white;
    border-radius: 12px;
    padding: 0;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.calculate-all-modal .modal-header {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.calculate-all-modal .modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #1f2937;
}

.calculate-all-modal .modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.calculate-all-modal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.stage-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 24px 0;
}

.stage-box {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.stage-box.has-work {
    border-color: #3b82f6;
    background: #eff6ff;
}

.stage-title {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stage-count {
    font-size: 36px;
    font-weight: 700;
    color: #1f2937;
    margin: 8px 0;
}

.stage-box.has-work .stage-count {
    color: #3b82f6;
}

.stage-label {
    font-size: 13px;
    color: #6b7280;
}

.stage-note {
    margin-top: 12px;
    padding: 8px 12px;
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
    font-size: 12px;
    color: #92400e;
    text-align: left;
}

.stage-note.info {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.total-operations {
    margin-top: 16px;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    color: #374151;
}

.progress-log {
    background: #1f2937;
    color: #e5e7eb;
    padding: 16px;
    border-radius: 6px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    max-height: 400px;
    overflow-y: auto;
}

.log-entry {
    margin: 4px 0;
    padding: 2px 0;
}

.processing-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.completion-summary {
    background: #f9fafb;
    border-radius: 8px;
    padding: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row.error {
    color: #dc2626;
}

.error-message {
    color: #dc2626;
    background: #fee2e2;
    padding: 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
}

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 10px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #f8f9fa;
}

.filter-btn.active {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

.pricing-table-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 65vh;
    background: white;
    border-radius: 8px;
}

.pricing-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

.pricing-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #ddd;
}

.pricing-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-approved {
    background: #d1ecf1;
    color: #0c5460;
}

.status-published {
    background: #d4edda;
    color: #155724;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-approve {
    background: #28a745;
    color: #fff;
}

.btn-approve:hover {
    background: #218838;
}

.btn-publish {
    background: #007bff;
    color: #fff;
}

.btn-publish:hover {
    background: #0069d9;
}

.btn-recalculate {
    background: #17a2b8;
    color: #fff;
}

.btn-recalculate:hover {
    background: #138496;
}

.btn-recalculate:disabled {
    background: #93c5cc;
    cursor: not-allowed;
}

.btn-view-sources {
    background: #6c757d;
    color: #fff;
    margin-right: 4px;
}

.btn-view-sources:hover {
    background: #5a6268;
}

/* ========== MODAL STYLES ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: white;
    max-width: 600px;
    margin: 50px auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #7f8c8d;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-select {
    overflow-y: auto;
}

.form-select option {
    padding: 8px;
}

.message-box, .info-box {
    padding: 12px;
    background: #f8f9fa;
    border-left: 3px solid #3498db;
    border-radius: 4px;
    font-size: 14px;
    color: #495057;
    max-height: 150px;
    overflow-y: auto;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

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

/* ============================================
   Conversation Modal Styles
   ============================================ */

.modal-large {
    max-width: 800px;
}

.conversation-messages {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.conversation-message {
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: #f8f9fa;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.conversation-message:hover {
    background: #e9ecef;
}

.conversation-message.current-message {
    background: #fff3cd;
    border-left-color: #ffc107;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
}

.message-time {
    color: #6c757d;
    font-size: 12px;
}

.message-sender {
    font-weight: 600;
    color: #495057;
}

.current-badge {
    background: #ffc107;
    color: #212529;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.message-content {
    color: #212529;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Mention Context Banner */
.mention-context-banner {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
}

.current-mention-highlight {
    margin-bottom: 12px;
}

.current-mention-highlight strong {
    display: block;
    color: #2e7d32;
    font-size: 13px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mention-details {
    font-size: 16px;
    color: #1b5e20;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mention-details strong {
    color: #1b5e20;
    display: inline;
    font-size: 16px;
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
}

.confidence-badge {
    background: #4caf50;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.other-mentions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(76, 175, 80, 0.3);
}

.other-mentions small {
    display: block;
    color: #558b2f;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.other-mention {
    color: #6c757d;
    font-size: 14px;
    padding: 4px 0;
    padding-left: 8px;
}

/* Mention Line Highlighting in Conversation Modal */
.mention-line-highlight {
    background: linear-gradient(135deg, #fff3cd 0%, #fff8e1 100%);
    border-left: 4px solid #ffc107;
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.15);
}

.full-message-expand {
    margin-top: 8px;
    border-top: 1px solid #e9ecef;
    padding-top: 8px;
}

.full-message-expand summary {
    cursor: pointer;
    color: #6c757d;
    font-size: 13px;
    padding: 4px 0;
    user-select: none;
    list-style-position: outside;
}

.full-message-expand summary:hover {
    color: #495057;
    text-decoration: underline;
}

.full-message-expand[open] summary {
    margin-bottom: 8px;
}

.full-message-content {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #495057;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.conversation-messages .loading,
.conversation-messages .error-message,
.conversation-messages .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.conversation-messages .error-message {
    color: #dc3545;
}

/* Scrollbar styling for conversation */
.conversation-messages::-webkit-scrollbar {
    width: 8px;
}

.conversation-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.conversation-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.conversation-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========== PROVENANCE MODAL ========== */
.provenance-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.provenance-header h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 20px;
}

.provenance-meta {
    display: flex;
    gap: 20px;
    color: #6c757d;
    font-size: 13px;
}

.meta-item {
    display: inline-flex;
    align-items: center;
}

.provenance-mentions {
    max-height: 60vh;
    overflow-y: auto;
}

.provenance-mention {
    padding: 15px;
    margin-bottom: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #3498db;
}

.mention-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.mention-price strong {
    color: #2c3e50;
    font-size: 16px;
}

.mention-weight {
    color: #6c757d;
    font-size: 12px;
    background: #e9ecef;
    padding: 3px 8px;
    border-radius: 12px;
}

.mention-message {
    color: #212529;
    margin-bottom: 8px;
    line-height: 1.5;
    font-size: 14px;
}

.mention-footer {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.mention-time {
    color: #6c757d;
    font-size: 11px;
}

.mention-sender {
    color: #6c757d;
    font-size: 11px;
    font-style: italic;
}

.mention-original-id {
    background: #fff3e0;
    color: #e65100;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mention-original-id:hover {
    background: #ffe0b2;
}

.provenance-mentions .loading,
.provenance-mentions .error-message,
.provenance-mentions .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.provenance-mentions .error-message {
    color: #dc3545;
}

/* Scrollbar styling for provenance */
.provenance-mentions::-webkit-scrollbar {
    width: 8px;
}

.provenance-mentions::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.provenance-mentions::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.provenance-mentions::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========== REVIEW QUEUE - SOURCE COLUMN STYLING ========== */

/* Source cell container */
.source-cell {
    min-width: 140px;
    vertical-align: top;
    padding: 12px 8px;
}

/* Filename badge */
.filename-badge {
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    display: inline-block;
    margin-bottom: 6px;
    cursor: default;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filename-badge:hover {
    background: #bbdefb;
}

/* Session badge */
.session-badge {
    background: #f3e5f5;
    color: #7b1fa2;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    display: inline-block;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    transition: background 0.2s ease;
}

.session-badge:hover {
    background: #e1bee7;
}

.session-badge:active {
    background: #ce93d8;
}

/* Original Message ID badge */
.original-id-badge {
    background: #fff3e0;
    color: #e65100;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    display: inline-block;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    transition: background 0.2s ease;
    margin-top: 4px;
}

.original-id-badge:hover {
    background: #ffe0b2;
}

.original-id-badge:active {
    background: #ffcc80;
}

/* ============================================
   V12 STYLE ACTION BUTTONS
   Matches Price Sheet row action button styling
   Clean, minimal white buttons with subtle borders
   ============================================ */

.btn-v12-action {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    color: #374151;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-v12-action:hover {
    background: #f3f4f6;
}

.btn-v12-action:active {
    transform: scale(0.98);
}

.btn-v12-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Semantic color hints on hover - provides visual context */
.btn-v12-action.approve:hover {
    background: #D1FAE5;
    border-color: #059669;
    color: #065F46;
}

.btn-v12-action.reject:hover {
    background: #FEE2E2;
    border-color: #DC2626;
    color: #991B1B;
}

.btn-v12-action.correct:hover {
    background: #FEF3C7;
    border-color: #D97706;
    color: #92400E;
}

.btn-v12-action.llm:hover {
    background: #EDE9FE;
    border-color: #7C3AED;
    color: #5B21B6;
}

.btn-v12-action.conversation:hover {
    background: #DBEAFE;
    border-color: #2563EB;
    color: #1E40AF;
}

/* Delete button - pastel red */
.btn-v12-action.delete {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #FECACA;
}

.btn-v12-action.delete:hover {
    background: #FECACA;
    border-color: #EF4444;
    color: #7F1D1D;
}

.btn-v12-action.delete:active {
    background: #FCA5A5;
    border-color: #DC2626;
}

/* Edit/History buttons */
.btn-v12-action.edit:hover {
    background: #DBEAFE;
    border-color: #2563EB;
    color: #1E40AF;
}

.btn-v12-action.history:hover {
    background: #F3E8FF;
    border-color: #9333EA;
    color: #6B21A8;
}

/* Price Sheet action buttons */
.btn-v12-action.calculate:hover,
.btn-v12-action.recalculate:hover {
    background: #CFFAFE;
    border-color: #0891B2;
    color: #164E63;
}

.btn-v12-action.publish:hover {
    background: #DBEAFE;
    border-color: #2563EB;
    color: #1E40AF;
}

.btn-v12-action.unpublish:hover {
    background: #FEF3C7;
    border-color: #D97706;
    color: #92400E;
}

/* Review actions container styling for V12 buttons */
.review-actions .btn-v12-action {
    padding: 6px 12px;
    font-size: 13px;
}

/* V12 Success Button - Green for primary actions */
.btn-v12-success {
    background: #10b981;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-right: 10px;
}

.btn-v12-success:hover {
    background: #059669;
}

.btn-v12-success:active {
    transform: scale(0.98);
}

/* V12 Secondary Button - White/outlined style */
.btn-v12-secondary {
    background: white;
    color: #333333;
    border: 1px solid #EAEAEA;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-v12-secondary:hover {
    background: #FAFAFA;
}

.btn-v12-secondary:active {
    transform: scale(0.98);
}

/* V12 Primary Button - Blue for key actions */
.btn-v12-primary {
    background: #0070F3;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-v12-primary:hover {
    background: #0060D3;
}

.btn-v12-primary:active {
    transform: scale(0.98);
}

/* Variations action buttons container */
.action-buttons {
    display: flex;
    gap: 5px;
}

.action-buttons .btn-v12-action {
    padding: 6px 12px;
    font-size: 13px;
}

/* ========== VARIATIONS DASHBOARD ========== */
.variations-dashboard {
    padding: 20px;
}

.variations-dashboard .dashboard-header {
    margin-bottom: 30px;
}

.variations-dashboard .dashboard-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.variations-dashboard .subtitle {
    color: #7f8c8d;
    font-size: 14px;
}

.variations-dashboard .stats-panel {
    margin-bottom: 30px;
}

.variations-dashboard .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.variations-dashboard .controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.variations-dashboard .search-filter {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 500px;
}

.variations-dashboard .search-filter input {
    flex: 1;
}

.variations-dashboard .search-filter select {
    width: 150px;
}

.variations-dashboard .bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.variations-dashboard #selected-count {
    font-size: 13px;
    color: #7f8c8d;
}

.variations-dashboard .table-container {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
}

.variations-dashboard .data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.variations-dashboard .data-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 2px solid #ddd;
}

.variations-dashboard .data-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.variations-dashboard .data-table tr:hover {
    background: #f8f9fa;
}

.variations-dashboard .data-table tr.selected {
    background: #e3f2fd;
}

.variations-dashboard .variation-text {
    font-family: 'Courier New', monospace;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.variations-dashboard .watch-badge {
    color: #2c3e50;
    font-size: 13px;
}

.variations-dashboard .type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.variations-dashboard .type-nickname {
    background: #e3f2fd;
    color: #1976d2;
}

.variations-dashboard .type-abbreviation {
    background: #e8f5e9;
    color: #388e3c;
}

.variations-dashboard .type-reference {
    background: #fff3e0;
    color: #f57c00;
}

.variations-dashboard .type-slang {
    background: #fce4ec;
    color: #c2185b;
}

.variations-dashboard .type-misspelling {
    background: #f3e5f5;
    color: #7b1fa2;
}

.variations-dashboard .type-unknown {
    background: #eeeeee;
    color: #616161;
}

.variations-dashboard .confidence-value {
    font-weight: 500;
    color: #2c3e50;
}

.variations-dashboard .action-buttons {
    display: flex;
    gap: 6px;
}

.variations-dashboard .pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
}

.variations-dashboard .page-info {
    font-size: 13px;
    color: #7f8c8d;
}

/* Audit Log Timeline */
.audit-timeline {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px 0;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.timeline-entry {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #ddd;
}

.timeline-entry.success {
    border-left-color: #28a745;
}

.timeline-entry.info {
    border-left-color: #17a2b8;
}

.timeline-entry.danger {
    border-left-color: #dc3545;
}

.timeline-entry .entry-icon {
    font-size: 20px;
}

.timeline-entry .entry-content {
    flex: 1;
}

.timeline-entry .entry-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.timeline-entry .entry-action {
    font-weight: 600;
    color: #2c3e50;
}

.timeline-entry .entry-time {
    font-size: 12px;
    color: #7f8c8d;
}

.timeline-entry .entry-details {
    font-size: 13px;
    color: #555;
}

.timeline-entry .entry-details code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.timeline-entry .entry-by,
.timeline-entry .entry-reason {
    margin-top: 6px;
    font-size: 12px;
    color: #7f8c8d;
}

.variation-info-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 8px;
}

.variation-info-header .info-label {
    font-weight: 600;
    color: #1976d2;
}

.variation-info-header .info-value {
    font-family: 'Courier New', monospace;
}

/* ============================================
   Pricing Dashboard Header
   ============================================ */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e9ecef;
}

.dashboard-header h2 {
    margin: 0;
    font-size: 24px;
    color: #2c3e50;
}

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

.last-updated {
    font-size: 13px;
    color: #7f8c8d;
    font-style: italic;
}

.btn-refresh {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-refresh:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

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

.btn-refresh:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ============================================
   Reasoning Modal Styles
   ============================================ */

.reasoning-modal-content {
    max-width: 700px;
}

.reasoning-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.reasoning-watch-info h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: #2c3e50;
}

.reasoning-metadata {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: #6c757d;
}

.reasoning-metadata .mention-id {
    font-weight: 500;
}

.reasoning-metadata .price {
    font-weight: 600;
    color: #27ae60;
}

.reasoning-badges {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.reasoning-badges .badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reasoning-section {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.reasoning-section:last-child {
    border-bottom: none;
}

.reasoning-section h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.reasoning-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-item label {
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item span {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

.confidence-score {
    color: #8b5cf6 !important;
    font-weight: 700 !important;
}

.reasoning-text {
    padding: 16px;
    background: #f8f9fa;
    border-left: 4px solid #8b5cf6;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
    color: #2c3e50;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.reasoning-section .info-message {
    padding: 16px;
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
    color: #2c3e50;
}

.reasoning-section .info-message p {
    margin: 0 0 8px 0;
}

.reasoning-section .info-message p:last-child {
    margin: 0;
}

.reasoning-section .info-message code {
    padding: 2px 6px;
    background: #ffffff;
    border: 1px solid #2196f3;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #d63031;
}

.reasoning-section .error-message {
    padding: 16px;
    background: #ffebee;
    border-left: 4px solid #f44336;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
    color: #c62828;
}

.reasoning-section .loading {
    padding: 40px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}
