/* DataViewer Workspace Styles
   Dark theme matching main site: #0a0f1a bg, #06d6a0 accent
   Typography: System fonts (sans-serif + monospace)
*/

/* ============================================
   VARIABLES
   ============================================ */
:root {
    --color-bg-primary: #0a0f1a;
    --color-bg-secondary: #111827;
    --color-bg-tertiary: #1f2937;
    --color-bg-card: #162032;
    --color-bg-hover: #1e3a5f;

    --color-accent: #06d6a0;
    --color-accent-hover: #00f5b8;
    --color-accent-subtle: rgba(6, 214, 160, 0.1);
    --color-accent-glow: rgba(6, 214, 160, 0.3);

    --color-secondary: #118ab2;
    --color-tertiary: #ef476f;
    --color-warning: #ffd166;

    --color-text-primary: #f8fafc;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    --color-text-inverse: #0a0f1a;

    --color-border: #2d3748;
    --color-border-hover: #4a5568;

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, 'Cascadia Code', 'Fira Code', Consolas, 'Liberation Mono', monospace;

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 30px var(--color-accent-glow);

    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-sans);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--color-accent);
    color: var(--color-text-inverse);
}
.btn-primary:hover { background: var(--color-accent-hover); box-shadow: var(--shadow-glow); }

.btn-secondary {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover { border-color: var(--color-accent); color: var(--color-accent); }

.btn-accent {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    border: 1px solid rgba(6, 214, 160, 0.2);
}
.btn-accent:hover { background: rgba(6, 214, 160, 0.2); border-color: var(--color-accent); }

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

.btn-google {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    justify-content: center;
}
.btn-google:hover { border-color: var(--color-border-hover); background: var(--color-bg-hover); color: var(--color-text-primary); }
.btn-google:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

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

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 0.375rem;
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    transition: border-color var(--transition-fast);
}
.form-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
}
.form-input::placeholder { color: var(--color-text-muted); }
.form-input-sm { padding: 0.375rem 0.625rem; font-size: 0.8125rem; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.alert-error {
    background: rgba(239, 71, 111, 0.1);
    color: var(--color-tertiary);
    border: 1px solid rgba(239, 71, 111, 0.2);
}
.alert-success {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    border: 1px solid rgba(6, 214, 160, 0.2);
}

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    text-decoration: none;
}
.auth-logo .logo-icon { font-size: 2rem; }
.auth-logo .logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.auth-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    text-align: left;
}

.auth-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
}

.auth-subtitle {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.auth-form { margin-bottom: 0; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.auth-footer {
    margin-top: 1.5rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}
.auth-footer .dot { margin: 0 0.375rem; }

/* Email sent state */
.email-sent { text-align: center; padding: 1rem 0; }
.email-sent-icon { font-size: 3rem; margin-bottom: 1rem; }
.email-sent h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.email-sent p { color: var(--color-text-secondary); font-size: 0.9375rem; }

/* ============================================
   WORKSPACE HEADER
   ============================================ */
.ws-header {
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    padding: 0 1.5rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.ws-header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    gap: 2rem;
}

.ws-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    flex-shrink: 0;
}
.ws-logo .logo-icon { font-size: 1.375rem; height: 90px; }
.ws-logo .logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.ws-nav {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}

.ws-nav-link {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.ws-nav-link:hover { color: var(--color-text-primary); background: var(--color-bg-tertiary); }
.ws-nav-link.active { color: var(--color-accent); background: var(--color-accent-subtle); }

.ws-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.ws-user-email {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* ============================================
   WORKSPACE MAIN
   ============================================ */
.ws-main { padding: 2rem 1.5rem; }

.ws-container {
    max-width: 1200px;
    margin: 0 auto;
}

.ws-welcome h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.ws-section {
    margin-top: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
}
.stat-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--color-accent); }
.stat-label { font-size: 0.8125rem; color: var(--color-text-muted); margin-top: 0.25rem; }

/* ============================================
   DATA SOURCES GRID
   ============================================ */
.data-sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.data-source-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--color-text-primary);
    font-family: inherit;
    font-size: inherit;
}
.data-source-card:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-subtle);
}
.data-source-icon { font-size: 1.5rem; }
.data-source-label { font-weight: 600; font-size: 0.9375rem; }
.data-source-desc { font-size: 0.75rem; color: var(--color-text-muted); line-height: 1.3; }

.dash-sources-divider {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    margin: 1.25rem 0;
    position: relative;
}
.dash-sources-divider::before,
.dash-sources-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 90px);
    height: 1px;
    background: var(--color-border);
}
.dash-sources-divider::before { left: 0; }
.dash-sources-divider::after { right: 0; }

/* ============================================
   UPLOAD ZONE
   ============================================ */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--color-accent);
    background: var(--color-accent-subtle);
}

.upload-zone-disabled {
    opacity: 0.6;
    cursor: default;
    border-style: dashed;
}
.upload-zone-disabled:hover {
    border-color: var(--color-border);
    background: none;
}
.upload-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.upload-text { font-size: 0.9375rem; color: var(--color-text-secondary); }
.upload-browse { color: var(--color-accent); cursor: pointer; font-weight: 600; }
.upload-hint { font-size: 0.8125rem; color: var(--color-text-muted); margin-top: 0.5rem; }

