* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f4f6fa;
    color: #1f2937;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.app-header {
    background: white;
    color: #1f2937;
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 10px;
    height: 36px;
    border-radius: 3px;
    background: linear-gradient(180deg, #1BA0D7 0%, #1E3A5F 100%);
    flex-shrink: 0;
}

.app-header h1 {
    font-size: 1.6em;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.2;
}

.app-header p {
    font-size: 0.9em;
    color: #6b7280;
    margin: 2px 0 0 0;
}

.header-links {
    display: flex;
    gap: 8px;
}

.admin-link {
    background: #f3f4f6;
    color: #374151;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    font-size: 0.9em;
    border: 1px solid #e5e7eb;
}

.admin-link:hover {
    background: #e5e7eb;
    color: #111827;
}

.drilldown-link {
    background: #1BA0D7;
    color: white;
    border-color: #1BA0D7;
    font-weight: 600;
}

.drilldown-link:hover {
    background: #1786b3;
    color: white;
}

.main-content {
    padding: 30px;
}

.config-info {
    background: #f8f9fa;
    padding: 20px;
    margin: 20px;
    border-radius: 8px;
}

.config-info h3 {
    margin-bottom: 15px;
    color: #333;
}

#configStatus {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.config-item {
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-item.success {
    background: #d4edda;
    color: #155724;
}

.config-item.error {
    background: #f8d7da;
    color: #721c24;
}

.config-item.demo-mode {
    background: #fff3cd;
    color: #856404;
}

