/* CSS Variables */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --border-color: #30363d;
    --border-light: #484f58;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-primary: #58a6ff;
    --accent-secondary: #1f6feb;
    --accent-green: #3fb950;
    --accent-red: #f85149;
    --accent-yellow: #d29922;
    --accent-purple: #a371f7;
    --accent-orange: #db6d28;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.5);
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 12px;
    --transition: 150ms ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow: hidden;
    padding-bottom: 32px;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 32px);
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
}

.logo h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.status-badge {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.status-badge.ready {
    background-color: rgba(63, 185, 80, 0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.btn svg {
    width: 14px;
    height: 14px;
}

.btn-primary {
    background-color: var(--accent-secondary);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--accent-primary);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-danger {
    background-color: rgba(248, 81, 73, 0.15);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.btn-danger:hover {
    background-color: var(--accent-red);
    color: #fff;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 280px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-section {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent-primary);
    background-color: rgba(88, 166, 255, 0.05);
}

.upload-zone svg {
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-zone p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.upload-zone .supported-formats {
    font-size: 11px;
    color: var(--text-muted);
}

.upload-zone input {
    display: none;
}

/* Sample Data Section */
.sample-data-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.sample-data-section .section-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.sample-data-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

/* Tables List */
.tables-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.table-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--transition);
}

.table-item:hover {
    background-color: var(--bg-hover);
}

.table-item .table-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-primary);
}

.table-item .table-rows {
    font-size: 11px;
    color: var(--text-muted);
}

.table-item .delete-table {
    opacity: 0;
    background: none;
    border: none;
    color: var(--accent-red);
    cursor: pointer;
    padding: 2px;
    transition: opacity var(--transition);
}

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

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Tabs */
.tabs {
    display: flex;
    padding: 0 16px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.tab {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* Tab Panels */
.tab-content {
    flex: 1;
    overflow: hidden;
}

.tab-panel {
    display: none;
    height: 100%;
    overflow: auto;
    padding: 16px;
}

.tab-panel.active {
    display: flex;
    flex-direction: column;
}

/* SQL Editor */
.sql-editor-container {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--bg-secondary);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.query-templates select {
    padding: 6px 10px;
    font-size: 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

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

.sql-editor {
    min-height: 150px;
    max-height: 300px;
}

.sql-editor .CodeMirror {
    height: 100%;
    min-height: 150px;
    background-color: var(--bg-secondary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
}

.query-info {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.query-info span:not(:empty)::before {
    margin-right: 4px;
}

/* Results Table */
.results-container {
    flex: 1;
    min-height: 200px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-secondary);
}

.results-table-wrapper {
    height: 100%;
    overflow: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.results-table th,
.results-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.results-table th {
    position: sticky;
    top: 0;
    background-color: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.results-table tr:hover td {
    background-color: var(--bg-hover);
}

.results-table td.null-value {
    color: var(--text-muted);
    font-style: italic;
}

.results-table td.number {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}

/* Auto-generated columns (like _ts_epoch) in results */
.results-table th.auto-generated-col,
.results-table td.auto-generated-col {
    opacity: 0.5;
    background: var(--bg-tertiary);
}

.results-table tr:hover td.auto-generated-col {
    opacity: 0.7;
}

.results-table .auto-gen-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    background: var(--text-muted);
    color: var(--bg-primary);
    border-radius: 3px;
    vertical-align: middle;
    opacity: 0.8;
}

/* Analytics Panel */
.analytics-controls,
.anomaly-controls,
.viz-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.control-group .hint-text {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.control-group select,
.control-group input[type="text"],
.control-group input[type="number"] {
    padding: 8px 12px;
    font-size: 13px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    min-width: 150px;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.control-group select[multiple] {
    min-height: 80px;
}

.control-group input[type="range"] {
    width: 150px;
}

/* Analytics Results */
.analytics-results,
.anomaly-results {
    flex: 1;
    overflow: auto;
    padding: 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

/* Summary Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stats-card {
    padding: 16px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.stats-card h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    word-break: break-word;
}

.stats-card .value {
    font-size: 24px;
    font-weight: 600;
    color: var(--accent-primary);
    word-break: break-all;
}

.stats-card .label {
    font-size: 11px;
    color: var(--text-muted);
}

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

.stats-list .stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    gap: 8px;
}

.stats-list .stat-row .key {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.stats-list .stat-row .val {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    word-break: break-all;
    overflow-wrap: break-word;
    min-width: 0;
}

/* Anomaly Markers */
.anomaly-row {
    background-color: rgba(248, 81, 73, 0.1) !important;
}

.anomaly-row td {
    border-left: 3px solid var(--accent-red);
}

.anomaly-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    background-color: var(--accent-red);
    color: #fff;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.anomaly-score {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Chart Container */
.chart-container {
    flex: 1;
    min-height: 400px;
    height: 400px;
    padding: 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
}

.chart-container canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Discover Layout (Kibana-like) */
.discover-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
}

/* Top Bar */
.discover-top-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.discover-table-select {
    min-width: 180px;
}

.discover-table-select select {
    width: 100%;
    padding: 8px 12px;
}

.discover-query-bar {
    flex: 1;
    display: flex;
    gap: 8px;
    min-width: 300px;
}

.discover-query-bar input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
}

.discover-query-bar input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.discover-time-picker {
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.time-picker-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.time-picker-btn svg {
    flex-shrink: 0;
}

.btn-icon {
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Time Picker Dropdown */
.time-picker-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 2000;
    margin-top: 4px;
}

.time-picker-dropdown.visible {
    display: block;
}

.time-picker-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.time-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
}

.time-tab:hover {
    color: var(--text-primary);
}

.time-tab.active {
    color: var(--accent-primary);
    border-bottom: 2px solid var(--accent-primary);
}

.time-picker-content {
    padding: 12px;
}

.time-panel {
    display: none;
}

.time-panel.active {
    display: block;
}

.quick-ranges {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.quick-range {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    text-align: left;
}

.quick-range:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.quick-range.active {
    background: var(--accent-primary)22;
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.relative-time-input,
.absolute-time-input {
    margin-bottom: 12px;
}

.relative-time-input label,
.absolute-time-input label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.relative-input-group {
    display: flex;
    gap: 8px;
}

.relative-input-group input {
    width: 80px;
    padding: 8px;
}

.relative-input-group select {
    flex: 1;
}

.now-label {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
}

.absolute-time-input input {
    width: 100%;
    padding: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

/* Discover Body Layout */
.discover-body {
    display: flex;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

/* Fields Sidebar */
.discover-sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 280px);
    overflow: hidden;
}

.discover-sidebar .sidebar-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.discover-sidebar .sidebar-header {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-search {
    width: 100%;
    margin-top: 8px;
    padding: 6px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
}

.fields-list {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
    padding: 4px 0;
}

.field-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.field-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.field-item .field-type {
    font-size: 10px;
    padding: 2px 4px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.field-item .field-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-item.selected {
    background: var(--accent-primary)11;
    color: var(--accent-primary);
}

.selected-fields-list {
    padding: 8px;
    min-height: 60px;
}

.selected-field-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    margin: 2px;
    background: var(--accent-primary)22;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--accent-primary);
}

.selected-field-tag .remove-field {
    cursor: pointer;
    opacity: 0.7;
}

.selected-field-tag .remove-field:hover {
    opacity: 1;
}

/* Results Area */
.discover-results {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.time-histogram-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.time-histogram-container .time-chart {
    position: relative;
}

.time-histogram-container canvas {
    cursor: crosshair;
}

.histogram-selection-overlay {
    position: absolute;
    background: rgba(88, 166, 255, 0.3);
    border: 1px solid rgba(88, 166, 255, 0.8);
    pointer-events: none;
    top: 0;
    bottom: 0;
    z-index: 10;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chart-title {
    font-weight: 500;
    color: var(--text-primary);
}

.record-count {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.time-chart {
    height: 150px !important;
    min-height: 150px !important;
    padding: 0;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-controls select {
    padding: 4px 8px;
    font-size: 12px;
}

/* Documents Table */
.discover-documents {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.documents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.documents-title {
    font-weight: 500;
    color: var(--text-primary);
}

.documents-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.documents-controls select {
    padding: 6px 12px;
    font-size: 13px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    min-width: 120px;
}

.documents-table {
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
}

/* Kibana-style document row */
.doc-row {
    border-left: 3px solid transparent;
    background: var(--bg-secondary);
    margin-bottom: 1px;
    transition: border-color 0.15s;
}

.doc-row:hover {
    border-left-color: var(--accent-primary);
}

.doc-row.expanded {
    border-left-color: var(--accent-primary);
}

.doc-row-header {
    display: flex;
    align-items: flex-start;
    padding: 10px 16px;
    cursor: pointer;
    gap: 8px;
}

.doc-row-header:hover {
    background: var(--bg-tertiary);
}

.doc-expand-icon {
    width: 14px;
    height: 14px;
    margin-top: 3px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.doc-row.expanded .doc-expand-icon {
    transform: rotate(90deg);
    color: var(--accent-primary);
}

.doc-timestamp {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--status-info);
    background: var(--status-info)15;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.doc-preview {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
}

.doc-preview .preview-field {
    color: var(--accent-primary);
    font-weight: 500;
}

.doc-preview .preview-sep {
    color: var(--text-muted);
    margin: 0 4px;
}

/* Kibana-style expanded details */
.doc-details {
    display: none;
    padding: 0 16px 16px 38px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

.doc-row.expanded .doc-details {
    display: block;
}

/* JSON-style field display */
.doc-details-json {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    margin-top: 12px;
}

.doc-field {
    display: flex;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

.doc-field:last-child {
    border-bottom: none;
}

.doc-field-name {
    min-width: 180px;
    max-width: 250px;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    padding-right: 12px;
    flex-shrink: 0;
}

.doc-field-value {
    flex: 1;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    word-break: break-word;
    white-space: pre-wrap;
}

.doc-field-value.value-string {
    color: #98c379;
}

.doc-field-value.value-number {
    color: #d19a66;
}

.doc-field-value.value-boolean {
    color: #c678dd;
}

.doc-field-value.value-null {
    color: var(--text-muted);
    font-style: italic;
}

/* Table view for documents */
.doc-table-view {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.doc-table-view th {
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
    padding: 10px 12px;
    text-align: left;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.doc-table-view td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
}

.doc-table-view tr:hover td {
    background: var(--bg-tertiary);
}

/* View toggle buttons */
.doc-view-toggle {
    display: flex;
    gap: 4px;
}

.doc-view-btn {
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
}

.doc-view-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.doc-view-btn:hover:not(.active) {
    background: var(--bg-secondary);
}

.documents-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.pagination-btn {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-primary);
    color: var(--text-primary);
}

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

.pagination-info {
    font-size: 12px;
    color: var(--text-muted);
}

/* Field Statistics Sidebar (compact) */
.field-stats-sidebar {
    flex-shrink: 0;
}

.field-stats-sidebar .sidebar-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.breakdown-field-select {
    width: 100%;
    padding: 6px 8px;
    font-size: 11px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.breakdown-list {
    max-height: 180px;
    overflow-y: auto;
    padding: 4px 0;
}

.breakdown-list-item {
    display: flex;
    align-items: center;
    padding: 4px 12px;
    gap: 8px;
    font-size: 11px;
    cursor: pointer;
}

.breakdown-list-item:hover {
    background: var(--bg-tertiary);
}

.breakdown-list-item .item-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.breakdown-list-item .item-bar {
    width: 40px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.breakdown-list-item .item-bar-fill {
    height: 100%;
    background: var(--accent-primary);
}

.breakdown-list-item .item-count {
    min-width: 45px;
    text-align: right;
    color: var(--text-muted);
    font-size: 10px;
}

/* Field Statistics Panel (legacy - hidden) */
.field-stats-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.field-stats-panel summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    user-select: none;
}

.field-stats-panel summary:hover {
    color: var(--text-primary);
}

.field-stats-panel[open] summary {
    border-bottom: 1px solid var(--border-color);
}

.field-stats-controls {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.field-stats-controls select {
    padding: 6px 10px;
    font-size: 13px;
}

.field-stats-content {
    padding: 16px;
}

.field-stats-content .breakdown-chart {
    height: 200px;
}

.field-breakdown {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.breakdown-title {
    font-weight: 500;
    color: var(--text-primary);
}

.breakdown-controls {
    display: flex;
    gap: 8px;
}

.breakdown-controls select {
    padding: 6px 10px;
    font-size: 13px;
}

.breakdown-chart {
    height: 250px;
    margin-bottom: 16px;
}

.breakdown-table {
    max-height: 300px;
    overflow-y: auto;
}

.breakdown-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

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

.breakdown-row:hover {
    background: var(--bg-tertiary);
}

.breakdown-value {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.breakdown-bar-container {
    width: 100px;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.breakdown-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.breakdown-count {
    min-width: 60px;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
}

.breakdown-percent {
    min-width: 50px;
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
}

/* Advanced options collapsible */
.advanced-viz-options {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.advanced-viz-options summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    user-select: none;
}

.advanced-viz-options summary:hover {
    color: var(--text-primary);
}

.advanced-viz-options[open] summary {
    border-bottom: 1px solid var(--border-color);
}

.advanced-controls {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 16px;
}

.custom-chart {
    margin: 16px;
    margin-top: 0;
}

/* Schema Panel */
.schema-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.schema-table {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.schema-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.schema-table-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-primary);
}

.schema-columns {
    padding: 12px 16px;
}

.schema-column {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.schema-column:last-child {
    border-bottom: none;
}

.column-name {
    font-weight: 500;
    color: var(--text-primary);
    min-width: 150px;
}

.column-type {
    font-size: 12px;
    padding: 2px 8px;
    background-color: var(--bg-hover);
    border-radius: var(--radius-sm);
    color: var(--accent-purple);
    font-family: monospace;
}

.column-stats {
    font-size: 12px;
    color: var(--text-muted);
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background-color: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 40px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-color: var(--accent-green);
}

.toast.error {
    border-color: var(--accent-red);
}

.toast.warning {
    border-color: var(--accent-yellow);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(13, 17, 23, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 2000;
}

.loading-overlay.visible {
    display: flex;
}

.loader {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-hover);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Placeholder Text */
.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 40px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Correlation Matrix */
.correlation-matrix {
    overflow-x: auto;
}

.correlation-table {
    border-collapse: collapse;
    font-size: 12px;
}

.correlation-table th,
.correlation-table td {
    padding: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
    min-width: 60px;
}

.correlation-table th {
    background-color: var(--bg-tertiary);
    font-weight: 600;
}

.correlation-cell {
    color: #fff;
    font-weight: 500;
}

/* Histogram */
.histogram-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.histogram-bar .label {
    min-width: 100px;
    font-size: 12px;
    text-align: right;
    color: var(--text-secondary);
}

.histogram-bar .bar {
    height: 20px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.histogram-bar .count {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 40px;
}

/* Time Series Chart Container */
.time-chart-container {
    height: 300px;
    margin-top: 16px;
}

/* Query History */
.query-history {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.query-history h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.history-list {
    max-height: 150px;
    overflow-y: auto;
}

.history-item {
    padding: 6px 8px;
    font-size: 11px;
    font-family: monospace;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color var(--transition);
}

.history-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Data Preview Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(13, 17, 23, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-overlay.visible {
    display: flex;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* Schema Mapping Modal */
.schema-mapping-modal {
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
}

.schema-modal-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.schema-modal-toolbar .schema-modal-info {
    flex: 1;
    margin-bottom: 0;
}

.schema-modal-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.schema-modal-actions .btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.schema-modal-info {
    padding: 12px 16px;
    background: var(--accent-primary)15;
    border: 1px solid var(--accent-primary)40;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-primary);
}

.schema-modal-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.schema-summary-item {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.schema-summary-item .summary-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.schema-summary-item .summary-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.schema-modal-table-wrapper {
    max-height: 400px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.schema-mapping-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.schema-mapping-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
    z-index: 1;
}

.schema-mapping-table th {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.schema-mapping-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.schema-mapping-table tr:hover {
    background: var(--bg-tertiary);
}

.schema-mapping-table .field-name {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--accent-primary);
}

.schema-mapping-table .detected-type {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    color: var(--text-secondary);
}

.schema-mapping-table select {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
}

.schema-mapping-table .sample-values {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schema-mapping-table .sample-decoded {
    display: block;
    font-size: 10px;
    margin-top: 4px;
    padding: 2px 4px;
    border-radius: 3px;
    min-height: 16px;
}

.schema-mapping-table .sample-decoded.decode-success {
    color: var(--status-success);
    background: var(--status-success)10;
}

.schema-mapping-table .sample-decoded.decode-failure {
    color: var(--status-error);
    background: var(--status-error)15;
}

.schema-mapping-table .decode-error {
    font-weight: 500;
}

.schema-mapping-table .sample-cell {
    min-width: 200px;
    max-width: 300px;
}

.schema-mapping-table .time-field-none-row {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
}

.schema-mapping-table .no-time-field-label {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 12px;
}

.schema-mapping-table .time-field-radio {
    text-align: center;
}

.schema-mapping-table .time-field-radio input[type="radio"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.schema-auto-show {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: auto;
}

.schema-auto-show input {
    cursor: pointer;
}

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

/* Schema Configuration */
.schema-toolbar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding: 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.schema-config-container {
    padding: 16px;
}

.schema-config-info {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.schema-columns-table {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.schema-columns-table table {
    width: 100%;
    border-collapse: collapse;
}

.schema-columns-table th,
.schema-columns-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.schema-columns-table th {
    background: var(--bg-tertiary);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

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

.schema-columns-table tr:hover td {
    background: var(--bg-tertiary);
}

.schema-columns-table .col-name {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
}

.schema-columns-table .col-detected {
    font-size: 12px;
    color: var(--text-muted);
}

.schema-columns-table select {
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    min-width: 140px;
}

.schema-columns-table input[type="radio"] {
    margin: 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.schema-columns-table .time-field-radio {
    text-align: center;
    vertical-align: middle;
}

.schema-columns-table .time-field-none-row {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
}

.schema-columns-table .time-field-none-row:hover td {
    background: var(--bg-tertiary);
}

.schema-columns-table .no-time-field-label {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 12px;
}

.schema-sample-values {
    font-size: 11px;
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Schema Summary */
.schema-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.schema-summary-item {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    min-width: 100px;
}

.schema-summary-item .summary-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 4px;
}

.schema-summary-item .summary-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Schema Decoded Values */
.schema-decoded {
    display: block;
    font-size: 10px;
    margin-top: 4px;
    padding: 2px 4px;
    border-radius: 3px;
    min-height: 16px;
}

.schema-decoded.decode-success {
    color: var(--status-success);
    background: var(--status-success)10;
}

.schema-decoded.decode-failure {
    color: var(--status-error);
    background: var(--status-error)15;
}

.schema-decoded .decode-error {
    font-weight: 500;
}

.schema-columns-table .sample-cell {
    min-width: 180px;
    max-width: 280px;
}

.schema-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
}

.schema-tag.timestamp {
    background: var(--accent-blue)33;
    color: var(--accent-blue);
}

.schema-tag.numeric {
    background: var(--accent-green)33;
    color: var(--accent-green);
}

.schema-tag.text {
    background: var(--accent-orange)33;
    color: var(--accent-orange);
}

.schema-tag.ip {
    background: var(--accent-purple)33;
    color: var(--accent-purple);
}

.schema-tag.categorical {
    background: var(--text-muted)33;
    color: var(--text-secondary);
}

/* Schema Time Field UI */
.schema-columns-table .time-field-cell {
    white-space: nowrap;
    min-width: 150px;
}

.index-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    background: var(--accent-green)22;
    color: var(--accent-green);
    margin-right: 4px;
}

.index-badge svg {
    flex-shrink: 0;
}

.index-badge.auto {
    background: var(--accent-blue)22;
    color: var(--accent-blue);
}

.index-badge.time-field {
    background: var(--accent-purple)22;
    color: var(--accent-purple);
}

.index-badge.auto-generated {
    background: var(--text-muted)22;
    color: var(--text-muted);
}

.btn-index {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-right: 4px;
}

.btn-index:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-set-time:hover {
    background: var(--accent-purple)22;
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

.btn-clear-time {
    padding: 3px 6px;
    margin-left: 2px;
    margin-right: 4px;
}

.btn-clear-time:hover {
    background: var(--accent-red)22;
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.btn-index svg {
    flex-shrink: 0;
}

/* Auto-generated row (like _ts_epoch) */
.schema-columns-table .auto-generated-row {
    opacity: 0.5;
}

.schema-columns-table .auto-generated-row:hover {
    opacity: 0.7;
}

.schema-columns-table .auto-generated-row td {
    background: var(--bg-tertiary);
}

/* Pending changes styles */
.pending-changes-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--accent-yellow)22;
    border: 1px solid var(--accent-yellow)55;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    color: var(--accent-yellow);
    font-size: 13px;
}

.pending-changes-banner svg {
    flex-shrink: 0;
}

.index-badge.pending,
.index-badge.time-field.pending {
    border-style: dashed;
    opacity: 0.8;
}

.index-badge.pending::after,
.index-badge.time-field.pending::after {
    content: "";
    position: absolute;
    top: -1px;
    right: -1px;
    width: 6px;
    height: 6px;
    background: var(--accent-yellow);
    border-radius: 50%;
}

.index-badge.pending,
.index-badge.time-field.pending {
    position: relative;
}

/* Heuristic Mode */
.heuristic-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border-color);
}

.heuristic-header h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: var(--text-primary);
}

.heuristic-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.heuristic-controls {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    align-items: flex-end;
    flex-wrap: wrap;
}

.heuristic-controls .control-group {
    min-width: 200px;
}

.heuristic-controls .btn-large {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 14px;
}

.heuristic-controls .btn-icon {
    font-size: 16px;
}

.heuristic-progress {
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.progress-bar {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-blue));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.heuristic-report {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.report-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.report-placeholder .placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.report-placeholder h4 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.report-placeholder p {
    margin: 0 0 24px 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.feature-list {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
}

.feature-icon {
    font-size: 18px;
}

/* Report Sections */
.report-section {
    margin-bottom: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.report-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.report-section-header h4 {
    margin: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-section-header .section-icon {
    font-size: 16px;
}

.report-section-header .section-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.report-section-header .section-badge.critical {
    background: var(--accent-red)22;
    color: var(--accent-red);
}

.report-section-header .section-badge.warning {
    background: var(--accent-orange)22;
    color: var(--accent-orange);
}

.report-section-header .section-badge.info {
    background: var(--accent-blue)22;
    color: var(--accent-blue);
}

.report-section-header .section-badge.success {
    background: var(--accent-green)22;
    color: var(--accent-green);
}

.report-section-content {
    padding: 16px;
}

/* Executive Summary */
.executive-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    text-align: center;
}

.summary-card .summary-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

.summary-card .summary-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.summary-card.critical .summary-value { color: var(--accent-red); }
.summary-card.warning .summary-value { color: var(--accent-orange); }
.summary-card.info .summary-value { color: var(--accent-blue); }
.summary-card.success .summary-value { color: var(--accent-green); }

/* Findings List */
.findings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.finding-item {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-color);
}

.finding-item.critical { border-left-color: var(--accent-red); }
.finding-item.warning { border-left-color: var(--accent-orange); }
.finding-item.info { border-left-color: var(--accent-blue); }

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

.finding-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 13px;
}

.finding-severity {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 500;
}

.finding-severity.critical { background: var(--accent-red)22; color: var(--accent-red); }
.finding-severity.warning { background: var(--accent-orange)22; color: var(--accent-orange); }
.finding-severity.info { background: var(--accent-blue)22; color: var(--accent-blue); }

.finding-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.finding-details {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Data Profile */
.data-profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.profile-card {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.profile-card h5 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.profile-card .profile-value {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
}

.profile-card .profile-detail {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Recommendations */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recommendation-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.recommendation-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.recommendation-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Export Report Button */
.report-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Export options */
.export-options {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Method info cards */
.method-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.method-card {
    padding: 12px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition);
    opacity: 0.6;
}

.method-card:hover {
    border-color: var(--border-light);
    opacity: 0.9;
}

.method-card h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 6px;
}

.method-card p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Progress indicators */
.progress-container {
    margin: 16px 0;
}

.progress-bar {
    height: 4px;
    background-color: var(--bg-hover);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-green));
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 13px;
    max-width: 300px;
    margin: 0 auto;
}

/* Column type badges */
.type-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.type-badge.numeric {
    background-color: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
}

.type-badge.text {
    background-color: rgba(63, 185, 80, 0.15);
    color: var(--accent-green);
}

.type-badge.temporal {
    background-color: rgba(210, 153, 34, 0.15);
    color: var(--accent-yellow);
}

.type-badge.boolean {
    background-color: rgba(163, 113, 247, 0.15);
    color: var(--accent-purple);
}

/* Keyboard shortcuts hint */
.shortcuts-hint {
    position: fixed;
    bottom: 40px;
    left: 20px;
    font-size: 11px;
    color: var(--text-muted);
    background-color: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.shortcuts-hint kbd {
    padding: 2px 6px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-family: inherit;
    font-size: 10px;
}

/* Dark scrollbar for CodeMirror */
.CodeMirror-vscrollbar,
.CodeMirror-hscrollbar {
    background: var(--bg-secondary) !important;
}

.CodeMirror-vscrollbar::-webkit-scrollbar,
.CodeMirror-hscrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.CodeMirror-vscrollbar::-webkit-scrollbar-thumb,
.CodeMirror-hscrollbar::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .analytics-controls,
    .anomaly-controls,
    .viz-controls {
        flex-direction: column;
    }

    .control-group select,
    .control-group input {
        width: 100%;
    }
}

/* Disclaimer Footer */
.disclaimer-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 8px 16px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.disclaimer-footer .separator {
    color: var(--border-light);
    margin: 0 8px;
}

@media (max-width: 768px) {
    .disclaimer-footer {
        font-size: 10px;
        padding: 6px 12px;
    }

    .disclaimer-footer .separator {
        margin: 0 4px;
    }
}

/* Info Icon and Tooltip */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    font-style: normal;
    text-transform: lowercase;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
    transition: all var(--transition);
    border: 1px solid var(--border-color);
}

.info-icon:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.info-tooltip {
    position: fixed;
    max-width: 300px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-primary);
    z-index: 4000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.info-tooltip.visible {
    opacity: 1;
}

.info-tooltip strong {
    color: var(--accent-primary);
    display: block;
    margin-bottom: 4px;
}

.control-group label {
    display: flex;
    align-items: center;
}

/* Sub-tabs for Anomaly Detection */
.sub-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.sub-tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition);
}

.sub-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.sub-tab.active {
    color: var(--accent-primary);
    border-color: var(--border-color);
    border-bottom-color: var(--bg-primary);
    background: var(--bg-primary);
}

.sub-panel {
    display: none;
}

.sub-panel.active {
    display: block;
}

/* Unified Analysis Controls */
.analysis-controls {
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.analysis-controls-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.analysis-controls-row .control-group {
    flex: 1;
    min-width: 120px;
}

.analysis-controls-row .control-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.analysis-controls-row select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
}

.analysis-controls-row .btn-large {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.analysis-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.analysis-type-info {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-icon-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    font-size: 10px;
    color: var(--text-secondary);
}

.analysis-progress {
    margin: 16px 0;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.analysis-progress .progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.analysis-progress .progress-fill {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.3s ease;
}

.analysis-progress .progress-status {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Unified Report Styles */
.unified-report {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.report-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.summary-card {
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
}

.summary-card .card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.summary-card .card-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
}

.summary-card.alert .card-value {
    color: var(--accent-red);
}

.summary-card.critical .card-value {
    color: var(--accent-red);
}

.summary-card.warning .card-value {
    color: var(--accent-orange);
}

.report-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.report-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.report-section .section-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.report-section.collapsible .section-header {
    cursor: pointer;
}

.report-section.collapsible .collapse-icon {
    transition: transform 0.2s;
    color: var(--text-muted);
}

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

.report-section.collapsible.collapsed .section-content {
    display: none;
}

.report-section .section-content {
    padding: 16px;
}

.findings-list {
    padding: 12px;
}

.finding-card {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--border-color);
}

.finding-card.high {
    border-left-color: var(--accent-red);
}

.finding-card.medium {
    border-left-color: var(--accent-orange);
}

.finding-card.low {
    border-left-color: var(--accent-primary);
}

.finding-card .finding-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.finding-badge {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.finding-badge.high {
    background: var(--accent-red)22;
    color: var(--accent-red);
}

.finding-badge.medium {
    background: var(--accent-orange)22;
    color: var(--accent-orange);
}

.finding-badge.low {
    background: var(--accent-primary)22;
    color: var(--accent-primary);
}

.finding-badge.info {
    background: var(--text-muted)22;
    color: var(--text-muted);
}

.finding-type {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.finding-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.finding-count {
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: auto;
}

.finding-body {
    font-size: 12px;
    color: var(--text-secondary);
}

.finding-body p {
    margin: 0 0 8px 0;
}

/* Rule Results in Unified Report */
.rule-results-list {
    padding: 12px;
}

.rule-result-card {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--border-color);
}

.rule-result-card.has-anomalies {
    border-left-color: var(--accent-yellow);
}

.rule-result-card.error {
    border-left-color: var(--accent-red);
}

.rule-result-card.clean {
    opacity: 0.7;
}

.rule-result-card.skipped {
    opacity: 0.5;
}

.rule-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.rule-result-header .rule-name {
    font-weight: 500;
    color: var(--text-primary);
}

.rule-result-header .rule-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.rule-result-header .rule-status.clean {
    background: var(--accent-green)22;
    color: var(--accent-green);
}

.rule-result-header .rule-status.skipped {
    background: var(--bg-primary);
    color: var(--text-muted);
}

.rule-result-header .rule-status.error {
    background: var(--accent-red)22;
    color: var(--accent-red);
}

.rule-result-details {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.rule-result-details .method-tag {
    padding: 2px 8px;
    background: var(--accent-primary)22;
    color: var(--accent-primary);
    border-radius: var(--radius-sm);
}

.anomaly-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.anomaly-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.anomaly-group .group-pattern {
    color: var(--text-primary);
}

.anomaly-group .group-count {
    color: var(--text-muted);
    font-size: 11px;
}

/* Export Section */
.export-section {
    padding: 16px;
}

.export-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Report Tabs */
.report-tabs {
    display: flex;
    gap: 4px;
    padding: 0 16px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-color);
}

.report-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition);
}

.report-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.report-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.report-tab-content {
    display: none;
}

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

/* Aggregated Records Table */
.aggregated-records-container {
    overflow-x: auto;
    padding: 12px;
}

.aggregated-records-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.aggregated-records-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

.aggregated-records-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.aggregated-records-table .record-row {
    transition: background var(--transition);
}

.aggregated-records-table .record-row:hover {
    background: var(--bg-tertiary);
}

.aggregated-records-table .record-row.severity-critical {
    border-left: 3px solid var(--accent-red);
}

.aggregated-records-table .record-row.severity-warning {
    border-left: 3px solid var(--accent-yellow);
}

.aggregated-records-table .record-row.severity-info {
    border-left: 3px solid var(--accent-primary);
}

.aggregated-records-table .col-rank {
    width: 40px;
    text-align: center;
    color: var(--text-muted);
    font-weight: 600;
}

.aggregated-records-table .col-score {
    width: 120px;
}

.aggregated-records-table .col-methods {
    width: 180px;
}

.aggregated-records-table .col-severity {
    width: 100px;
}

.aggregated-records-table .col-actions {
    width: 60px;
    text-align: center;
}

/* Score Bar */
.score-bar-container {
    position: relative;
    height: 22px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.score-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    min-width: 2px;
    opacity: 0.6;
    transition: width 0.3s ease;
}

.score-value {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 8px;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary);
}

/* Method Count Badge */
.method-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--bg-tertiary);
    border-radius: 11px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 8px;
}

.method-count.multi {
    background: var(--accent-yellow)33;
    color: var(--accent-yellow);
}

.method-names {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Data Preview */
.col-data {
    max-width: 300px;
}

.data-field {
    display: inline-block;
    margin-right: 10px;
    font-size: 12px;
}

.data-field .field-name {
    color: var(--text-muted);
}

/* Record Details Row */
.record-details-row td {
    padding: 0;
    background: var(--bg-tertiary);
}

.record-details-panel {
    padding: 16px 20px;
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.record-details-panel .details-section {
    flex: 1;
    min-width: 250px;
}

.record-details-panel h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.contributions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.contribution-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.contribution-item .contrib-method {
    font-weight: 500;
    color: var(--text-primary);
}

.contribution-item .contrib-score {
    font-size: 11px;
    color: var(--text-muted);
}

.full-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.data-item {
    display: flex;
    flex-direction: column;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.data-item .data-key {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.data-item .data-value {
    color: var(--text-primary);
    word-break: break-all;
}

.records-limit-note {
    text-align: center;
    padding: 12px;
    color: var(--text-muted);
    font-size: 12px;
}

.section-hint {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 12px;
}

/* Scan Controls (legacy) */
.scan-controls {
    margin-bottom: 16px;
}

.scan-controls-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.scan-controls-row .control-group {
    flex: 1;
    min-width: 150px;
}

.scan-controls-row .btn-large {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    min-width: 120px;
    height: fit-content;
}

.enabled-rules-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.enabled-rules-summary .rules-count {
    color: var(--text-secondary);
}

.enabled-rules-summary a {
    color: var(--accent-primary);
    text-decoration: none;
}

.enabled-rules-summary a:hover {
    text-decoration: underline;
}

/* Scan Results */
.scan-rule-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.scan-rule-result {
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.scan-rule-result.has-anomalies {
    border-left: 3px solid var(--accent-yellow);
}

.scan-rule-result.error {
    border-left: 3px solid var(--accent-red);
}

.scan-rule-result.clean {
    opacity: 0.7;
}

.scan-rule-result.skipped {
    opacity: 0.5;
}

.scan-rule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.scan-rule-header .rule-name {
    font-weight: 500;
    color: var(--text-primary);
}

.scan-rule-header .rule-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.scan-rule-header .rule-status.clean {
    background: var(--accent-green)22;
    color: var(--accent-green);
}

.scan-rule-header .rule-status.skipped {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.scan-rule-header .rule-status.error {
    background: var(--accent-red)22;
    color: var(--accent-red);
}

.scan-rule-error {
    margin-top: 8px;
    font-size: 12px;
    color: var(--accent-red);
}

.scan-rule-details {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.scan-rule-details .method-tag {
    padding: 2px 6px;
    background: var(--accent-primary)22;
    color: var(--accent-primary);
    border-radius: var(--radius-sm);
}

.scan-anomaly-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.scan-anomaly-group {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.scan-anomaly-group .group-pattern {
    color: var(--text-primary);
}

.scan-anomaly-group .group-count {
    color: var(--text-muted);
    font-size: 11px;
}

.more-groups {
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Records Display */
.scan-records-panel,
.finding-records-panel {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.records-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.records-header h4 {
    margin: 0;
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
}

.records-header .record-count {
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.records-scroll {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.records-table th {
    text-align: left;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.records-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.records-table tr:hover td {
    background: var(--bg-hover);
}

.records-table .anomaly-row {
    cursor: pointer;
}

.records-table .score-cell {
    font-family: var(--font-mono);
    color: var(--accent-orange);
    font-weight: 500;
}

.records-table .triggered-by-cell {
    font-size: 11px;
    color: var(--accent-primary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.records-table .methods-cell {
    font-size: 11px;
    color: var(--text-secondary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.records-table .methods-cell .method-count {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    background: var(--bg-tertiary);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 600;
    margin-right: 4px;
}

.records-table .methods-cell .method-count.multi {
    background: var(--accent-primary);
    color: white;
}

.records-table .null-value {
    color: var(--text-muted);
    font-style: italic;
}

.records-table .more-cols,
.records-table .more-rows {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.no-records {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

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

.pagination-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    font-weight: 600;
}

.pagination-prev,
.pagination-next {
    padding: 6px 10px;
}

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 4px;
}

.pagination-info {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 12px;
}

.view-records-btn {
    margin-left: auto;
}

.scan-anomaly-group .group-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--accent-secondary);
}

.finding-records-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}

.export-records-btn {
    font-size: 11px;
    padding: 4px 8px;
}

/* Rules Manager */
.rules-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.rules-toolbar-left,
.rules-toolbar-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

.rule-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition);
}

.rule-card:hover {
    border-color: var(--border-light);
}

.rule-card.disabled {
    opacity: 0.6;
}

.rule-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 12px;
}

.rule-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.rule-toggle {
    width: 40px;
    height: 22px;
    background: var(--bg-tertiary);
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
}

.rule-toggle.enabled {
    background: var(--accent-green);
}

.rule-toggle::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform var(--transition);
}

.rule-toggle.enabled::after {
    transform: translateX(18px);
}

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

.rule-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rule-description {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rule-severity {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.rule-severity.info {
    background: var(--accent-primary)22;
    color: var(--accent-primary);
}

.rule-severity.warning {
    background: var(--accent-yellow)22;
    color: var(--accent-yellow);
}

.rule-severity.critical {
    background: var(--accent-red)22;
    color: var(--accent-red);
}

.rule-card-actions {
    display: flex;
    gap: 4px;
}

.rule-card-actions .btn {
    padding: 4px 8px;
    font-size: 11px;
}

.rule-meta {
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

.rule-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Rule Editor Modal */
.rule-editor {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rule-editor .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rule-editor label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.rule-editor input[type="text"],
.rule-editor textarea,
.rule-editor select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
}

.rule-editor textarea {
    min-height: 60px;
    resize: vertical;
}

.rule-editor .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.rule-editor .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rule-editor .checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
}

.rule-editor .checkbox-item:hover {
    background: var(--bg-hover);
}

.rule-editor .checkbox-item input {
    margin: 0;
}

/* Rules Results */
.rules-results {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.rules-results h4 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.rule-result-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-color);
}

.rule-result-item.has-anomalies {
    border-left-color: var(--accent-red);
}

.rule-result-item.no-anomalies {
    border-left-color: var(--accent-green);
}

.rule-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.rule-result-name {
    font-weight: 600;
}

.rule-result-count {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
}

.rule-result-count.has-anomalies {
    background: var(--accent-red)22;
    color: var(--accent-red);
}

.rule-result-count.no-anomalies {
    background: var(--accent-green)22;
    color: var(--accent-green);
}

/* Hidden file input for import */
#rulesFileInput {
    display: none;
}

/* ==================== Heuristic Report Styles ==================== */

.report-section h3 {
    margin: 0;
    padding: 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    padding: 16px;
}

.summary-stat {
    text-align: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.summary-stat .stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-stat .stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.summary-stat.alert .stat-value {
    color: var(--accent-red);
}

.summary-stat.warning .stat-value {
    color: var(--accent-orange);
}

/* Profile Cards */
.profile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.profile-card-header .col-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.profile-card-header .col-type {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 500;
}

.col-type.numeric {
    background: var(--accent-primary)22;
    color: var(--accent-primary);
}

.col-type.timestamp {
    background: var(--accent-yellow)22;
    color: var(--accent-yellow);
}

.col-type.categorical {
    background: var(--accent-purple)22;
    color: var(--accent-purple);
}

.col-type.text {
    background: var(--accent-green)22;
    color: var(--accent-green);
}

.col-type.ip_address {
    background: var(--accent-orange)22;
    color: var(--accent-orange);
}

.col-type.boolean {
    background: var(--accent-teal)22;
    color: var(--accent-teal);
}

.col-type.unknown {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.profile-card-body {
    font-size: 12px;
}

.profile-stat {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

.profile-stat:last-child {
    border-bottom: none;
}

.profile-stat span:first-child {
    color: var(--text-secondary);
}

.profile-stat span:last-child {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.profile-stat.top-values {
    flex-direction: column;
    gap: 4px;
}

.profile-stat.top-values span:last-child {
    font-size: 11px;
    word-break: break-word;
}

/* Finding Cards */
.finding-card {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--border-color);
}

.finding-card.high {
    border-left-color: var(--accent-red);
}

.finding-card.medium {
    border-left-color: var(--accent-orange);
}

.finding-card.low {
    border-left-color: var(--accent-primary);
}

.finding-card.info {
    border-left-color: var(--text-muted);
}

.finding-card .finding-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.finding-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.finding-badge.high {
    background: var(--accent-red)22;
    color: var(--accent-red);
}

.finding-badge.medium {
    background: var(--accent-orange)22;
    color: var(--accent-orange);
}

.finding-badge.low {
    background: var(--accent-primary)22;
    color: var(--accent-primary);
}

.finding-badge.info {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.finding-card .finding-type {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.finding-card .finding-title {
    font-weight: 600;
    color: var(--text-primary);
}

.finding-card .finding-body {
    font-size: 12px;
    color: var(--text-secondary);
}

.finding-card .finding-body p {
    margin: 0 0 8px 0;
}

.finding-card .finding-body details {
    margin-top: 8px;
}

.finding-card .finding-body details summary {
    cursor: pointer;
    color: var(--accent-primary);
    font-size: 11px;
}

.finding-card .finding-body details pre {
    margin: 8px 0 0 0;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 10px;
    overflow-x: auto;
    max-height: 150px;
}

.no-findings {
    text-align: center;
    padding: 24px;
    color: var(--accent-green);
    font-size: 14px;
}

/* Recommendation Cards */
.recommendation-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    align-items: flex-start;
}

.recommendation-card .rec-priority {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.recommendation-card.high .rec-priority {
    background: var(--accent-red)22;
    color: var(--accent-red);
}

.recommendation-card.medium .rec-priority {
    background: var(--accent-orange)22;
    color: var(--accent-orange);
}

.recommendation-card.low .rec-priority {
    background: var(--accent-primary)22;
    color: var(--accent-primary);
}

.recommendation-card .rec-content {
    flex: 1;
}

.recommendation-card .rec-content strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
    font-size: 13px;
}

.recommendation-card .rec-content p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Export Section */
.export-section {
    text-align: center;
}

.export-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    flex-wrap: wrap;
}

/* Analysis Button Group */
.analysis-btn-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Sensitivity Control */
.analysis-sensitivity-group {
    min-width: 140px;
}

.sensitivity-control {
    display: flex;
    gap: 6px;
    align-items: center;
}

.sensitivity-control input[type="range"] {
    flex: 1;
    min-width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 2px;
    cursor: pointer;
}

.sensitivity-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.sensitivity-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.sensitivity-control input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
}

.sensitivity-preview {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.sensitivity-preview .preview-count {
    color: var(--accent-primary);
    font-weight: 500;
}

.sensitivity-preview.loading .preview-count::after {
    content: "...";
    animation: ellipsis 1s infinite;
}

@keyframes ellipsis {
    0% { content: "."; }
    33% { content: ".."; }
    66% { content: "..."; }
}

/* Cancel button styling */
#cancelAnalysisBtn {
    background: var(--accent-red)22;
    color: var(--accent-red);
    border-color: var(--accent-red)44;
}

#cancelAnalysisBtn:hover {
    background: var(--accent-red)33;
}

/* Clickable record rows */
.clickable-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.clickable-row:hover {
    background-color: var(--bg-tertiary);
}

.clickable-row:hover td {
    color: var(--accent-primary);
}

.view-full-btn {
    padding: 2px 8px;
    font-size: 11px;
    color: var(--accent-primary);
    background: transparent;
    border: 1px solid var(--accent-primary)44;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.view-full-btn:hover {
    background: var(--accent-primary)22;
    border-color: var(--accent-primary);
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--accent-secondary);
}

/* Data Profile Grid in Report */
.data-profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    padding: 16px;
}

.findings-list,
.recommendations-list {
    padding: 16px;
}

/* Column Selection UI - Two Panel Design */
.column-selector-panels {
    display: flex;
    gap: 8px;
    min-height: 180px;
}

.column-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    overflow: hidden;
}

.column-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.column-panel .panel-header .btn-xs {
    font-size: 10px;
    padding: 2px 6px;
    text-transform: none;
    font-weight: normal;
}

.column-panel .column-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
    min-height: 100px;
}

.column-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    margin: 2px;
    font-size: 11px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.available-panel .column-chip {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.available-panel .column-chip:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.available-panel .column-chip.numeric {
    border-left: 3px solid var(--success-color);
}

.available-panel .column-chip.categorical {
    border-left: 3px solid var(--info-color);
}

.available-panel .column-chip.timestamp {
    border-left: 3px solid var(--warning-color);
}

.available-panel .column-chip.text {
    border-left: 3px solid var(--text-tertiary);
}

.selected-panel .column-chip {
    background: var(--accent-color);
    color: white;
}

.selected-panel .column-chip:hover {
    background: var(--error-color);
}

.selected-panel .column-chip::after {
    content: '×';
    font-size: 14px;
    line-height: 1;
    margin-left: 2px;
    opacity: 0.7;
}

.selected-panel .column-chip:hover::after {
    opacity: 1;
}

.column-chip .type-indicator {
    font-size: 9px;
    opacity: 0.7;
}

/* Combined Columns Section in Selected Panel */
.combined-columns-section {
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.combined-columns-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.combined-columns-header .btn-xs {
    font-size: 10px;
    padding: 1px 5px;
    text-transform: none;
    font-weight: normal;
}

.combined-columns-section .column-list {
    max-height: 80px;
    padding: 4px;
}

.combined-column-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    margin: 2px;
    font-size: 11px;
    border-radius: 12px;
    cursor: pointer;
    background: var(--info-color);
    color: white;
    transition: all 0.15s ease;
}

.combined-column-chip:hover {
    background: var(--error-color);
}

.combined-column-chip::after {
    content: '×';
    font-size: 14px;
    line-height: 1;
    margin-left: 2px;
    opacity: 0.7;
}

.combined-column-chip:hover::after {
    opacity: 1;
}

/* Legacy styles kept for compatibility */
.column-select-buttons {
    display: none;
}

.selected-columns-count {
    display: none;
}

#anomalyColumns {
    display: none;
}

/* Combined Columns UI */
.analysis-combined-columns-group {
    display: none;
}

.combined-columns-list {
    margin-bottom: 0;
}

.combined-column-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin-bottom: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.combined-column-item .combined-name {
    font-weight: 600;
    color: var(--accent-primary);
    min-width: 80px;
}

.combined-column-item .combined-formula {
    flex: 1;
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.combined-column-item .combined-separator {
    color: var(--text-muted);
    font-size: 10px;
}

.combined-column-item .btn-remove {
    padding: 2px 6px;
    font-size: 10px;
    color: var(--accent-red);
    background: transparent;
    border: 1px solid var(--accent-red);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.combined-column-item .btn-remove:hover {
    background: var(--accent-red);
    color: white;
}

/* Combined Column Modal */
.combined-column-modal .column-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.combined-column-modal .column-picker-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.combined-column-modal .column-picker-row select {
    flex: 1;
    padding: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
}

.combined-column-modal .column-picker-row .btn-add-field,
.combined-column-modal .column-picker-row .btn-remove-field {
    padding: 4px 10px;
    font-size: 14px;
}

.combined-column-modal .separator-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.combined-column-modal .separator-input label {
    font-size: 12px;
    color: var(--text-secondary);
}

.combined-column-modal .separator-input input {
    width: 80px;
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 13px;
}

.combined-column-modal .preview-area {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 12px;
}

.combined-column-modal .preview-area .preview-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.combined-column-modal .preview-area .preview-value {
    color: var(--accent-primary);
    word-break: break-all;
}

/* Rules Manager hint */
.rules-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 8px 0;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-primary);
}

/* Help Modal */
.help-modal {
    max-width: 600px;
    width: 90vw;
}

.help-modal .modal-body {
    padding: 20px;
}

.help-section {
    margin-bottom: 20px;
}

.help-section:last-of-type {
    margin-bottom: 12px;
}

.help-section h4 {
    color: var(--accent-primary);
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.help-steps {
    margin: 0;
    padding-left: 20px;
}

.help-steps li {
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.help-steps li strong {
    color: var(--text-primary);
}

.help-steps li em {
    color: var(--accent-primary);
    font-style: normal;
}

.help-list {
    margin: 0;
    padding-left: 20px;
    list-style: disc;
}

.help-list li {
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.help-list li strong {
    color: var(--text-primary);
}

.help-modal kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-primary);
}

.help-dont-show {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 12px;
}

.help-dont-show input {
    cursor: pointer;
}

.help-modal .modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Help link in footer */
.disclaimer-footer .help-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: inherit;
}

.disclaimer-footer .help-link:hover {
    text-decoration: underline;
}