.upload-progress { padding: 1rem 0; }
.progress-bar {
    height: 6px;
    background: var(--color-bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}
.progress-text {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 0.5rem;
}

/* ============================================
   FILES TABLE
   ============================================ */
.files-table-wrap { overflow-x: auto; }

.files-table {
    width: 100%;
    border-collapse: collapse;
}
.files-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
}
.files-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid rgba(45, 55, 72, 0.5);
    font-size: 0.875rem;
}
.files-table tr:hover td {
    background: var(--color-bg-secondary);
}

.file-link {
    font-weight: 500;
    color: var(--color-text-primary);
}
.file-link:hover { color: var(--color-accent); }

.file-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.action-btns { display: flex; gap: 0.375rem; }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-type {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-secondary);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }

/* ============================================
   VIEWER PAGE
   ============================================ */
.viewer-page { padding: 0; }

.viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    gap: 1rem;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.viewer-filename {
    font-size: 1rem;
    font-weight: 600;
}

.viewer-meta {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.toolbar-right {
    display: flex;
    gap: 0.375rem;
}

/* Viewer Layout */
.viewer-layout {
    display: flex;
    height: calc(100vh - 56px - 49px); /* header + toolbar */
}

.viewer-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    padding: 1rem;
}

.sidebar-panel { margin-bottom: 1.5rem; }

.panel-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.viewer-content {
    flex: 1;
    overflow: auto;
    padding: 1rem;
}

/* Data Table Container */
.viewer-table-container { margin-bottom: 1rem; }

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.pagination-btns { display: flex; gap: 0.375rem; }

/* Column List */
.column-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    cursor: pointer;
}
.column-toggle input { accent-color: var(--color-accent); }

/* Filter Rows */
.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.filter-list { margin-bottom: 0.75rem; }

/* Saved Views */
.saved-view-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0;
    border-bottom: 1px solid rgba(45, 55, 72, 0.3);
}
.saved-view-name { font-size: 0.8125rem; }
.saved-view-actions { display: flex; gap: 0.25rem; }

/* ============================================
   VIEWER PANELS
   ============================================ */
.viewer-panel {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.panel-header h2 { font-size: 1rem; font-weight: 600; }
.panel-close { font-size: 1.25rem; }

/* Profile Panel */
.profile-summary {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.profile-stat { font-size: 0.9375rem; color: var(--color-text-secondary); }
.profile-stat strong { color: var(--color-accent); }

.profile-columns {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.profile-column {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.profile-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.profile-col-header h4 { font-size: 0.875rem; font-weight: 600; }

.profile-col-stats { font-size: 0.8125rem; }

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    color: var(--color-text-secondary);
}
.stat-row.sub { padding-left: 0.75rem; font-size: 0.75rem; }

/* Nulls & Duplicates Panel */
.nd-summary-cards {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.nd-card {
    flex: 1;
    min-width: 160px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
}
.nd-card-warn { border-color: #f59e0b; }
.nd-card-ok { border-color: #10b981; }
.nd-card-info { border-color: var(--color-accent); }
.nd-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.nd-card-warn .nd-card-value { color: #f59e0b; }
.nd-card-ok .nd-card-value { color: #10b981; }
.nd-card-info .nd-card-value { color: var(--color-accent); }
.nd-card-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}
.nd-card-sub {
    font-size: 0.75rem;
    color: var(--color-text-muted, #64748b);
    margin-top: 0.25rem;
}

.nd-section {
    margin-bottom: 1.5rem;
}
.nd-section-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.nd-ok-msg {
    color: #10b981;
    font-size: 0.875rem;
    padding: 0.75rem;
    background: rgba(16, 185, 129, 0.08);
    border-radius: var(--radius-md);
}

.nd-null-table table,
.nd-dup-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.nd-null-table th,
.nd-dup-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: var(--color-bg-primary);
    border-bottom: 2px solid var(--color-border);
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.nd-null-table td,
.nd-dup-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
}
.nd-row-has-nulls td {
    color: #fbbf24;
}
.nd-col-name {
    font-weight: 600;
}

.nd-bar-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 180px;
}
.nd-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}
.nd-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}
.nd-bar-low { background: #10b981; }
.nd-bar-med { background: #f59e0b; }
.nd-bar-high { background: #ef4444; }
.nd-bar-label {
    font-size: 0.6875rem;
    color: var(--color-text-muted, #64748b);
    white-space: nowrap;
}

.nd-dup-summary {
    font-size: 0.875rem;
    color: #fbbf24;
    margin-bottom: 0.75rem;
}
.nd-dup-table {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.nd-highlight-btn {
    margin-top: 0.5rem;
}

.nd-dup-highlight {
    background-color: rgba(245, 158, 11, 0.15) !important;
    border-left: 3px solid #f59e0b !important;
}

/* Chart Panel */
.chart-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.chart-container {
    position: relative;
    height: 400px;
}

/* Export Panel */
.export-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.export-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
}
.export-option:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-subtle);
}
.export-icon { font-size: 1.5rem; }
.export-name { font-weight: 600; font-size: 0.9375rem; color: var(--color-text-primary); }
.export-desc { font-size: 0.75rem; color: var(--color-text-muted); text-align: center; }

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.modal-content h3 { font-size: 1.125rem; margin-bottom: 1rem; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* ============================================
   LOADING
   ============================================ */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted);
}

/* ============================================
   UTILITIES
   ============================================ */
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }

/* ============================================
   TABULATOR OVERRIDES (midnight theme tweaks)
   ============================================ */
.tabulator {
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-md) !important;
    font-size: 0.8125rem !important;
}

.tabulator .tabulator-header {
    background: var(--color-bg-tertiary) !important;
    border-bottom: 1px solid var(--color-border) !important;
}

.tabulator .tabulator-header .tabulator-col {
    background: var(--color-bg-tertiary) !important;
    border-right: 1px solid var(--color-border) !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
    border-bottom: 1px solid rgba(45, 55, 72, 0.3) !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row:hover {
    background: var(--color-bg-hover) !important;
}

/* ============================================
   COLOR PICKER PANEL
   ============================================ */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    padding: 1rem 0;
}

.color-picker-group {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.875rem;
}

.color-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

.color-picker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

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

.color-label {
    font-size: 0.8125rem;
    color: var(--color-text-primary);
}

.color-input {
    -webkit-appearance: none;
    appearance: none;
    width: 36px;
    height: 28px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    padding: 0;
    transition: border-color var(--transition-fast);
}

.color-input:hover {
    border-color: var(--color-accent);
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-input::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.color-input::-moz-color-swatch {
    border: none;
    border-radius: 2px;
}

.color-picker-actions {
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 0.5rem;
}

/* Dynamic table colors applied via CSS custom properties on #data-table-container */
#data-table-container[style] .tabulator .tabulator-header {
    background: var(--table-header-bg, var(--color-bg-tertiary)) !important;
}

#data-table-container[style] .tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
    color: var(--table-header-text, var(--color-text-primary)) !important;
}

#data-table-container[style] .tabulator .tabulator-header .tabulator-col .tabulator-header-filter input {
    color: var(--table-header-text, var(--color-text-primary)) !important;
}

#data-table-container[style] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
    background: var(--table-row-bg, var(--color-bg-secondary)) !important;
}