/* File Source Selector Styles */
.file-source-selector {
    background: #f8f9fa;
    padding: 20px;
    margin: 20px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.file-source-selector h3 {
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-source-selector h3:before {
    content: '🔗';
    font-size: 1.2em;
}

.source-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.source-select {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    transition: border-color 0.3s;
}

.source-select:focus {
    outline: none;
    border-color: #1BA0D7;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-activate, .btn-test-all {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-activate {
    background: #28a745;
    color: white;
}

.btn-activate:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
}

.btn-activate:disabled {
    background: #58595B;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-test-all {
    background: #17a2b8;
    color: white;
}

.btn-test-all:hover {
    background: #138496;
    transform: translateY(-1px);
}

.source-status-display {
    margin-top: 10px;
}

.sources-status {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.sources-status h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
}

.source-status {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 4px;
    font-size: 13px;
}

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

.source-status.error {
    background: #f8d7da;
    color: #721c24;
}

.status-icon {
    font-weight: bold;
    margin-right: 8px;
    font-size: 14px;
}

.source-name {
    font-weight: 600;
    min-width: 80px;
    margin-right: 10px;
}

.status-message {
    flex: 1;
    font-size: 12px;
}

/* Recording item updates for source indicators */
.recording-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.recording-meta {
    font-size: 0.85em;
    color: #58595B;
    margin-top: 5px;
}

.demo-banner {
    background: linear-gradient(135deg, #ffecd1 0%, #fcb69f 100%);
    margin: 20px;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.demo-content h3 {
    color: #d63384;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.demo-content p {
    color: #6f42c1;
    margin-bottom: 20px;
}

.btn-demo, .btn-demo-clear {
    background: #d63384;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 10px;
    transition: background 0.3s;
}

.btn-demo:hover {
    background: #c42a6f;
}

.btn-demo-clear {
    background: #58595B;
}

.btn-demo-clear:hover {
    background: #5a6268;
}

.upload-section, .s3-section, .results-section, .topics-section, .clusters-section, .export-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

#uploadForm {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

input[type="file"] {
    padding: 10px;
    border: 2px dashed #1BA0D7;
    border-radius: 5px;
    background: white;
    flex: 1;
    min-width: 200px;
}

button {
    background: linear-gradient(135deg, #1BA0D7 0%, #1E3A5F 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: transform 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#uploadProgress, #s3Recordings, #processingResults, #topicsList, #clusterResults {
    margin-top: 20px;
}

.recordings-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.bulk-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bulk-process-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.bulk-process-btn:hover:not(:disabled) {
    background: #218838;
}

.bulk-process-btn:disabled {
    background: #58595B;
    cursor: not-allowed;
}

.recording-item, .result-item, .topic-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recording-item.selected {
    border-color: #007bff;
    background: #f8f9ff;
}

.progress-dots {
    animation: progressDots 1.5s infinite;
}

@keyframes progressDots {
    0% { content: "●○○"; }
    33% { content: "●●○"; }
    66% { content: "●●●"; }
    100% { content: "●○○"; }
}

.bulk-processing-status {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    color: #856404;
}

.bulk-processing-status.success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.bulk-processing-status.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.recording-item:hover, .result-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.recording-info {
    flex: 1;
}

.recording-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.recording-meta {
    font-size: 0.9em;
    color: #58595B;
}

.process-btn {
    padding: 8px 16px;
    font-size: 0.9em;
}

.topic-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #1BA0D7;
}

.topic-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.topic-number {
    color: #1BA0D7;
    font-weight: 700;
    margin-right: 8px;
}

.subtopic-number {
    color: #1BA0D7;
    font-weight: 600;
    margin-right: 6px;
    font-size: 0.9em;
}

.cluster-number {
    color: #1BA0D7;
    font-weight: 700;
    margin-right: 8px;
}

.topic-description {
    color: #58595B;
    line-height: 1.5;
}

.cluster-group {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 2px solid #1BA0D7;
}

.cluster-name {
    font-size: 1.2em;
    font-weight: 600;
    color: #1BA0D7;
    margin-bottom: 10px;
}

.cluster-description {
    color: #58595B;
    margin-bottom: 15px;
}

.cluster-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cluster-topic-tag {
    background: #e9ecef;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    color: #495057;
}

.cluster-topic-tag .topic-number {
    color: #1BA0D7;
    font-weight: 600;
    margin-right: 4px;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #58595B;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
}

.transcript-preview {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    font-style: italic;
    color: #495057;
}

@media (max-width: 768px) {
    .container {
        border-radius: 0;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .main-content {
        padding: 20px;
    }
    
    #uploadForm {
        flex-direction: column;
    }
    
    input[type="file"] {
        width: 100%;
    }
}

/* Metrics Dashboard Styles */
.metrics-dashboard {
    background: linear-gradient(135deg, #1BA0D7 0%, #1E3A5F 100%);
    margin: 20px;
    padding: 30px;
    border-radius: 12px;
    color: white;
}

.metrics-dashboard h2 {
    color: white;
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.8em;
}

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

.metric-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s, background 0.3s;
}

.metric-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
}

.metric-card h3 {
    font-size: 0.9em;
    opacity: 0.8;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.metric-value {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.metric-unit {
    font-size: 0.8em;
    opacity: 0.7;
}

/* Enhanced Topic Display */
.topics-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topics-header label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #495057;
}

.topic-item.sentiment-positive {
    border-left-color: #28a745;
    background: linear-gradient(to right, #d4edda 0%, #ffffff 5%);
}

.topic-item.sentiment-negative {
    border-left-color: #dc3545;
    background: linear-gradient(to right, #f8d7da 0%, #ffffff 5%);
}

.topic-item.sentiment-neutral {
    border-left-color: #ffc107;
    background: linear-gradient(to right, #fff3cd 0%, #ffffff 5%);
}

.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.topic-confidence {
    font-size: 0.85em;
    color: #58595B;
    font-weight: 500;
}

.topic-metrics {
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.metric-tag {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.metric-tag.sentiment-positive {
    background: #d4edda;
    color: #155724;
}

.metric-tag.sentiment-negative {
    background: #f8d7da;
    color: #721c24;
}

.metric-tag.sentiment-neutral {
    background: #fff3cd;
    color: #856404;
}

.metric-tag.performance {
    background: #cfe2ff;
    color: #0c5460;
}

.metric-tag.duration {
    background: #e2e3e5;
    color: #383d41;
}

.metric-tag.resolution-resolved {
    background: #d4edda;
    color: #155724;
}

.metric-tag.resolution-escalated {
    background: #f8d7da;
    color: #721c24;
}

.metric-tag.resolution-scheduled {
    background: #fff3cd;
    color: #856404;
}

/* Subtopics Display */
.subtopics {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.subtopics-header {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.subtopic-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    padding: 4px 0;
}

.subtopic-name {
    font-weight: 500;
    color: #333;
}

.subtopic-frequency {
    background: #e9ecef;
    color: #58595B;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.75em;
    font-weight: 600;
}

.subtopic-sentiment {
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.75em;
    font-weight: 500;
}

.subtopic-sentiment.sentiment-positive {
    background: #d4edda;
    color: #155724;
}

.subtopic-sentiment.sentiment-negative {
    background: #f8d7da;
    color: #721c24;
}

.subtopic-sentiment.sentiment-neutral {
    background: #fff3cd;
    color: #856404;
}

/* Enhanced Cluster Display */
.cluster-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.cluster-stats {
    font-size: 0.9em;
    color: #58595B;
    font-weight: 500;
}

.cluster-metrics {
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cluster-keywords {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.keywords-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
}

.keyword-tag {
    background: #e9ecef;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    color: #495057;
    font-weight: 500;
}

.metric-tag.resolution {
    background: #d1ecf1;
    color: #0c5460;
}

.metric-tag.satisfaction {
    background: #f1c0e8;
    color: #6f42c1;
}

/* Cost Analytics Styles */
.cost-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #17a2b8;
}

.cost-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.cost-controls label {
    font-weight: 500;
    color: #495057;
}

.cost-controls select {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    color: #495057;
}

.cost-metric {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.cost-metric h3,
.cost-metric .metric-value {
    color: white;
}

.cost-summary {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cost-summary h3 {
    color: #17a2b8;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.service-costs,
.provider-costs {
    margin-bottom: 20px;
}

.service-costs h4,
.provider-costs h4 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1em;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 5px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #17a2b8;
}

.cost-item span:first-child {
    font-weight: 500;
    color: #495057;
}

.cost-value {
    font-weight: 600;
    color: #17a2b8;
}

.cost-trends {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cost-trends h3 {
    color: #17a2b8;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.trend-summary {
    background: #e7f6f8;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.trend-summary p {
    margin: 5px 0;
    color: #495057;
}

.trend-summary strong {
    color: #17a2b8;
}

.daily-costs h4 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1em;
}

/* Responsive Design for Metrics */
@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .metric-value {
        font-size: 2em;
    }
    
    .topics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .topic-metrics, .cluster-metrics {
        justify-content: flex-start;
    }
    
    .cost-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cost-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* Data Management Styles */
.data-management-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.data-info {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
}

.danger-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 10px 0;
}

.danger-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.danger-btn:disabled {
    background: #58595B;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.warning-text {
    display: block;
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    font-style: italic;
}

/* === UI refresh: primary upload action, drop-zone, collapsible admin === */

.primary-action {
    border: 1px solid #e5e7eb;
    background: white;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.primary-action h2 {
    font-size: 1.15em;
    color: #111827;
    margin-bottom: 14px;
}

.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 28px 20px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
    margin-bottom: 12px;
}

.dropzone:hover,
.dropzone.is-dragover {
    border-color: #1BA0D7;
    background: #eff6fb;
    color: #1f2937;
}

.dropzone-icon {
    font-size: 1.6em;
    color: #1BA0D7;
    line-height: 1;
}

.dropzone-title {
    font-weight: 600;
    color: #111827;
}

.dropzone-subtitle {
    font-size: 0.85em;
    color: #6b7280;
}

.dropzone-filename {
    margin-top: 6px;
    font-size: 0.85em;
    color: #1BA0D7;
    font-weight: 500;
    word-break: break-all;
}

.dropzone-filename:empty {
    display: none;
}

/* Hide the native file input — the label is the drop-zone */
.dropzone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    flex: none;
    min-width: 0;
}

#uploadForm {
    flex-direction: column;
    align-items: stretch;
}

.btn-primary {
    align-self: flex-start;
}

/* Tighten section headings — they used to all shout at the same level */
.main-content > section > h2,
.main-content > .recordings-section > h2,
.main-content > .results-section > h2,
.main-content > .topics-section > h2,
.main-content > .clusters-section > h2 {
    font-size: 1.15em;
    color: #111827;
    margin-bottom: 14px;
    font-weight: 600;
}

/* Collapsible Settings & Admin block */
.settings-group {
    margin-top: 30px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: white;
    overflow: hidden;
}

.settings-group > summary {
    padding: 14px 20px;
    cursor: pointer;
    font-weight: 600;
    color: #374151;
    list-style: none;
    background: #f9fafb;
    border-bottom: 1px solid transparent;
    user-select: none;
    transition: background 0.15s;
}

.settings-group > summary::-webkit-details-marker {
    display: none;
}

.settings-group > summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 10px;
    color: #9ca3af;
    transition: transform 0.15s;
}

.settings-group[open] > summary::before {
    transform: rotate(90deg);
}

.settings-group[open] > summary {
    border-bottom-color: #e5e7eb;
}

.settings-group > summary:hover {
    background: #f3f4f6;
}

.settings-group > .config-info,
.settings-group > .file-source-selector,
.settings-group > .export-section,
.settings-group > .cost-section,
.settings-group > .data-management-section {
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    box-shadow: none;
}

.settings-group > div + div {
    border-top: 1px solid #f1f5f9;
}

.settings-group h3 {
    font-size: 1em;
    color: #111827;
    font-weight: 600;
}

/* === Visual Analytics: cluster bar chart + topic heatmap === */
.visuals-section {
    margin-bottom: 30px;
}

.visuals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
}

.visual-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.visual-card h3 {
    font-size: 1em;
    color: #111827;
    margin-bottom: 4px;
    font-weight: 600;
}

.visual-sub {
    font-size: 0.85em;
    color: #6b7280;
    margin-bottom: 14px;
}

.chart-wrap {
    position: relative;
    height: 320px;
}

.visual-empty {
    color: #9ca3af;
    font-size: 0.9em;
    text-align: center;
    padding: 40px 0;
}

/* Heatmap: CSS-grid table; cell intensity is set inline via background-color */
.heatmap {
    display: grid;
    grid-template-columns: minmax(120px, 1.5fr) repeat(3, 1fr);
    gap: 4px;
    align-items: stretch;
    font-size: 0.85em;
}

.heatmap .hm-corner,
.heatmap .hm-col-head,
.heatmap .hm-row-head {
    font-weight: 600;
    color: #374151;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.heatmap .hm-col-head {
    justify-content: center;
    text-transform: capitalize;
}

.heatmap .hm-row-head {
    color: #1f2937;
    font-weight: 500;
    background: transparent;
    padding-left: 4px;
}

.heatmap .hm-cell {
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: #1f2937;
    transition: transform 0.1s;
    cursor: default;
}

.heatmap .hm-cell:hover {
    transform: scale(1.04);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.heatmap .hm-cell.empty {
    color: #cbd5e1;
    cursor: default;
}

.heatmap .hm-cell.clickable {
    cursor: pointer;
}

.heatmap .hm-cell.clickable:focus-visible {
    outline: 2px solid #1BA0D7;
    outline-offset: 2px;
}

/* Per-cluster drill-down trigger button */
.cluster-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
}

.btn-link {
    background: transparent;
    color: #1BA0D7;
    border: 1px solid #1BA0D7;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.btn-link:hover {
    background: #1BA0D7;
    color: white;
}

/* Drill-down panel */
.drilldown-section {
    margin-bottom: 30px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    scroll-margin-top: 20px;
}

.drilldown-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.drilldown-header h2 {
    font-size: 1.05em;
    color: #111827;
    margin: 0;
    font-weight: 600;
}

.drilldown-header .visual-sub {
    margin: 4px 0 0 0;
}

.drilldown-close {
    background: transparent;
    border: none;
    font-size: 1.6em;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.drilldown-close:hover {
    background: #f3f4f6;
    color: #111827;
    transform: none;
    box-shadow: none;
}

.drilldown-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.drilldown-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 16px;
}

.drilldown-item-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.drilldown-item-recording {
    font-weight: 600;
    color: #111827;
    font-size: 0.95em;
    word-break: break-all;
}

.drilldown-item-meta {
    color: #6b7280;
    font-size: 0.8em;
}

.drilldown-item-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.drilldown-transcript {
    font-size: 0.9em;
    line-height: 1.5;
    color: #374151;
    background: white;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    white-space: pre-wrap;
    max-height: 240px;
    overflow-y: auto;
}

.drilldown-transcript.expanded {
    max-height: none;
}

.drilldown-toggle {
    margin-top: 6px;
    background: transparent;
    border: none;
    color: #1BA0D7;
    cursor: pointer;
    font-size: 0.85em;
    padding: 4px 0;
    box-shadow: none;
}

.drilldown-toggle:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
    text-decoration: underline;
}

.drilldown-empty {
    color: #6b7280;
    text-align: center;
    padding: 24px 0;
    font-size: 0.9em;
}