#data-table-container[style] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
    color: var(--table-row-text, var(--color-text-primary)) !important;
}

#data-table-container[style] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row:hover {
    background: var(--table-row-hover, var(--color-bg-hover)) !important;
}

#data-table-container[style] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row:nth-child(even) {
    background: var(--table-row-alt, var(--color-bg-card)) !important;
}

#data-table-container[style] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row:nth-child(even):hover {
    background: var(--table-row-hover, var(--color-bg-hover)) !important;
}

#data-table-container[style] .tabulator {
    border-color: var(--table-border, var(--color-border)) !important;
}

#data-table-container[style] .tabulator .tabulator-header .tabulator-col {
    background: var(--table-header-bg, var(--color-bg-tertiary)) !important;
    border-color: var(--table-border, var(--color-border)) !important;
}

#data-table-container[style] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
    border-color: var(--table-border, rgba(45, 55, 72, 0.3)) !important;
}

#data-table-container[style] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
    border-color: var(--table-border, var(--color-border)) !important;
}

/* Column highlight on hover via custom property */
#data-table-container[style] .tabulator .tabulator-header .tabulator-col:hover {
    background: var(--table-col-highlight, var(--color-bg-hover)) !important;
}

/* ============================================
   PRICING PAGE
   ============================================ */
.pricing-header {
    text-align: center;
    margin-bottom: 2.5rem;
}
.pricing-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    max-width: 760px;
    margin: 0 auto;
}

.pricing-grid--three {
    max-width: 1100px;
    grid-template-columns: repeat(3, 1fr);
}

.btn-disabled {
    opacity: 0.6;
    cursor: default;
    pointer-events: none;
}

.pricing-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pricing-card--featured {
    border-color: var(--color-accent);
    box-shadow: 0 0 40px rgba(6, 214, 160, 0.1);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-accent);
    color: var(--color-text-inverse);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 1rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pricing-card-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.pricing-plan-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.pricing-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
}

.pricing-amount {
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-accent);
    line-height: 1;
}

.pricing-currency {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.pricing-period {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    flex: 1;
}

.pricing-feature {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.pricing-feature.highlight {
    color: var(--color-text-primary);
}

.pricing-feature.disabled {
    opacity: 0.5;
}

.feature-check {
    color: var(--color-accent);
    font-weight: 700;
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}

.feature-x {
    color: var(--color-text-muted);
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}

.pricing-trust {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* ============================================
   SUBSCRIPTION STATUS CARD
   ============================================ */
.stat-card--pro {
    border-color: rgba(6, 214, 160, 0.3);
    background: linear-gradient(135deg, var(--color-bg-secondary) 0%, rgba(6, 214, 160, 0.05) 100%);
}

/* ============================================
   PRICING USP SECTION
   ============================================ */
.pricing-usp {
    margin-bottom: 2.5rem;
}

.pricing-usp-heading {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--color-text-primary);
}

.pricing-usp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-width: 760px;
    margin: 0 auto;
}

.pricing-usp-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    transition: border-color 200ms ease, transform 200ms ease;
}

.pricing-usp-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.pricing-usp-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.pricing-usp-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--color-text-primary);
}

.pricing-usp-desc {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    /* -- Header -- */
    .ws-header { padding: 0 1rem; }
    .ws-header-inner { gap: 0.75rem; }
    .ws-user-email { display: none; }
    .ws-nav { gap: 0; }
    .ws-nav-link { padding: 0.375rem 0.5rem; font-size: 0.8125rem; }

    /* -- Dashboard -- */
    .ws-main { padding: 1.25rem 1rem; }
    .ws-welcome h1 { font-size: 1.375rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .upload-zone { padding: 1.5rem 1rem; }
    .upload-icon { font-size: 2rem; }

    /* -- Viewer layout -- */
    .viewer-layout { flex-direction: column; height: auto; min-height: calc(100vh - 56px - 49px); }
    .viewer-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        max-height: 40vh;
        overflow-y: auto;
    }
    .viewer-content { padding: 0.75rem; }

    /* -- Toolbar -- */
    .viewer-toolbar { padding: 0.5rem 1rem; gap: 0.5rem; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .toolbar-right { flex-wrap: wrap; gap: 0.25rem; }
    .toolbar-right .btn-sm { padding: 0.3rem 0.5rem; font-size: 0.75rem; }
    .toolbar-divider { display: none; }
    .viewer-filename { font-size: 0.875rem; }

    /* -- Filter rows -- */
    .filter-row { grid-template-columns: 1fr 1fr; }

    /* -- Panels -- */
    .viewer-panel { padding: 1rem; }
    .panel-header h2 { font-size: 0.9375rem; }
    .profile-columns { grid-template-columns: 1fr; }
    .profile-summary { flex-wrap: wrap; gap: 0.75rem; }
    .chart-container { height: 300px; }
    .ws-chart-container { height: 350px; }
    .ws-map-container { height: 350px; }
    .ws-er-diagram { min-height: 300px; }
    .export-options { grid-template-columns: 1fr 1fr; }
    .embed-controls { flex-direction: column; align-items: stretch; }
    .schema-tables { grid-template-columns: 1fr; }

    /* -- Pivot / ECharts / Map controls -- */
    .pivot-controls { gap: 0.5rem; }
    .pivot-field select { min-width: 120px; }
    .echarts-controls select { max-width: 100%; }
    .map-controls select { max-width: 100%; }

    /* -- Modals -- */
    .modal-content { padding: 1.25rem; margin: 0.75rem; max-width: calc(100vw - 1.5rem); }

    /* -- Auth pages -- */
    .auth-page { padding: 1rem; }
    .auth-container { padding: 0; }
    .auth-card { padding: 1.5rem; }

    /* -- Pricing page -- */
    .pricing-grid { grid-template-columns: 1fr; }
    .pricing-grid--three { grid-template-columns: 1fr; }
    .pricing-card { padding: 1.5rem; }
    .pricing-trust { flex-direction: column; align-items: center; gap: 0.75rem; }
    .pricing-usp-grid { grid-template-columns: repeat(2, 1fr); }

    /* -- Admin layout -- */
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; }
    .admin-table-header { flex-direction: column; align-items: flex-start; }
    .admin-table-actions { width: 100%; flex-wrap: wrap; }
    .admin-table-actions input { width: 100% !important; }
    .admin-sql-input { flex-direction: column; }

    /* -- Files table -- */
    .files-table { font-size: 0.75rem; }
    .files-table th,
    .files-table td { padding: 0.5rem; }

    /* -- AI Chat sidebar -- */
    .ai-chat-sidebar { width: 100%; right: -100%; }
    .ai-chat-input-area { padding: 0.5rem 0.75rem; }
    .ai-suggestion-chip { font-size: 0.625rem; padding: 0.1875rem 0.5rem; }
}

@media (max-width: 480px) {
    /* -- Header -- */
    .ws-header { padding: 0 0.75rem; }
    .ws-logo .logo-text { font-size: 1rem; }
    .ws-nav-link { padding: 0.25rem 0.375rem; font-size: 0.75rem; }

    /* -- Dashboard -- */
    .ws-main { padding: 1rem 0.75rem; }
    .ws-welcome h1 { font-size: 1.125rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 1rem; }
    .stat-value { font-size: 1.25rem; }
    .upload-zone { padding: 1.25rem 0.75rem; }

    /* -- Viewer toolbar -- */
    .viewer-toolbar { padding: 0.5rem 0.75rem; }
    .toolbar-right .btn-sm { padding: 0.25rem 0.375rem; font-size: 0.6875rem; gap: 0.25rem; }
    .viewer-filename { font-size: 0.8125rem; }
    .viewer-meta { font-size: 0.75rem; }

    /* -- Viewer content -- */
    .viewer-sidebar { padding: 0.75rem; max-height: 35vh; }
    .viewer-content { padding: 0.5rem; }

    /* -- Panels -- */
    .viewer-panel { padding: 0.75rem; margin-bottom: 0.75rem; }
    .chart-container { height: 250px; }
    .ws-chart-container { height: 280px; }
    .ws-map-container { height: 280px; }
    .ws-er-diagram { min-height: 250px; }
    .export-options { grid-template-columns: 1fr; }
    .export-option { padding: 0.875rem; }

    /* -- Pivot -- */
    .pivot-field select { min-width: 100px; width: 100%; }
    .pivot-controls { flex-direction: column; }
    .pivot-styled-table { font-size: 0.75rem; }
    .pivot-styled-table th,
    .pivot-styled-table td { padding: 0.375rem 0.5rem; }

    /* -- Tabulator -- */
    .tabulator { font-size: 0.75rem !important; }

    /* -- Pricing -- */
    .pricing-usp-grid { grid-template-columns: 1fr; }
    .pricing-header h1 { font-size: 1.5rem; }
    .pricing-amount { font-size: 2.25rem; }

    /* -- Table pagination -- */
    .table-pagination { flex-direction: column; gap: 0.5rem; text-align: center; }

    /* -- Filter rows -- */
    .filter-row { grid-template-columns: 1fr; }

    /* -- AI Chat -- */
    .ai-chat-messages { padding: 0.75rem; }
    .ai-chat-msg { max-width: 95%; font-size: 0.75rem; }
    .ai-chat-welcome { font-size: 0.75rem; padding: 0.75rem; }
}

/* ============================================
   ECHARTS PANEL
   ============================================ */
.echarts-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}
.echarts-controls select { max-width: 200px; }

.ws-chart-container {
    width: 100%;
    height: 450px;
}

/* ============================================
   PIVOT TABLE
   ============================================ */
.pivot-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.pivot-field { display: flex; flex-direction: column; gap: 0.25rem; }
.pivot-field select { min-width: 140px; }
.pivot-result { overflow-x: auto; }

.pivot-table-wrap { overflow-x: auto; }

.pivot-styled-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.pivot-styled-table th {
    background: var(--color-bg-tertiary);
    color: var(--color-accent);
    padding: 0.5rem 0.75rem;
    text-align: left;
    border: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pivot-styled-table td {
    padding: 0.375rem 0.75rem;
    border: 1px solid rgba(45, 55, 72, 0.5);
}
.pivot-styled-table tr:hover td { background: var(--color-bg-hover); }
.pivot-row-label { font-weight: 500; color: var(--color-text-primary); }
.pivot-cell { text-align: right; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--color-text-secondary); }

/* ============================================
   MAP PANEL
   ============================================ */
.map-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}
.map-controls select { max-width: 180px; }

.ws-map-container {
    width: 100%;
    height: 450px;
    border-radius: var(--radius-md);
}

#map-container .leaflet-control-attribution { font-size: 0.625rem; }

/* ============================================
   SCHEMA / ER DIAGRAM
   ============================================ */
.schema-tables {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

.schema-table-name {
    background: var(--color-bg-tertiary);
    color: var(--color-accent);
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--color-border);
}

.schema-columns { padding: 0.25rem 0; }

.schema-column {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid rgba(45, 55, 72, 0.2);
}
.schema-column.schema-pk { background: rgba(255, 209, 102, 0.05); }
.schema-col-name { color: var(--color-text-secondary); }
.schema-col-type { color: var(--color-text-muted); font-family: var(--font-mono); font-size: 0.75rem; }
.schema-row-count {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    text-align: right;
}

.ws-er-diagram {
    width: 100%;
    min-height: 400px;
}

/* ============================================
   EMBED PANEL
   ============================================ */
.embed-controls {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}
.embed-controls .form-group { margin-bottom: 0; flex: 1; }

.embed-list { margin-top: 1rem; }

.embed-item {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.embed-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.embed-code-block {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    overflow-x: auto;
    margin-bottom: 0.5rem;
}
.embed-code-block code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-accent);
    word-break: break-all;
}

.embed-item-actions {
    display: flex;
    gap: 0.375rem;
}

/* ============================================
   CONNECTOR PANEL
   ============================================ */
#connectors-panel .btn { margin-right: 0.375rem; margin-bottom: 0.375rem; }

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-container { max-width: 1400px; }

.admin-layout {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
    min-height: 500px;
}

.admin-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

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

.admin-table-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.admin-table-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.625rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    text-align: left;
    transition: all var(--transition-fast);
    width: 100%;
}

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

.admin-table-item.active {
    background: var(--color-accent-subtle);
    color: var(--color-accent);
}

.admin-table-item-name { font-weight: 500; }

.admin-table-item-count {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    background: var(--color-bg-tertiary);
    padding: 0.0625rem 0.375rem;
    border-radius: var(--radius-sm);
}

.admin-table-item.active .admin-table-item-count {
    background: rgba(6, 214, 160, 0.2);
    color: var(--color-accent);
}

.admin-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.admin-table-info h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.admin-table-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-data-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.admin-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

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

.admin-th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

.admin-th:hover { color: var(--color-accent); }

.admin-th-actions {
    width: 40px;
    padding: 0.625rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.admin-col-type {
    display: block;
    font-weight: 400;
    font-size: 0.625rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.admin-pk-icon { font-size: 0.625rem; }

.admin-td, .admin-td-editable {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(45, 55, 72, 0.3);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-secondary);
}

.admin-td-editable {
    cursor: pointer;
    transition: background var(--transition-fast);
}

.admin-td-editable:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.admin-td-actions {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid rgba(45, 55, 72, 0.3);
    text-align: center;
}

.admin-delete-btn {
    color: var(--color-text-muted) !important;
    font-size: 1rem !important;
    padding: 0.125rem 0.375rem !important;
}

.admin-delete-btn:hover {
    color: var(--color-tertiary) !important;
    background: rgba(239, 71, 111, 0.1) !important;
}

.admin-null {
    color: var(--color-text-muted);
    font-style: italic;
    font-size: 0.75rem;
}

.admin-required {
    color: var(--color-tertiary);
    margin-left: 0.25rem;
}

.admin-null-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    margin-top: 0.5rem;
}

.admin-null-toggle input { accent-color: var(--color-accent); }

/* SQL Console */
.admin-sql-panel {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
}

.admin-sql-input {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

.admin-sql-input textarea {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    resize: vertical;
}

.admin-sql-input .btn { flex-shrink: 0; margin-top: 0.125rem; }

/* ============================================
   AI FEATURES
   ============================================ */

/* AI button style (distinct from regular accent buttons) */
.btn-ai {
    background: linear-gradient(135deg, #7c3aed, #06d6a0);
    color: #fff;
    border: none;
}
.btn-ai:hover {
    background: linear-gradient(135deg, #8b5cf6, #00f5b8);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

/* AI badge (label in panel headers) */
.ai-badge {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #06d6a0);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    vertical-align: middle;
    margin-right: 0.375rem;
}

/* Toolbar divider between regular and AI buttons */
.toolbar-divider {
    display: inline-block;
    width: 1px;
    height: 1.5rem;
    background: var(--color-border);
    margin: 0 0.25rem;
    vertical-align: middle;
}

/* AI section titles in profile panel */
.ai-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* Loading spinner for AI requests */
.ai-loading {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    padding: 1rem;
    text-align: center;
}
.ai-loading::before {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: ai-spin 0.6s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}
@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.ai-error {
    color: var(--color-tertiary);
    font-size: 0.8125rem;
    padding: 0.75rem;
    background: rgba(239, 71, 111, 0.1);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-tertiary);
}

/* AI opt-in prompt (for on-demand features) */
.ai-opt-in {
    text-align: center;
    padding: 1rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-secondary, rgba(124, 58, 237, 0.03));
}
.ai-opt-in-desc {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin: 0 0 0.75rem;
}
.ai-opt-in-btn {
    display: inline-block;
    padding: 0.4rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #06d6a0);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity 0.15s;
}
.ai-opt-in-btn:hover {
    opacity: 0.85;
}

/* ============================================
   AI CHAT SIDEBAR
   ============================================ */
.ai-chat-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--color-bg-secondary);
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}
.ai-chat-sidebar.open {
    right: 0;
}

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.ai-chat-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.ai-chat-header-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}
.ai-token-usage {
    padding: 0.375rem 1rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.ai-token-bar-wrap {
    flex: 1;
    height: 6px;
    background: var(--color-bg-card);
    border-radius: 3px;
    overflow: hidden;
}
.ai-token-bar {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #06d6a0, #7c3aed);
    transition: width 0.3s ease;
    width: 0%;
}
.ai-token-bar.warning {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}
.ai-token-label {
    font-size: 0.6875rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
}
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-chat-welcome {
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
    padding: 1rem;
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
}
.ai-chat-welcome p { margin-bottom: 0.5rem; }
.ai-chat-welcome ul {
    list-style: none;
    padding: 0;
}
.ai-chat-welcome li {
    padding: 0.25rem 0;
}
.ai-chat-welcome li::before {
    content: '\2022';
    color: var(--color-accent);
    margin-right: 0.5rem;
}

.ai-chat-msg {
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    line-height: 1.5;
    max-width: 90%;
    word-wrap: break-word;
}
.ai-chat-msg-user {
    background: var(--color-accent);
    color: var(--color-text-inverse);
    align-self: flex-end;
    border-bottom-right-radius: 0.125rem;
    white-space: pre-wrap;
}
.ai-chat-msg-assistant {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 0.125rem;
}
.ai-chat-msg-assistant h2,
.ai-chat-msg-assistant h3,
.ai-chat-msg-assistant h4,
.ai-chat-msg-assistant h5 {
    font-weight: 600;
    margin: 0.625rem 0 0.25rem 0;
    line-height: 1.3;
}
.ai-chat-msg-assistant h2 { font-size: 1rem; }
.ai-chat-msg-assistant h3 { font-size: 0.9375rem; }
.ai-chat-msg-assistant h4 { font-size: 0.875rem; }
.ai-chat-msg-assistant h5 { font-size: 0.8125rem; }
.ai-chat-msg-assistant h2:first-child,
.ai-chat-msg-assistant h3:first-child,
.ai-chat-msg-assistant h4:first-child,
.ai-chat-msg-assistant h5:first-child { margin-top: 0; }
.ai-chat-msg-assistant p {
    margin: 0.25rem 0;
}
.ai-chat-msg-assistant p:first-child { margin-top: 0; }
.ai-chat-msg-assistant p:last-child { margin-bottom: 0; }
.ai-chat-msg-assistant ul,
.ai-chat-msg-assistant ol {
    margin: 0.375rem 0;
    padding-left: 1.25rem;
}
.ai-chat-msg-assistant li {
    margin-bottom: 0.125rem;
}
.ai-chat-msg-assistant strong { font-weight: 600; }
.ai-chat-msg-assistant em { font-style: italic; }
.ai-chat-msg-assistant code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}
.ai-chat-msg-assistant pre {
    background: var(--color-bg-primary);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin: 0.375rem 0;
    overflow-x: auto;
}
.ai-chat-msg-assistant pre code {
    background: none;
    padding: 0;
    font-size: 0.75rem;
    line-height: 1.5;
}
.ai-chat-error {
    background: rgba(239, 71, 111, 0.15);
    color: var(--color-tertiary);
    white-space: pre-wrap;
}

.ai-chat-input-area {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-primary);
}

.ai-chat-suggestions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.ai-suggestion-chip {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.6875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}
.ai-suggestion-chip:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.ai-chat-input-row {
    display: flex;
    gap: 0.5rem;
}
.ai-chat-input-row .form-input {
    flex: 1;
}

/* ============================================
   AI INSIGHTS (in Profile panel)
   ============================================ */
.ai-insights-container,
.ai-cleaning-container {
    margin-top: 0.5rem;
}

.ai-insight-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--color-secondary);
}
.ai-insight-info { border-left-color: var(--color-secondary); }
.ai-insight-warning { border-left-color: var(--color-warning); }
.ai-insight-critical { border-left-color: var(--color-tertiary); }

.ai-insight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}
.ai-insight-type {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    font-weight: 600;
}
.ai-insight-severity {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 999px;
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    text-transform: uppercase;
}
.ai-insight-title {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.ai-insight-detail {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}
.ai-insight-columns {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    margin-top: 0.375rem;
}

/* ============================================
   AI CLEANING SUGGESTIONS (in Profile panel)
   ============================================ */
.ai-cleaning-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--color-text-muted);
}
.ai-cleaning-low { border-left-color: var(--color-secondary); }
.ai-cleaning-medium { border-left-color: var(--color-warning); }
.ai-cleaning-high { border-left-color: var(--color-tertiary); }

.ai-cleaning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}
.ai-cleaning-column {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-accent);
    font-weight: 600;
}
.ai-cleaning-severity {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 999px;
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    text-transform: uppercase;
}
.ai-cleaning-issue {
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.ai-cleaning-suggestion {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}
.ai-cleaning-examples {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    margin-top: 0.375rem;
}
.ai-cleaning-examples code {
    background: var(--color-bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.625rem;
}

.ai-clean-ok {
    color: var(--color-accent);
    font-size: 0.8125rem;
    padding: 0.5rem;
}

/* ============================================
   AI SUMMARY PANEL
   ============================================ */
.ai-summary-content {
    padding: 0.5rem 0;
}
.ai-summary-paragraph {
    font-size: 0.8125rem;
    line-height: 1.7;
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
}
.ai-summary-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--color-border);
}
.ai-retry-btn {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
}

/* ============================================
   AI NL-SQL PANEL
   ============================================ */
.ai-sql-input {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.ai-sql-input .form-input {
    flex: 1;
}

.ai-sql-result { padding: 0.25rem 0; }

.ai-sql-explanation {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

.ai-sql-code {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-accent);
    overflow-x: auto;
    margin-bottom: 0.5rem;
    white-space: pre-wrap;
}

.ai-sql-meta {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    margin: 0.5rem 0;
}
.ai-sql-detail {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
}

.ai-sql-table-wrap {
    overflow-x: auto;
    margin-top: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}
.ai-sql-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.ai-sql-table th {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
}
.ai-sql-table td {
    padding: 0.375rem 0.625rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-primary);
}
.ai-sql-table tr:hover td {
    background: var(--color-bg-hover);
}

/* ============================================
   AI VIZ RECOMMENDATIONS (in Charts panel)
   ============================================ */
.ai-viz-container {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.ai-viz-recs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-viz-rec-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    font-family: var(--font-sans);
    width: 100%;
}
.ai-viz-rec-btn:hover {
    border-color: var(--color-accent);
    background: var(--color-bg-hover);
}
.ai-viz-rec-type {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    font-weight: 700;
}
.ai-viz-rec-title {
    font-size: 0.8125rem;
    color: var(--color-text-primary);
    font-weight: 500;
}
.ai-viz-rec-reason {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

/* ============================================
   DASHBOARD (Charts Builder)
   ============================================ */

.dash-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}
.dash-toolbar-title {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    margin-right: auto;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-toolbar-title strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

.dash-layout {
    display: flex;
    min-height: calc(100vh - 56px - 49px);
}

.dash-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    padding: 1rem;
    overflow-y: auto;
}
.dash-sidebar-section {
    margin-bottom: 1.25rem;
}
.dash-sidebar-title {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}
.dash-stat {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    padding: 0.2rem 0;
}
.dash-stat strong {
    color: var(--color-text-primary);
    font-family: var(--font-mono);
}
.dash-col-list {
    list-style: none;
}
.dash-col-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.375rem;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    border-radius: var(--radius-sm);
    cursor: default;
}
.dash-col-item:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}
.dash-col-icon {
    font-size: 0.625rem;
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
}
.dash-col-type {
    font-size: 0.625rem;
    color: var(--color-text-muted);
    margin-left: auto;
    font-family: var(--font-mono);
}

/* Multi-source sidebar */
.dash-source-group {
    list-style: none;
    margin-bottom: 0.5rem;
}
.dash-source-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-primary);
    border-radius: var(--radius-sm);
    cursor: default;
}
.dash-source-header:hover {
    background: var(--color-bg-hover);
}
.dash-source-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dash-source-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-source-meta {
    font-size: 0.625rem;
    color: var(--color-text-muted);
    font-weight: 400;
}
.dash-source-remove {
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.15s;
}
.dash-source-header:hover .dash-source-remove {
    opacity: 1;
}
.dash-source-columns {
    list-style: none;
    padding: 0 0 0 0.5rem;
    margin: 0;
}

/* Add source modal compact zone */
.dash-upload-zone-sm {
    padding: 1rem;
    min-height: auto;
}

/* Source selector in panel config */
.dash-source-select {
    max-width: 160px;
}

.dash-grid {
    flex: 1;
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    align-content: start;
    overflow-y: auto;
}

.dash-panel {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    min-height: 0;
    grid-column: span 2;
    position: relative;
}
.dash-panel.full-width {
    grid-column: 1 / -1;
}

/* Drag handle */
.dash-drag-handle {
    cursor: grab;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    padding: 0 0.125rem;
    display: flex;
    align-items: center;
    user-select: none;
    flex-shrink: 0;
    letter-spacing: 1px;
}
.dash-drag-handle:active { cursor: grabbing; }

/* Resize handle */
.dash-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: se-resize;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.15s;
}
.dash-panel:hover .dash-resize-handle { opacity: 1; }
.dash-resize-handle::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--color-text-muted);
    border-bottom: 2px solid var(--color-text-muted);
}

/* SortableJS drag feedback */
.dash-panel.sortable-ghost {
    opacity: 0.3;
}
.dash-panel.sortable-chosen {
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.dash-panel-header {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    gap: 0.5rem;
}
.dash-panel-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-panel-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}
.dash-panel-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.8125rem;
    transition: var(--transition-fast);
}
.dash-panel-btn:hover {
    color: var(--color-text-primary);
    border-color: var(--color-border);
    background: var(--color-bg-tertiary);
}

.dash-panel-config {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-primary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    align-items: center;
}
.dash-panel-config select,
.dash-panel-config input {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-family: var(--font-sans);
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    outline: none;
}
.dash-panel-config select:focus,
.dash-panel-config input:focus {
    border-color: var(--color-accent);
}
.dash-panel-config label {
    font-size: 0.625rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.dash-config-group {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.dash-chart-container {
    flex: 1;
    min-height: 300px;
    padding: 0.5rem;
}

.dash-metric-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.dash-metric-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--color-text-primary);
    letter-spacing: -0.5px;
}
.dash-metric-label {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}
.dash-metric-spark {
    flex: 1;
    min-height: 50px;
    margin-top: 0.5rem;
}

.dash-table-container {
    overflow: auto;
    max-height: 400px;
    padding: 0.5rem;
}
.dash-table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.dash-table-container th {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.625rem;
    letter-spacing: 0.05em;
    padding: 0.5rem;
    text-align: left;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--color-border);
}
.dash-table-container td {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid rgba(45, 55, 72, 0.4);
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
}
.dash-table-container tr:hover td {
    background: var(--color-bg-hover);
}

/* Upload state */
.dash-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-base);
    margin: 2rem auto;
    max-width: 500px;
}
.dash-upload-zone:hover,
.dash-upload-zone.dragover {
    border-color: var(--color-accent);
    background: var(--color-accent-subtle);
}
.dash-upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}
.dash-upload-text {
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.dash-upload-hint {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}
.dash-upload-divider {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    margin: 0.75rem 0;
    text-align: center;
}
.dash-pick-file-btn {
    margin: 0 auto;
    display: block;
}
/* File picker modal list */
.dash-file-picker-list {
    max-height: 360px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dash-file-picker-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: var(--transition-base);
}
.dash-file-picker-item:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-subtle);
}
.dash-file-picker-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.dash-file-picker-meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Empty grid state */
.dash-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--color-text-muted);
    text-align: center;
}
.dash-empty-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Globe panel */
.dash-globe-container {
    min-height: 500px;
    width: 100%;
    height: 500px;
    flex: 1;
    background: #0a0f1a;
}

/* Map panel */
.dash-map-container {
    min-height: 400px;
    flex: 1;
}
.dash-map-container .leaflet-container {
    background: var(--color-bg-primary);
}

/* Saved views on landing page */
.dash-landing-views {
    max-width: 700px;
    margin: 0 auto 2rem auto;
    padding: 0 1rem;
}
.dash-landing-views-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 0.75rem;
    text-align: center;
}
.dash-landing-views-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}
.dash-landing-view-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-base);
    text-align: left;
}
.dash-landing-view-card:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-subtle);
}
.dash-landing-view-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-landing-view-meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Saved views list in sidebar */
.dash-saved-view {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0;
    font-size: 0.75rem;
}
.dash-saved-view-name {
    flex: 1;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-saved-view-count {
    font-size: 0.625rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.dash-saved-view-load,
.dash-saved-view-del {
    font-size: 0.6875rem;
}

@media (max-width: 768px) {
    .dash-sidebar { display: none; }
    .dash-grid { grid-template-columns: 1fr; padding: 0.75rem; }
    .dash-panel { grid-column: span 1 !important; }
    .dash-resize-handle { display: none; }
    .dash-toolbar { padding: 0.5rem 0.75rem; }
}

