:root {
    --background: #060b18;
    --surface-glass: rgba(10, 18, 36, 0.6);
    --surface-solid: #0a1224;
    --border: rgba(100, 160, 220, 0.1);
    --primary: #2b7fff;
    --primary-dark: #1a6bef;
    --secondary: #38bdf8;
    --text: #e2e8f0;
    --text-muted: #8da4bf;
    --accent: #38bdf8;
    --success: #34d399;
    --error: #f87171;
    --warning: #fbbf24;
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --glow-primary: 0 0 30px rgba(43, 127, 255, 0.08);
    --glow-accent: 0 0 30px rgba(56, 189, 248, 0.05);
    /* Theme-aware semantic tokens */
    --glass-bg: rgba(10, 18, 36, 0.6);
    --glass-bg-heavy: rgba(10, 18, 36, 0.8);
    --glass-bg-light: rgba(10, 18, 36, 0.3);
    --glass-bg-medium: rgba(10, 18, 36, 0.7);
    --glass-bg-deep: rgba(4, 8, 20, 0.7);
    --glass-bg-input: rgba(10, 18, 36, 0.55);
    --text-strong: rgba(226, 232, 240, 0.97);
    --text-body: rgba(226, 232, 240, 0.92);
    --text-soft: rgba(226, 232, 240, 0.75);
    --text-faint: rgba(141, 164, 191, 0.85);
    --text-fainter: rgba(141, 164, 191, 0.65);
    --text-faintest: rgba(141, 164, 191, 0.5);
    --border-subtle: rgba(100, 160, 220, 0.06);
    --border-light: rgba(100, 160, 220, 0.08);
    --border-medium: rgba(100, 160, 220, 0.12);
    --border-strong: rgba(100, 160, 220, 0.18);
    --border-accent: rgba(43, 127, 255, 0.2);
    --primary-glass: rgba(43, 127, 255, 0.1);
    --primary-glass-strong: rgba(43, 127, 255, 0.18);
    --primary-glass-light: rgba(43, 127, 255, 0.06);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-deep: 0 12px 40px rgba(0, 0, 0, 0.35);
    --nav-bg: rgba(6, 11, 24, 0.9);
    --nav-shadow: 0 1px 0 rgba(100, 160, 220, 0.06);
    --tabs-bg: rgba(10, 18, 36, 0.75);
    --code-bg: rgba(4, 8, 20, 0.5);
    --chat-user-bg: linear-gradient(135deg, rgba(43, 127, 255, 0.18), rgba(56, 189, 248, 0.1));
    --chat-assistant-bg: rgba(10, 18, 36, 0.65);
    --chat-input-bg: rgba(4, 8, 20, 0.45);
}

/* ═══ Light Theme — Blue & White ═══ */
[data-theme="light"] {
    --background: #ffffff;
    --surface-glass: #ffffff;
    --surface-solid: #ffffff;
    --border: rgba(10, 30, 60, 0.07);
    --primary: #1a6bef;
    --primary-dark: #1457cc;
    --secondary: #0284c7;
    --text: #0f1b2d;
    --text-muted: #5a6f8a;
    --accent: #0284c7;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow-lg: 0 20px 60px rgba(10, 30, 60, 0.06), 0 1px 3px rgba(10, 30, 60, 0.04);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --glow-primary: 0 0 0 transparent;
    --glow-accent: 0 0 0 transparent;
    --glass-bg: #ffffff;
    --glass-bg-heavy: #ffffff;
    --glass-bg-light: #f4f7fb;
    --glass-bg-medium: #ffffff;
    --glass-bg-deep: #edf2f8;
    --glass-bg-input: #ffffff;
    --text-strong: #0a1628;
    --text-body: #0f1b2d;
    --text-soft: #2d3e54;
    --text-faint: #5a6f8a;
    --text-fainter: #8da4bf;
    --text-faintest: #b8c9db;
    --border-subtle: rgba(10, 30, 60, 0.04);
    --border-light: rgba(10, 30, 60, 0.06);
    --border-medium: rgba(10, 30, 60, 0.08);
    --border-strong: rgba(10, 30, 60, 0.12);
    --border-accent: rgba(26, 107, 239, 0.18);
    --primary-glass: rgba(26, 107, 239, 0.06);
    --primary-glass-strong: rgba(26, 107, 239, 0.1);
    --primary-glass-light: rgba(26, 107, 239, 0.04);
    --shadow-card: 0 1px 3px rgba(10, 30, 60, 0.04), 0 4px 16px rgba(10, 30, 60, 0.03);
    --shadow-deep: 0 4px 24px rgba(10, 30, 60, 0.06);
    --nav-bg: rgba(255, 255, 255, 0.88);
    --nav-shadow: 0 1px 0 rgba(10, 30, 60, 0.06);
    --tabs-bg: #f4f7fb;
    --code-bg: #f4f7fb;
    --chat-user-bg: linear-gradient(135deg, rgba(26, 107, 239, 0.07), rgba(2, 132, 199, 0.05));
    --chat-assistant-bg: #f4f7fb;
    --chat-input-bg: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    min-height: 100vh;
    color: var(--text);
    background: var(--background);
    line-height: 1.6;
    position: relative;
}

/* Dark theme body gradient (default — html has no data-theme="light") */
html:not([data-theme="light"]) body {
    background: radial-gradient(circle at top, rgba(43, 127, 255, 0.1), transparent 55%),
                radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.08), transparent 40%),
                var(--background);
}

.background::before,
.background::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.background::before {
    background: radial-gradient(circle at 20% 20%, rgba(26, 107, 239, 0.18), transparent 55%);
    filter: blur(70px);
}

.background::after {
    background: radial-gradient(circle at 80% 10%, rgba(56, 189, 248, 0.12), transparent 50%);
    filter: blur(90px);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
}

.hero {
    position: relative;
    padding: 4.5rem 0 3rem;
}

.hero-centered {
    text-align: center;
}

.hero-inner.narrow {
    max-width: 720px;
    margin: 0 auto;
}

.hero-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    align-items: center;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(43, 127, 255, 0.18), rgba(56, 189, 248, 0.14));
    border: 1px solid rgba(100, 160, 220, 0.2);
    backdrop-filter: blur(24px);
    box-shadow: 0 20px 40px rgba(6, 11, 24, 0.35);
    position: relative;
    overflow: hidden;
}

.brand-lockup::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.15), transparent 45%);
    opacity: 0.9;
    pointer-events: none;
}

.brand-icon {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    background: rgba(6, 11, 24, 0.8);
    border: 1px solid rgba(100, 160, 220, 0.3);
    box-shadow: inset 0 0 0 1px rgba(43, 127, 255, 0.35), 0 18px 35px rgba(43, 127, 255, 0.25);
    overflow: hidden;
}

.brand-icon::before {
    content: "";
    position: absolute;
    inset: -45%;
    background: conic-gradient(from 90deg, rgba(43, 127, 255, 0.6), rgba(56, 189, 248, 0.35), rgba(43, 127, 255, 0.5), rgba(56, 189, 248, 0.4), rgba(43, 127, 255, 0.6));
    filter: blur(22px);
    animation: brandPulse 6s ease-in-out infinite;
}

.brand-orbit {
    position: absolute;
    width: 94%;
    height: 94%;
    border-radius: 20px;
    border: 1px solid rgba(100, 160, 220, 0.4);
    box-shadow: 0 0 12px rgba(43, 127, 255, 0.3);
    animation: orbitSpin 12s linear infinite;
}

.brand-initial {
    position: relative;
    font-weight: 700;
    font-size: 1.6rem;
    color: rgba(226, 232, 240, 0.95);
    text-shadow: 0 2px 8px rgba(10, 18, 36, 0.65);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    z-index: 1;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.brand-tagline {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(226, 232, 240, 0.75);
}

.hero-title {
    font-size: clamp(2.4rem, 3vw, 3.2rem);
    font-weight: 700;
    line-height: 1.2;
    margin-top: -0.35rem;
}

.hero-subtitle {
    color: var(--text-muted);
    max-width: 550px;
    font-size: 1.05rem;
}

.hero-subtitle.subtle {
    font-size: 0.9rem;
    color: rgba(100, 160, 220, 0.75);
}

.hero-centered .hero-subtitle,
.hero-centered .hero-title {
    margin-left: auto;
    margin-right: auto;
}

.source-selection {
    padding-bottom: 4rem;
}

.path-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.75rem;
    align-items: stretch;
}

.path-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 320px;
    overflow: hidden;
}

.path-card-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 2rem;
}

.path-icon {
    font-size: 2rem;
}

.path-btn {
    width: 100%;
    justify-content: center;
}

.path-footer {
    padding: 1rem 2rem 1.5rem;
    border-top: 1px solid rgba(100, 160, 220, 0.2);
    font-size: 0.9rem;
    color: rgba(100, 160, 220, 0.75);
}

.source-help {
    margin-top: 3.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.source-help-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.source-help-grid h4 {
    margin-bottom: 0.5rem;
    color: rgba(226, 232, 240, 0.9);
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.hero-preview {
    justify-self: center;
}

.source-pill {
    margin-top: 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    background: rgba(10, 18, 36, 0.7);
    border: 1px solid rgba(100, 160, 220, 0.2);
    font-size: 0.9rem;
}

.pill-label {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(100, 160, 220, 0.8);
    font-size: 0.72rem;
}

.pill-value {
    font-weight: 600;
    color: rgba(226, 232, 240, 0.95);
}

/* ── Connection health dot ── */
.pill-health {
    display: inline-flex;
    align-items: center;
    margin-left: 0.25rem;
}

.health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    transition: background 0.3s;
}

.health-dot.health-unknown {
    background: var(--text-muted);
    opacity: 0.5;
}

.health-dot.health-ok {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.health-dot.health-err {
    background: var(--error);
    box-shadow: 0 0 6px var(--error);
    animation: healthPulse 1.5s ease-in-out infinite;
}

@keyframes healthPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── File upload label as button ── */
.file-upload-label {
    cursor: pointer;
}

/* ── Upload drop zone (connect page) ── */
.upload-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.25s, background 0.25s;
    background: rgba(10, 18, 36, 0.3);
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-active {
    border-color: var(--primary);
    background: rgba(43, 127, 255, 0.08);
}

.upload-drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

/* ── Uploaded tables bar ── */
.uploaded-tables-bar {
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(100, 160, 220, 0.12);
    margin-bottom: 0;
}

.uploaded-tables-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.uploaded-tables-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.uploaded-tables-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.table-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(43, 127, 255, 0.12);
    border: 1px solid rgba(43, 127, 255, 0.25);
    border-radius: 999px;
    padding: 0.25rem 0.55rem 0.25rem 0.7rem;
    font-size: 0.78rem;
    transition: background 0.2s, border-color 0.2s;
}

.table-chip:hover {
    background: rgba(43, 127, 255, 0.2);
    border-color: rgba(43, 127, 255, 0.4);
}

.table-chip-name {
    font-weight: 600;
    color: var(--primary);
}

.table-chip-meta {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.table-chip-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.15rem;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}

.table-chip-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

/* ── Collection group styling ── */
.table-collection {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0.55rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}
.collection-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    padding: 0.3rem 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.85;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.collection-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.add-table-btn {
    font-size: 0.75rem !important;
    padding: 0.2rem 0.6rem !important;
    gap: 0.25rem;
}

.btn-xs {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
}

/* file list preview in connect page */
.uploaded-files-preview {
    font-size: 0.85rem;
}
.uploaded-files-preview ul {
    margin: 0.3rem 0 0 1.2rem;
    padding: 0;
}
.uploaded-files-preview li {
    margin-bottom: 0.15rem;
}

.preview-card {
    background: linear-gradient(160deg, rgba(43, 127, 255, 0.22), rgba(56, 189, 248, 0.14));
    border: 1px solid rgba(100, 160, 220, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.preview-title {
    font-weight: 600;
    margin-bottom: 1rem;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    color: rgba(226, 232, 240, 0.85);
}

.preview-list {
    display: grid;
    gap: 0.85rem;
    color: rgba(226, 232, 240, 0.9);
    font-size: 0.95rem;
    list-style: none;
}

.workspace {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-bottom: 4rem;
}

.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.kpi-card {
    padding: 1.25rem 1.4rem;
    border-radius: var(--radius-md);
    background: rgba(10, 18, 36, 0.7);
    border: 1px solid rgba(100, 160, 220, 0.3);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 40px rgba(10, 18, 36, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kpi-label {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(100, 160, 220, 0.85);
}

.kpi-value {
    font-size: 1.65rem;
    font-weight: 600;
}

.kpi-subtext {
    font-size: 0.85rem;
    color: rgba(100, 160, 220, 0.75);
}

.chart-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.chart-card {
    padding: 1.5rem;
    border-radius: var(--radius-md);
    background: rgba(10, 18, 36, 0.7);
    border: 1px solid rgba(100, 160, 220, 0.3);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 40px rgba(10, 18, 36, 0.3);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 320px;
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.chart-wrapper {
    position: relative;
    flex: 1;
    min-height: 240px;
}

.chart-wrapper canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

.chart-remove-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(43, 127, 255, 0.15);
    color: var(--text);
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.chart-remove-btn:hover,
.chart-remove-btn:focus {
    background: rgba(43, 127, 255, 0.35);
    box-shadow: 0 10px 20px rgba(43, 127, 255, 0.25);
    transform: translateY(-1px);
    outline: none;
}

.dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem;
}

.controls-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.controls-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.control-summary {
    font-size: 0.85rem;
    color: rgba(100, 160, 220, 0.85);
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.control-group {
    flex: 1 1 180px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 160px;
}

.control-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.9);
}

.dashboard-controls select {
    width: 100%;
    padding: 0.7rem 0.95rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(100, 160, 220, 0.35);
    background: rgba(10, 18, 36, 0.85);
    color: var(--text);
    font-size: 0.95rem;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-controls select:focus {
    border-color: rgba(43, 127, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.18);
    outline: none;
}

.dashboard-controls select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.control-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.control-hint {
    font-size: 0.82rem;
    color: rgba(100, 160, 220, 0.85);
}

.dashboard-suggestions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
}

.dashboard-block-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.dashboard-block-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.dashboard-block-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.suggestion-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.suggestion-pill {
    border-radius: 999px;
    border: 1px solid rgba(43, 127, 255, 0.35);
    background: rgba(43, 127, 255, 0.12);
    color: rgba(226, 232, 240, 0.95);
    padding: 0.6rem 1.1rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.suggestion-pill:hover,
.suggestion-pill:focus {
    background: rgba(43, 127, 255, 0.25);
    box-shadow: 0 12px 24px rgba(43, 127, 255, 0.25);
    transform: translateY(-1px);
    outline: none;
}

.dashboard-quick-stats {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem;
}

.dashboard-custom-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dashboard-chart-grid {
    min-height: 320px;
}

.anomaly-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.5rem;
    padding: 1.5rem;
}

.anomaly-section .dashboard-block-header {
    margin-bottom: 0.5rem;
}

.anomaly-section .dashboard-empty {
    width: 100%;
}

.anomaly-modal-card {
    width: min(680px, 95vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem;
}

.anomaly-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.anomaly-modal-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0;
}

.anomaly-modal-close {
    background: transparent;
    border: none;
    color: rgba(226, 232, 240, 0.75);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.anomaly-modal-close:hover {
    color: rgba(226, 232, 240, 1);
}

.anomaly-modal-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.anomaly-modal-section {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.anomaly-modal-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.anomaly-modal-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(226, 232, 240, 0.9);
}

.anomaly-modal-hint {
    font-size: 0.85rem;
    color: rgba(100, 160, 220, 0.82);
}

.anomaly-modal-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.65rem;
}

.anomaly-modal-checkbox {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    background: rgba(10, 18, 36, 0.6);
    border: 1px solid rgba(100, 160, 220, 0.25);
}

.anomaly-modal-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.anomaly-filter-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.anomaly-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: center;
    background: rgba(10, 18, 36, 0.6);
    border: 1px solid rgba(100, 160, 220, 0.25);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.anomaly-filter-column,
.anomaly-filter-value,
.anomaly-modal-input,
.anomaly-modal-card select {
    background: rgba(10, 18, 36, 0.8);
    border: 1px solid rgba(100, 160, 220, 0.35);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.75rem;
    color: var(--text);
    font-size: 0.92rem;
}

.anomaly-filter-column:disabled,
.anomaly-filter-value:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.anomaly-filter-remove {
    border: none;
    background: rgba(248, 113, 113, 0.15);
    color: #fca5a5;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.anomaly-filter-remove:hover {
    background: rgba(248, 113, 113, 0.28);
    color: #fecaca;
}

.anomaly-filter-add.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.anomaly-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.dashboard-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    border: 1px dashed rgba(100, 160, 220, 0.35);
    border-radius: var(--radius-md);
    background: rgba(10, 18, 36, 0.45);
}

.dashboard-empty .empty-state {
    gap: 0.6rem;
}

.dashboard-empty .hint {
    font-size: 0.85rem;
    color: rgba(100, 160, 220, 0.85);
}

.dashboard-note {
    color: rgba(100, 160, 220, 0.75);
    font-size: 0.85rem;
    text-align: center;
}

@keyframes brandPulse {
    0%, 100% { transform: rotate(0deg) scale(1); opacity: 0.8; }
    50% { transform: rotate(8deg) scale(1.05); opacity: 1; }
}

@keyframes orbitSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
    gap: 2rem;
    align-items: stretch;
}

/* glass-card: defined in creative design section below */

.panel {
    display: flex;
    flex-direction: column;
    padding: 2rem;
    gap: 1.75rem;
}

.panel-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.panel-header p {
    color: var(--text-muted);
    font-size: 0.97rem;
    max-width: 560px;
}

.panel-header.compact {
    gap: 0.35rem;
}

.panel-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

textarea {
    width: 100%;
    min-height: 140px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(100, 160, 220, 0.25);
    background: rgba(10, 18, 36, 0.75);
    color: var(--text);
    font-size: 1rem;
    padding: 1.15rem 1.25rem;
    resize: vertical;
    line-height: 1.5;
    transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: rgba(43, 127, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.18);
    transform: translateY(-2px);
}

textarea::placeholder {
    color: rgba(100, 160, 220, 0.8);
}

.action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
    color: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #2b7fff 50%, #06b6d4);
    background-size: 200% 200%;
    animation: btn-gradient-shift 4s ease infinite;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4), 0 8px 30px rgba(43, 127, 255, 0.3);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.55), 0 12px 40px rgba(6, 182, 212, 0.35);
    animation: none;
    background-position: right center;
}

@keyframes btn-gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.btn-secondary {
    background: rgba(100, 160, 220, 0.2);
    border: 1px solid rgba(100, 160, 220, 0.35);
    color: var(--text);
}

.btn-secondary:hover {
    background: rgba(100, 160, 220, 0.3);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(43, 127, 255, 0.45);
    color: var(--text);
}

.btn-outline:hover {
    background: rgba(43, 127, 255, 0.12);
    transform: translateY(-2px);
}

.btn-ghost {
    background: rgba(100, 160, 220, 0.12);
    border: 1px solid transparent;
    color: var(--text);
}

.btn-ghost:hover {
    border-color: rgba(100, 160, 220, 0.35);
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

.action-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.75rem;
}

.action-flow .btn {
    width: min(280px, 100%);
}

.flow-step {
    width: 100%;
    display: flex;
    justify-content: center;
}

.flow-arrow {
    font-size: 1.1rem;
    color: rgba(100, 160, 220, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.flow-arrow.subtle {
    color: rgba(100, 160, 220, 0.55);
}

.arrow-icon {
    display: inline-block;
    background: rgba(43, 127, 255, 0.18);
    color: rgba(226, 232, 240, 0.9);
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

.loader {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: currentColor;
    animation: spin 0.85s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-container {
    border-radius: var(--radius-md);
    border: 1px solid rgba(100, 160, 220, 0.2);
    overflow: hidden;
    background: rgba(10, 18, 36, 0.55);
}

.schema-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.schema-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.schema-header p {
    color: rgba(100, 160, 220, 0.75);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.schema-visual-wrapper {
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    background: rgba(10, 18, 36, 0.65);
    border: 1px solid rgba(100, 160, 220, 0.2);
}

.schema-visual-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.schema-card {
    background: rgba(4, 8, 20, 0.65);
    border: 1px solid rgba(43, 127, 255, 0.25);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    box-shadow: 0 20px 32px rgba(10, 18, 36, 0.35);
}

.schema-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.schema-card-title {
    font-weight: 600;
    color: rgba(226, 232, 240, 0.95);
}

.schema-table-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(43, 127, 255, 0.18);
    color: rgba(226, 232, 240, 0.85);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.schema-column-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
}

.schema-column-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.9rem;
    padding: 0.35rem 0.4rem;
    border-radius: 8px;
    background: rgba(43, 127, 255, 0.08);
}

.schema-column-name {
    font-weight: 500;
    color: rgba(226, 232, 240, 0.9);
}

.schema-column-type {
    color: rgba(100, 160, 220, 0.85);
    font-size: 0.82rem;
    text-transform: lowercase;
}

.schema-column-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.schema-column-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

.schema-constraints {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.schema-constraint {
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(43, 127, 255, 0.18);
    color: rgba(147, 197, 253, 0.95);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* tabs: enhanced in creative design section below */

.tab-content {
    display: none;
    padding: 1.75rem;
}

.tab-content.active {
    display: block;
}


.results-pane {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.results-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.results-toolbar {
    display: flex;
    justify-content: flex-end;
}

.results-toolbar .btn {
    min-width: 0;
}

.dashboard-content {
    border-radius: var(--radius-md);
    border: 1px dashed rgba(100, 160, 220, 0.28);
    background: rgba(4, 8, 20, 0.45);
    padding: 1.5rem;
    min-height: 240px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.dashboard-content:hover {
    border-color: rgba(43, 127, 255, 0.45);
    background: rgba(4, 8, 20, 0.55);
}

.analysis-pane {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

.sql-container {
    background: rgba(4, 8, 20, 0.55);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid rgba(100, 160, 220, 0.2);
    overflow-x: auto;
    box-shadow: inset 0 0 0 1px rgba(43, 127, 255, 0.05);
}

.sql-container pre,
.sql-container code,
.sql-container code.hljs,
.sql-container pre code {
    background: transparent !important;
    color: var(--text);
}

.sql-container pre {
    margin: 0;
    font-size: 0.95rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    background: rgba(4, 8, 20, 0.6);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.data-table thead {
    background: rgba(43, 127, 255, 0.18);
}

.data-table th,
.data-table td {
    padding: 0.9rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(100, 160, 220, 0.15);
}

.data-table th {
    font-weight: 600;
    color: rgba(226, 232, 240, 0.9);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: rgba(43, 127, 255, 0.1);
}

.data-table tr.highlight-row {
    background: rgba(239, 68, 68, 0.18) !important;
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.25);
    transition: background 0.3s ease;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.badge-success { background: rgba(52, 211, 153, 0.18); color: #22c55e; }
.badge-error { background: rgba(248, 113, 113, 0.18); color: #f87171; }
.badge-info { background: rgba(96, 165, 250, 0.18); color: #60a5fa; }
.badge-warning { background: rgba(251, 191, 36, 0.18); color: #f59e0b; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(100, 160, 220, 0.85);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.analysis-section {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: rgba(10, 18, 36, 0.65);
    border-radius: var(--radius-md);
    border: 1px solid rgba(100, 160, 220, 0.25);
}

.analysis-section h3 {
    color: rgba(226, 232, 240, 0.95);
    margin-bottom: 0.65rem;
}

.analysis-content {
    color: rgba(203, 213, 225, 0.9);
    font-size: 0.95rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* ─── Chat with Data ─── */
.chat-panel {
    display: flex;
    flex-direction: column;
    height: 520px;
    max-height: 65vh;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scroll-behavior: smooth;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.5rem 1rem 1.5rem;
    gap: 0.5rem;
    flex: 1;
}

.chat-welcome-icon { opacity: 0.8; }

.chat-welcome-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.95);
    margin-top: 0.5rem;
}

.chat-welcome-subtitle {
    font-size: 0.88rem;
    color: rgba(100, 160, 220, 0.85);
    max-width: 420px;
    line-height: 1.55;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.chat-suggestion-chip {
    background: rgba(43, 127, 255, 0.12);
    border: 1px solid rgba(43, 127, 255, 0.25);
    color: rgba(199, 210, 254, 0.9);
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.chat-suggestion-chip:hover {
    background: rgba(43, 127, 255, 0.22);
    border-color: rgba(43, 127, 255, 0.45);
    transform: translateY(-1px);
}

.chat-bubble {
    max-width: 82%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.92rem;
    line-height: 1.6;
    word-wrap: break-word;
    animation: chatFadeIn 0.25s ease;
}

@keyframes chatFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* chat-bubble.user / .assistant: enhanced in creative design section */

.chat-bubble.assistant p { margin: 0 0 0.5em; }
.chat-bubble.assistant p:last-child { margin-bottom: 0; }
.chat-bubble.assistant ul,
.chat-bubble.assistant ol { margin: 0.25em 0; padding-left: 1.25em; }
.chat-bubble.assistant li { margin-bottom: 0.2em; }
.chat-bubble.assistant strong { color: rgba(226, 232, 240, 0.95); }
.chat-bubble.assistant code {
    background: rgba(43, 127, 255, 0.15);
    padding: 0.15em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.85em;
}

.chat-bubble.typing {
    align-self: flex-start;
    background: rgba(10, 18, 36, 0.45);
    border: 1px solid rgba(100, 160, 220, 0.15);
    color: rgba(100, 160, 220, 0.7);
    font-style: italic;
}

/* chat-input-bar / chat-input: enhanced in creative design section */

.chat-input::placeholder { color: rgba(100, 160, 220, 0.5); }

.chat-send-btn {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
}

.anomaly-pane {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.anomaly-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.anomaly-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.anomaly-header h3 {
    margin: 0;
    font-size: 1.15rem;
}

.anomaly-message {
    color: rgba(100, 160, 220, 0.85);
    font-size: 0.95rem;
}

.anomaly-selector {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    background: rgba(10, 18, 36, 0.65);
    border: 1px solid rgba(100, 160, 220, 0.25);
}

.anomaly-selector label {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(100, 160, 220, 0.75);
}

.anomaly-selector select {
    background: transparent;
    border: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    appearance: none;
    padding-right: 1.2rem;
    cursor: pointer;
}

.anomaly-selector select:focus {
    outline: none;
}

.anomaly-body {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.25fr);
    align-items: stretch;
}

.anomaly-chart-card {
    min-height: 340px;
}

.anomaly-chart-card .chart-wrapper {
    min-height: 280px;
}

#anomaly-chart-canvas {
    width: 100% !important;
    height: 100% !important;
}

.anomaly-summary {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.anomaly-summary h3 {
    margin: 0;
    font-size: 1.05rem;
}

.anomaly-summary-text {
    font-size: 0.95rem;
    color: rgba(203, 213, 225, 0.85);
}

.anomaly-stat-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.anomaly-stat {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(10, 18, 36, 0.65);
    border: 1px solid rgba(100, 160, 220, 0.18);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.anomaly-stat-label {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(100, 160, 220, 0.75);
}

.anomaly-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.anomaly-stat-value.highlight {
    color: #f87171;
}

.anomaly-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.anomaly-list-item {
    padding: 1rem 1.1rem;
    border-radius: var(--radius-sm);
    background: rgba(10, 18, 36, 0.6);
    border: 1px solid rgba(100, 160, 220, 0.22);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.anomaly-list-headline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.anomaly-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(43, 127, 255, 0.18);
    color: rgba(226, 232, 240, 0.95);
    font-size: 0.82rem;
    font-weight: 600;
}

.anomaly-value {
    font-weight: 600;
}

.anomaly-z {
    font-size: 0.85rem;
    color: rgba(100, 160, 220, 0.85);
}

.anomaly-detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 0.75rem;
    font-size: 0.85rem;
    color: rgba(203, 213, 225, 0.85);
}

.anomaly-detail-list dt {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    color: rgba(100, 160, 220, 0.7);
}

.anomaly-detail-list dd {
    margin: 0;
}

.anomaly-empty {
    font-size: 0.9rem;
    color: rgba(100, 160, 220, 0.8);
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.alert-error {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
}

.alert-success {
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.35);
    color: #86efac;
}

.connect-flow {
    max-width: 760px;
    margin: 0 auto 4rem;
}

.connect-form {
    padding: 2.25rem 2.5rem;
}

.form-header {
    margin-bottom: 2rem;
}

.form-header h2 {
    font-size: 1.35rem;
    margin-bottom: 0.6rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 1.35rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(100, 160, 220, 0.28);
    background: rgba(10, 18, 36, 0.7);
    color: var(--text);
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: rgba(43, 127, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.18);
}

.required {
    color: #f97316;
    margin-left: 0.25rem;
}

.field-help {
    font-size: 0.78rem;
    color: rgba(100, 160, 220, 0.7);
}

.form-footer {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.connect-help {
    margin-top: 2.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

/* ─── Connect Mode Tabs ─── */
.connect-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.75rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(10, 18, 36, 0.5);
}

.connect-mode-tab {
    flex: 1;
    padding: 0.7rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.connect-mode-tab:hover {
    color: var(--text);
    background: rgba(43, 127, 255, 0.08);
}

.connect-mode-tab.active {
    background: rgba(43, 127, 255, 0.18);
    color: #c7d2fe;
    box-shadow: inset 0 -2px 0 var(--primary);
}

.connect-mode-panel {
    display: none;
}

.connect-mode-panel.active {
    display: block;
}

/* ─── Form 2-Column Row ─── */
.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .form-row-2col {
        grid-template-columns: 1fr;
    }
}

/* ─── Test Result Panel ─── */
.test-result-panel {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    line-height: 1.6;
}

.test-result-panel.test-success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #86efac;
}

.test-result-panel.test-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}

.test-tables-list {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.test-table-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.65rem;
    background: rgba(10, 18, 36, 0.4);
    border-radius: 8px;
    font-size: 0.85rem;
}

.test-table-name {
    font-weight: 500;
    color: var(--secondary);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ─── Auto-Metadata Section ─── */
.auto-meta-section {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    background: rgba(43, 127, 255, 0.06);
    border: 1px solid rgba(43, 127, 255, 0.2);
}

.auto-meta-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: #c7d2fe;
}

.auto-meta-preview {
    max-height: 280px;
    overflow-y: auto;
    padding: 0.85rem;
    background: rgba(10, 18, 36, 0.6);
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.82rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-muted);
    white-space: pre-wrap;
    line-height: 1.55;
}

/* ─── Checkbox Label ─── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ─── Textarea ─── */
.form-group textarea {
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(100, 160, 220, 0.28);
    background: rgba(10, 18, 36, 0.7);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    line-height: 1.5;
}

.form-group textarea:focus {
    outline: none;
    border-color: rgba(43, 127, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.18);
}

/* ─── Small Button Variant ─── */
.btn-sm {
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: rgba(100, 160, 220, 0.8);
    font-size: 0.9rem;
    text-decoration: none;
}

.back-link:hover {
    color: rgba(226, 232, 240, 0.95);
}

.site-footer {
    padding: 2.5rem 0 3rem;
    color: rgba(100, 160, 220, 0.75);
    font-size: 0.9rem;
}

.footer-inner {
    text-align: center;
}

/* Notifications */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.fade-in {
    animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 1024px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 1.75rem;
    }

    .anomaly-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 3.5rem 0 2.5rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn,
    .btn-group {
        width: 100%;
    }

    .btn {
        justify-content: center;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab {
        flex: 1 0 calc(50% - 0.6rem);
        text-align: center;
    }

    .chart-card {
        min-height: 280px;
    }

    .anomaly-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ─── Top Navigation Bar ─── (base — enhanced at bottom) */

.top-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
}

.nav-logo {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.nav-wordmark {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.02em;
    color: rgba(226, 232, 240, 0.95);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-links a {
    color: rgba(100, 160, 220, 0.9);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-links a:hover {
    background: rgba(100, 160, 220, 0.1);
    color: rgba(226, 232, 240, 1);
}

.nav-active {
    background: rgba(43, 127, 255, 0.15) !important;
    color: rgba(70, 150, 255, 1) !important;
}

.nav-admin-link {
    color: rgba(251, 191, 36, 0.9) !important;
}

.nav-admin-link:hover {
    color: rgba(251, 191, 36, 1) !important;
    background: rgba(251, 191, 36, 0.1) !important;
}

.nav-user {
    font-size: 0.82rem;
    color: rgba(100, 160, 220, 0.7);
    padding: 0 0.5rem;
}

/* ─── Hero Logo Block ─── */
.hero-logo-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.hero-logo {
    width: 64px;
    height: 64px;
}

.hero-brand-name {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: rgba(226, 232, 240, 0.95);
}

.hero-brand-tagline {
    display: block;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(100, 160, 220, 0.7);
}

.hero-brand-cursor {
    display: inline-block;
    font-weight: 300;
    color: rgba(100, 160, 220, 0.7);
    animation: tw-blink 0.75s step-end infinite;
    margin-left: 1px;
}

@keyframes tw-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* ─── Path Badges ─── */
.path-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(43, 127, 255, 0.18);
    color: rgba(70, 150, 255, 0.95);
    margin-bottom: 0.75rem;
}

.path-badge-alt {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(56, 189, 248, 0.15);
    color: rgba(56, 189, 248, 0.95);
    margin-bottom: 0.75rem;
}

/* ─── Section Labels ─── */
.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(100, 160, 220, 0.7);
    margin-bottom: 1rem;
}

/* ─── Saved Connections ─── */
.saved-connections-section {
    margin-top: 3rem;
}

.saved-connections-list {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.saved-conn-card {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.saved-conn-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.saved-conn-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.95);
}

.saved-conn-meta {
    font-size: 0.8rem;
    color: rgba(100, 160, 220, 0.7);
}

/* ─── Text & Button Utilities ─── */
.text-link {
    color: rgba(70, 150, 255, 0.9);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.text-link:hover {
    color: rgba(70, 150, 255, 1);
    text-decoration: underline;
}

.text-muted {
    color: rgba(100, 160, 220, 0.7);
}

.text-sm {
    font-size: 0.85rem;
}

.btn-sm {
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-xs {
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
    border-radius: 6px;
}

.btn-danger {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.28);
    transform: translateY(-1px);
}

/* ─── Detail Label (Settings) ─── */
.detail-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(100, 160, 220, 0.65);
    margin-bottom: 0.15rem;
}

.account-details {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ─── Flow Connector ─── */
.flow-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.15rem 0;
}

.flow-connector::before {
    content: "";
    display: block;
    width: 1.5px;
    height: 18px;
    background: linear-gradient(180deg, rgba(43, 127, 255, 0.45), rgba(43, 127, 255, 0.12));
    border-radius: 999px;
}

/* ─── CSS-only Empty State Icons ─── */
.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    border-radius: 14px;
    opacity: 0.5;
}

.empty-icon-sql {
    background: linear-gradient(135deg, rgba(43, 127, 255, 0.25), rgba(56, 189, 248, 0.2));
    border: 1.5px solid rgba(43, 127, 255, 0.35);
}

.empty-icon-results {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(43, 127, 255, 0.15));
    border: 1.5px solid rgba(56, 189, 248, 0.35);
}

.empty-icon-analysis {
    background: linear-gradient(135deg, rgba(56, 142, 255, 0.25), rgba(43, 127, 255, 0.15));
    border: 1.5px solid rgba(56, 142, 255, 0.35);
}

.empty-icon-forecast {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(56, 189, 248, 0.15));
    border: 1.5px solid rgba(52, 211, 153, 0.35);
}

.empty-icon-schema {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.15));
    border: 1.5px solid rgba(251, 191, 36, 0.3);
}

.empty-icon-chart {
    background: linear-gradient(135deg, rgba(43, 127, 255, 0.2), rgba(56, 142, 255, 0.15));
    border: 1.5px solid rgba(43, 127, 255, 0.3);
}

.empty-icon-error {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(239, 68, 68, 0.15));
    border: 1.5px solid rgba(248, 113, 113, 0.35);
}

.empty-icon-success {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.25), rgba(34, 197, 94, 0.15));
    border: 1.5px solid rgba(52, 211, 153, 0.4);
}

/* ─── Workspace Hero ─── */
.workspace-hero {
    padding: 1.5rem 0 0.5rem;
}

.workspace-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ─── Admin Table ─── */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-table thead {
    background: rgba(43, 127, 255, 0.1);
}

.admin-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(100, 160, 220, 0.85);
    border-bottom: 1px solid rgba(100, 160, 220, 0.15);
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(100, 160, 220, 0.1);
    color: rgba(226, 232, 240, 0.9);
}

.admin-table tr:hover {
    background: rgba(43, 127, 255, 0.06);
}

.role-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: capitalize;
}

.role-admin {
    background: rgba(43, 127, 255, 0.18);
    color: rgba(70, 150, 255, 0.95);
}

.role-user {
    background: rgba(100, 160, 220, 0.12);
    color: rgba(100, 160, 220, 0.85);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
}

.status-active {
    background: var(--success);
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.4);
}

.status-inactive {
    background: rgba(100, 160, 220, 0.4);
}

/* ─── Connection Cards (connections page) ─── */
.connections-flow {
    max-width: 820px;
    margin: 0 auto 4rem;
}

.connections-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.connection-card {
    padding: 1.5rem 2rem;
}

.connection-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.connection-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.connection-card-name {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.95);
}

.connection-card-meta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.conn-meta-tag {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(43, 127, 255, 0.15);
    color: rgba(70, 150, 255, 0.9);
}

.connection-card-actions {
    display: flex;
    gap: 0.5rem;
}

.connection-metadata {
    margin-top: 1rem;
    border-top: 1px solid rgba(100, 160, 220, 0.12);
    padding-top: 0.75rem;
}

.metadata-toggle {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(100, 160, 220, 0.85);
    cursor: pointer;
    padding: 0.35rem 0;
}

.metadata-toggle:hover {
    color: rgba(226, 232, 240, 0.95);
}

.metadata-content {
    padding-top: 0.75rem;
}

.connection-card-footer {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(100, 160, 220, 0.08);
}

.textarea-field {
    min-height: 80px;
}

.checkbox-field {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.form-divider {
    height: 1px;
    background: rgba(100, 160, 220, 0.15);
    margin: 1.5rem 0;
}

.connect-help-grid {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.connect-help-card {
    padding: 1.25rem 1.5rem;
}

.connect-help-card h4 {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: rgba(226, 232, 240, 0.9);
}

.connect-help-card p {
    font-size: 0.85rem;
    color: rgba(100, 160, 220, 0.8);
    line-height: 1.55;
}

.empty-state-panel {
    padding: 3rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.empty-state-panel h3 {
    margin: 0;
    font-weight: 600;
}

/* ─── Auth Pages ─── */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-card {
    background: var(--surface-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-card .form-group {
    margin-bottom: 1rem;
}

.auth-card .form-group label {
    display: block;
    color: rgba(100, 160, 220, 0.9);
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.auth-card .form-group input,
.auth-card .form-group select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(100, 160, 220, 0.25);
    background: rgba(10, 18, 36, 0.7);
    color: var(--text);
    font-size: 0.92rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-card .form-group input:focus,
.auth-card .form-group select:focus {
    outline: none;
    border-color: rgba(43, 127, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.18);
}

.auth-card button[type="submit"] {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), #3b8bff);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.75rem;
    box-shadow: 0 12px 24px rgba(43, 127, 255, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-card button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(43, 127, 255, 0.4);
}

.auth-card .auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: rgba(100, 160, 220, 0.7);
}

.auth-card .auth-footer a {
    color: rgba(70, 150, 255, 0.9);
    text-decoration: none;
}

.auth-card .auth-footer a:hover {
    text-decoration: underline;
}

/* Flash messages */
.flash-messages {
    margin-bottom: 1rem;
}

.flash-messages .alert {
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 0.5rem;
}

.flash-messages .alert-danger {
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(248, 113, 113, 0.25);
}

.flash-messages .alert-success {
    background: rgba(52, 211, 153, 0.12);
    color: #86efac;
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.flash-messages .alert-info {
    background: rgba(96, 165, 250, 0.12);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.25);
}

/* ─── Admin Dashboard ─── */
.admin-container {
    max-width: 1000px;
    margin: 0 auto 4rem;
    padding: 0 1.5rem;
}

.admin-container h2 {
    margin-bottom: 1rem;
}

/* ─── Settings Page ─── */
.settings-container {
    max-width: 600px;
    margin: 0 auto 4rem;
    padding: 0 1.5rem;
}

@media (max-width: 600px) {
    .top-nav-inner {
        flex-direction: column;
        gap: 0.5rem;
        height: auto;
        padding: 0.75rem 0;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .auth-card {
        margin: 1rem;
        padding: 1.5rem;
    }

    .connection-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .workspace-header-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ═══════════════════════════════════════════════════════════════
   CREATIVE DESIGN SYSTEM — Mesh gradients, orbs, micro-interactions
   ═══════════════════════════════════════════════════════════════ */

/* ─── Animated Mesh Gradient Background ─── */
.mesh-gradient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(43, 127, 255, 0.12), transparent),
        radial-gradient(ellipse 60% 60% at 80% 20%, rgba(56, 189, 248, 0.1), transparent),
        radial-gradient(ellipse 50% 70% at 50% 80%, rgba(56, 142, 255, 0.08), transparent);
    animation: meshShift 20s ease-in-out infinite alternate;
}

@keyframes meshShift {
    0%   { filter: hue-rotate(0deg) blur(0px); }
    50%  { filter: hue-rotate(15deg) blur(0px); }
    100% { filter: hue-rotate(-10deg) blur(0px); }
}

/* ─── Floating Orbs ─── */
.floating-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.2;
    animation: orbFloat 15s ease-in-out infinite;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(43, 127, 255, 0.4), transparent 70%);
    top: 10%;
    left: 5%;
    animation-duration: 18s;
}

.orb-2 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.35), transparent 70%);
    top: 60%;
    right: 10%;
    animation-duration: 22s;
    animation-delay: -5s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(56, 142, 255, 0.3), transparent 70%);
    bottom: 15%;
    left: 40%;
    animation-duration: 16s;
    animation-delay: -8s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25%      { transform: translate(30px, -40px) scale(1.05); }
    50%      { transform: translate(-20px, 20px) scale(0.95); }
    75%      { transform: translate(15px, 30px) scale(1.02); }
}

/* ─── Card Hover Lift Effect ─── */
.card-hover-lift {
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                border-color 0.35s ease;
}

.card-hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--glow-primary);
    border-color: rgba(43, 127, 255, 0.35);
}

/* ─── Card Shine Effect ─── */
.card-shine {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.card-shine::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 180deg at 50% 50%,
        transparent 0deg,
        rgba(43, 127, 255, 0.06) 60deg,
        transparent 120deg,
        rgba(56, 189, 248, 0.04) 200deg,
        transparent 360deg
    );
    animation: shineRotate 12s linear infinite;
}

@keyframes shineRotate {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.path-card { position: relative; overflow: hidden; }
.path-card > *:not(.card-shine) { position: relative; z-index: 1; }

/* ─── Animate-in (scroll/load animations) ─── */
.animate-in {
    opacity: 0;
    transform: translateY(24px);
    animation: animateIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.45s; }

@keyframes animateIn {
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Logo Glow Ring ─── */
.hero-logo-animated {
    position: relative;
}

.logo-glow-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 90px;
    height: 90px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(43, 127, 255, 0.4),
        rgba(56, 189, 248, 0.3),
        rgba(56, 189, 248, 0.4),
        rgba(56, 142, 255, 0.3),
        rgba(43, 127, 255, 0.4)
    );
    filter: blur(18px);
    opacity: 0.6;
    animation: logoGlow 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes logoGlow {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 0.75; transform: translate(-50%, -50%) scale(1.15); }
}

/* ─── Button Glow Variant ─── */
.btn-glow {
    position: relative;
    overflow: hidden;
}

/* Animated shimmer sweep */
.btn-glow::before {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
    transform: skewX(-20deg);
    animation: btn-shimmer 2.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes btn-shimmer {
    0%   { left: -75%; }
    60%  { left: 130%; }
    100% { left: 130%; }
}

.btn-glow::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.6), rgba(6, 182, 212, 0.5));
    filter: blur(14px);
    opacity: 0.6;
    z-index: -1;
    transition: opacity 0.3s ease;
    animation: btn-pulse-glow 2.8s ease-in-out infinite;
}

@keyframes btn-pulse-glow {
    0%, 100% { opacity: 0.5; filter: blur(14px); }
    50%       { opacity: 0.85; filter: blur(20px); }
}

.btn-glow:hover::after {
    opacity: 1;
    animation: none;
    filter: blur(22px);
}

/* ─── Help Steps (How it works) ─── */
.help-step {
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
}

.help-step-number {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(43, 127, 255, 0.25), rgba(56, 189, 248, 0.2));
    border: 1px solid rgba(43, 127, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: rgba(199, 210, 254, 0.95);
    margin-bottom: 1rem;
}

.help-step h4 {
    margin-bottom: 0.5rem;
    color: rgba(226, 232, 240, 0.95);
    font-size: 1rem;
}

.help-step p {
    color: rgba(100, 160, 220, 0.85);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ─── Glass Card Enhanced ─── */
.glass-card {
    background: var(--surface-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--shadow-lg);
}

/* ─── Chat Attachment Styles ─── */
.chat-attachment-bar {
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(100, 160, 220, 0.1);
    background: rgba(4, 8, 20, 0.3);
}

.chat-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(43, 127, 255, 0.12);
    border: 1px solid rgba(43, 127, 255, 0.25);
    color: rgba(199, 210, 254, 0.9);
    font-size: 0.8rem;
    animation: chatFadeIn 0.25s ease;
}

.chat-attachment-remove {
    background: none;
    border: none;
    color: rgba(248, 113, 113, 0.8);
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.15rem;
    transition: color 0.2s;
}

.chat-attachment-remove:hover {
    color: rgba(248, 113, 113, 1);
}

.chat-attach-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.6rem;
    border: 1px solid rgba(100, 160, 220, 0.2);
    background: rgba(10, 18, 36, 0.5);
    color: rgba(100, 160, 220, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-attach-btn:hover {
    border-color: rgba(43, 127, 255, 0.5);
    color: rgba(199, 210, 254, 0.95);
    background: rgba(43, 127, 255, 0.12);
}

/* ─── Improved Nav ─── */
.top-nav {
    background: var(--nav-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 0 1.5rem;
    box-shadow: var(--nav-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-subtle);
}

/* ─── Improved Tabs ─── */
.tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.6rem 0.75rem;
    background: var(--tabs-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
}

.tab {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(100, 160, 220, 0.75);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    border: 1px solid transparent;
}

.tab.active {
    background: linear-gradient(135deg, rgba(43, 127, 255, 0.2), rgba(56, 189, 248, 0.15));
    color: rgba(226, 232, 240, 0.98);
    border-color: rgba(43, 127, 255, 0.3);
    box-shadow: 0 4px 16px rgba(43, 127, 255, 0.2);
}

.tab:hover:not(.active) {
    color: rgba(226, 232, 240, 0.9);
    background: rgba(100, 160, 220, 0.08);
}

/* ─── Improved Chat Bubbles ─── */
.chat-bubble.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(43, 127, 255, 0.3), rgba(56, 142, 255, 0.2));
    border: 1px solid rgba(43, 127, 255, 0.25);
    color: rgba(226, 232, 240, 0.95);
    border-bottom-right-radius: 0.25rem;
    box-shadow: 0 4px 12px rgba(43, 127, 255, 0.15);
}

.chat-bubble.assistant {
    align-self: flex-start;
    background: rgba(10, 18, 36, 0.7);
    border: 1px solid rgba(100, 160, 220, 0.15);
    color: rgba(203, 213, 225, 0.95);
    border-bottom-left-radius: 0.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ─── Chat document info bubble ─── */
.chat-bubble.document-info {
    align-self: flex-end;
    background: rgba(43, 127, 255, 0.08);
    border: 1px dashed rgba(43, 127, 255, 0.3);
    color: rgba(100, 160, 220, 0.85);
    font-size: 0.82rem;
    padding: 0.5rem 0.85rem;
    border-radius: 0.75rem;
}

/* ─── Improved Input Styles ─── */
.chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(100, 160, 220, 0.1);
    background: rgba(4, 8, 20, 0.5);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.chat-input {
    flex: 1;
    resize: none;
    background: rgba(10, 18, 36, 0.65);
    border: 1px solid rgba(100, 160, 220, 0.15);
    border-radius: 0.75rem;
    padding: 0.65rem 0.9rem;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 100px;
    overflow-y: auto;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: rgba(43, 127, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.08);
}

/* ─── Notification Toast Improved ─── */
.notification-toast {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-sm);
}

/* ─── Keyboard Shortcut Badge ─── */
kbd {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    background: rgba(10, 18, 36, 0.6);
    border: 1px solid rgba(100, 160, 220, 0.25);
    font-family: inherit;
    font-size: 0.8em;
    color: rgba(100, 160, 220, 0.85);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ═══════════════════════════════════════════════════════
   THEME TOGGLE BUTTON
   ═══════════════════════════════════════════════════════ */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border-medium);
    background: var(--glass-bg-light);
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s, transform 0.2s;
    color: var(--text-muted);
    flex-shrink: 0;
    padding: 0;
}

.theme-toggle:hover {
    background: var(--primary-glass);
    border-color: var(--border-accent);
    color: var(--primary);
    transform: scale(1.08);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform 0.35s ease;
}

.theme-toggle:hover svg {
    transform: rotate(25deg);
}

/* Hide/show correct icon per theme */
.theme-icon-sun  { display: none; }
.theme-icon-moon { display: block; }
[data-theme="light"] .theme-icon-sun  { display: block; }
[data-theme="light"] .theme-icon-moon { display: none; }


/* ═══════════════════════════════════════════════════════
   LIGHT THEME OVERRIDES — Elegant, clean, refined
   ═══════════════════════════════════════════════════════ */

/* ── Remove all dark decorative layers ── */
[data-theme="light"] .floating-orbs,
[data-theme="light"] .mesh-gradient,
[data-theme="light"] .background {
    display: none !important;
}

[data-theme="light"] .background::before,
[data-theme="light"] .background::after {
    display: none !important;
}

/* ── Body: clean white ── */
[data-theme="light"] body {
    background: #ffffff !important;
    color: var(--text);
}

/* ── Glass card: no blur needed on solid white ── */
[data-theme="light"] .glass-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 1px 3px rgba(10, 18, 36, 0.04), 0 8px 24px rgba(10, 18, 36, 0.04);
}

[data-theme="light"] .glass-card:hover {
    box-shadow: 0 1px 3px rgba(10, 18, 36, 0.06), 0 12px 32px rgba(10, 18, 36, 0.06);
}

/* ── Card shine: much subtler ── */
[data-theme="light"] .card-shine::before {
    opacity: 0;
}

/* ── Card hover lift ── */
[data-theme="light"] .card-hover-lift:hover {
    box-shadow: 0 8px 32px rgba(10, 18, 36, 0.08);
    border-color: rgba(43, 127, 255, 0.2);
}

/* ── Brand lockup ── */
[data-theme="light"] .brand-lockup {
    background: linear-gradient(135deg, rgba(43, 127, 255, 0.04), rgba(56, 189, 248, 0.03));
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    backdrop-filter: none;
}

[data-theme="light"] .brand-lockup::after {
    opacity: 0;
}

[data-theme="light"] .brand-icon {
    background: #f8fafc;
    border: 1px solid var(--border-strong);
    box-shadow: inset 0 0 0 1px rgba(43, 127, 255, 0.1), 0 2px 8px rgba(10, 18, 36, 0.06);
}

[data-theme="light"] .brand-icon::before {
    opacity: 0.3;
}

[data-theme="light"] .brand-orbit {
    border-color: rgba(43, 127, 255, 0.15);
    box-shadow: 0 0 8px rgba(43, 127, 255, 0.08);
}

[data-theme="light"] .brand-initial {
    color: var(--primary);
    text-shadow: none;
}

[data-theme="light"] .brand-name {
    color: var(--text-strong);
}

[data-theme="light"] .brand-tagline {
    color: var(--text-fainter);
}

/* ── Nav bar ── */
[data-theme="light"] .top-nav {
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--nav-shadow);
    border-bottom: 1px solid var(--border);
}

[data-theme="light"] .nav-wordmark {
    color: var(--text-strong);
}

[data-theme="light"] .nav-links a {
    color: var(--text-faint);
}

[data-theme="light"] .nav-links a:hover {
    background: rgba(10, 18, 36, 0.04);
    color: var(--text-body);
}

[data-theme="light"] .nav-active {
    background: rgba(43, 127, 255, 0.06) !important;
    color: var(--primary) !important;
}

[data-theme="light"] .nav-admin-link {
    color: #b45309 !important;
}
[data-theme="light"] .nav-admin-link:hover {
    color: #92400e !important;
    background: rgba(180, 83, 9, 0.04) !important;
}

[data-theme="light"] .nav-user {
    color: var(--text-fainter);
}

/* ── Hero text ── */
[data-theme="light"] .hero-title {
    color: var(--text-strong);
}

[data-theme="light"] .hero-brand-name {
    color: var(--text-strong);
}

[data-theme="light"] .hero-brand-tagline {
    color: var(--text-faintest);
}

[data-theme="light"] .hero-subtitle {
    color: var(--text-faint);
}

[data-theme="light"] .hero-subtitle.subtle {
    color: var(--text-fainter);
}

/* ── Logo glow ring ── */
[data-theme="light"] .logo-glow-ring {
    opacity: 0.2;
    filter: blur(24px);
}

/* ── Source pill ── */
[data-theme="light"] .source-pill {
    background: #f8fafc;
    border: 1px solid var(--border);
}

[data-theme="light"] .pill-label {
    color: var(--text-fainter);
}

[data-theme="light"] .pill-value {
    color: var(--text-strong);
}

/* ── Path cards ── */
[data-theme="light"] .path-card {
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

[data-theme="light"] .path-card:hover {
    border-color: rgba(43, 127, 255, 0.15);
    box-shadow: 0 8px 32px rgba(10, 18, 36, 0.06);
}

[data-theme="light"] .path-footer {
    border-top: 1px solid var(--border);
    color: var(--text-fainter);
}

[data-theme="light"] .path-badge {
    background: rgba(43, 127, 255, 0.06);
    color: var(--primary);
}

[data-theme="light"] .path-badge-alt {
    background: rgba(56, 189, 248, 0.06);
    color: var(--secondary);
}

/* ── Preview card ── */
[data-theme="light"] .preview-card {
    background: linear-gradient(160deg, rgba(43, 127, 255, 0.04), rgba(56, 189, 248, 0.03));
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    backdrop-filter: none;
}

[data-theme="light"] .preview-title {
    color: var(--text-faint);
}

[data-theme="light"] .preview-list {
    color: var(--text-body);
}

/* ── Tabs ── */
[data-theme="light"] .tabs {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    backdrop-filter: none;
}

[data-theme="light"] .tab {
    color: var(--text-fainter);
}

[data-theme="light"] .tab.active {
    background: #ffffff;
    color: var(--primary);
    border-color: var(--border);
    box-shadow: 0 1px 4px rgba(10, 18, 36, 0.04);
}

[data-theme="light"] .tab:hover:not(.active) {
    color: var(--text-body);
    background: rgba(10, 18, 36, 0.02);
}

/* ── Tab content / result containers ── */
[data-theme="light"] .result-container {
    border: 1px solid var(--border);
    background: #ffffff;
}

[data-theme="light"] .tab-content {
    color: var(--text);
}

/* ── Panel ── */
[data-theme="light"] .panel-header h2 {
    color: var(--text-strong);
}

[data-theme="light"] .panel-header p {
    color: var(--text-faint);
}

/* ── Query input area ── */
[data-theme="light"] textarea {
    background: #ffffff;
    border: 1px solid var(--border-strong);
    color: var(--text);
}

[data-theme="light"] textarea:focus {
    border-color: rgba(43, 127, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.06);
}

[data-theme="light"] textarea::placeholder {
    color: var(--text-fainter);
}

/* ── Schema ── */
[data-theme="light"] .schema-visual-wrapper {
    background: #f8fafc;
    border: 1px solid var(--border);
}

[data-theme="light"] .schema-card {
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

[data-theme="light"] .schema-card-title {
    color: var(--text-strong);
}

[data-theme="light"] .schema-table-badge {
    background: rgba(43, 127, 255, 0.06);
    color: var(--primary);
}

[data-theme="light"] .schema-column-item {
    background: rgba(43, 127, 255, 0.03);
}

[data-theme="light"] .schema-column-name {
    color: var(--text-body);
}

[data-theme="light"] .schema-column-type {
    color: var(--text-faint);
}

[data-theme="light"] .schema-constraint {
    background: rgba(219, 39, 119, 0.06);
    color: #be185d;
}

/* ── KPI cards ── */
[data-theme="light"] .kpi-card {
    background: #ffffff;
    border: 1px solid var(--border);
    backdrop-filter: none;
    box-shadow: var(--shadow-card);
}

[data-theme="light"] .kpi-label {
    color: var(--text-fainter);
}

[data-theme="light"] .kpi-value {
    color: var(--text-strong);
}

[data-theme="light"] .kpi-subtext {
    color: var(--text-faint);
}

/* ── Chart cards ── */
[data-theme="light"] .chart-card {
    background: #ffffff;
    border: 1px solid var(--border);
    backdrop-filter: none;
    box-shadow: var(--shadow-card);
}

[data-theme="light"] .chart-card h3 {
    color: var(--text-strong);
}

[data-theme="light"] .chart-remove-btn {
    background: rgba(43, 127, 255, 0.06);
    color: var(--text-faint);
}

[data-theme="light"] .chart-remove-btn:hover {
    background: rgba(43, 127, 255, 0.12);
    color: var(--primary);
}

/* ── Dashboard ── */
[data-theme="light"] .dashboard-content {
    border: 1px dashed var(--border-strong);
    background: #f8fafc;
}

[data-theme="light"] .dashboard-content:hover {
    border-color: rgba(43, 127, 255, 0.25);
    background: #f1f5f9;
}

[data-theme="light"] .dashboard-controls select {
    background: #ffffff;
    border: 1px solid var(--border-strong);
    color: var(--text);
}

[data-theme="light"] .dashboard-controls select:focus {
    border-color: rgba(43, 127, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.06);
}

[data-theme="light"] .control-group label {
    color: var(--text-body);
}

[data-theme="light"] .control-hint,
[data-theme="light"] .control-summary {
    color: var(--text-faint);
}

[data-theme="light"] .dashboard-block-header h3 {
    color: var(--text-strong);
}

[data-theme="light"] .dashboard-block-header p {
    color: var(--text-faint);
}

[data-theme="light"] .suggestion-pill {
    border: 1px solid rgba(43, 127, 255, 0.15);
    background: rgba(43, 127, 255, 0.04);
    color: var(--primary);
}

[data-theme="light"] .suggestion-pill:hover {
    background: rgba(43, 127, 255, 0.08);
    box-shadow: 0 4px 12px rgba(43, 127, 255, 0.08);
}

[data-theme="light"] .dashboard-empty {
    border: 1px dashed var(--border-strong);
    background: #f8fafc;
}

[data-theme="light"] .dashboard-note {
    color: var(--text-fainter);
}

/* ── SQL display / code blocks ── */
[data-theme="light"] .sql-container {
    background: #f8fafc;
    border: 1px solid var(--border);
}

[data-theme="light"] pre,
[data-theme="light"] code {
    background: #f8fafc;
    color: var(--text);
}

[data-theme="light"] .sql-container pre,
[data-theme="light"] .sql-container code,
[data-theme="light"] .sql-container code.hljs,
[data-theme="light"] .sql-container pre code {
    background: transparent !important;
    color: var(--text);
}

/* ── Data table ── */
[data-theme="light"] .data-table {
    background: #ffffff;
}

[data-theme="light"] .data-table thead {
    background: #f1f5f9;
}

[data-theme="light"] .data-table th {
    color: var(--text-strong);
    border-bottom: 2px solid var(--border-strong);
}

[data-theme="light"] .data-table td {
    border-bottom: 1px solid var(--border);
    color: var(--text-body);
}

[data-theme="light"] .data-table tr:hover {
    background: rgba(43, 127, 255, 0.02);
}

[data-theme="light"] table {
    border-collapse: collapse;
}

[data-theme="light"] th {
    background: #f1f5f9;
    color: var(--text-strong);
    border-bottom: 2px solid var(--border-strong);
}

[data-theme="light"] td {
    border-bottom: 1px solid var(--border);
    color: var(--text-body);
}

[data-theme="light"] tr:hover td {
    background: rgba(43, 127, 255, 0.02);
}

/* ── Admin table ── */
[data-theme="light"] .admin-table thead {
    background: #f1f5f9;
}

[data-theme="light"] .admin-table th {
    color: var(--text-faint);
    border-bottom: 2px solid var(--border-strong);
}

[data-theme="light"] .admin-table td {
    color: var(--text-body);
    border-bottom: 1px solid var(--border);
}

[data-theme="light"] .admin-table tr:hover {
    background: rgba(43, 127, 255, 0.02);
}

/* ── Badges ── */
[data-theme="light"] .badge-success { background: rgba(16, 185, 129, 0.08); color: #059669; }
[data-theme="light"] .badge-error   { background: rgba(239, 68, 68, 0.08); color: #dc2626; }
[data-theme="light"] .badge-info    { background: rgba(56, 189, 248, 0.08); color: #0284c7; }
[data-theme="light"] .badge-warning { background: rgba(245, 158, 11, 0.08); color: #d97706; }

/* ── Empty state ── */
[data-theme="light"] .empty-state {
    color: var(--text-fainter);
}

/* ── Analysis section ── */
[data-theme="light"] .analysis-section {
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

[data-theme="light"] .analysis-section h3 {
    color: var(--text-strong);
}

[data-theme="light"] .analysis-content {
    color: var(--text-body);
}

/* ── Chat bubbles ── */
[data-theme="light"] .chat-bubble.user {
    background: var(--chat-user-bg);
    border: 1px solid rgba(43, 127, 255, 0.12);
    color: var(--text-strong);
    box-shadow: 0 1px 4px rgba(43, 127, 255, 0.04);
}

[data-theme="light"] .chat-bubble.assistant {
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text-body);
    box-shadow: 0 1px 4px rgba(10, 18, 36, 0.03);
}

[data-theme="light"] .chat-bubble.assistant strong {
    color: var(--text-strong);
}

[data-theme="light"] .chat-bubble.assistant code {
    background: rgba(43, 127, 255, 0.06);
    color: var(--primary);
}

[data-theme="light"] .chat-bubble.document-info {
    background: rgba(43, 127, 255, 0.03);
    border: 1px dashed rgba(43, 127, 255, 0.15);
    color: var(--text-faint);
}

[data-theme="light"] .chat-bubble.typing {
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text-fainter);
}

[data-theme="light"] .chat-welcome-title {
    color: var(--text-strong);
}

[data-theme="light"] .chat-welcome-subtitle {
    color: var(--text-faint);
}

[data-theme="light"] .chat-suggestion-chip {
    background: rgba(43, 127, 255, 0.04);
    border: 1px solid rgba(43, 127, 255, 0.12);
    color: var(--primary);
}

[data-theme="light"] .chat-suggestion-chip:hover {
    background: rgba(43, 127, 255, 0.08);
    border-color: rgba(43, 127, 255, 0.2);
}

/* ── Chat input ── */
[data-theme="light"] .chat-input-bar {
    border-top: 1px solid var(--border);
    background: #ffffff;
}

[data-theme="light"] .chat-input {
    background: #f8fafc;
    border: 1px solid var(--border-strong);
    color: var(--text);
}

[data-theme="light"] .chat-input:focus {
    border-color: rgba(43, 127, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.06);
}

[data-theme="light"] .chat-input::placeholder {
    color: var(--text-fainter);
}

/* ── Chat attachment ── */
[data-theme="light"] .chat-attachment-bar {
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

[data-theme="light"] .chat-attachment-chip {
    background: rgba(43, 127, 255, 0.06);
    border: 1px solid rgba(43, 127, 255, 0.12);
    color: var(--primary);
}

[data-theme="light"] .chat-attach-btn {
    border: 1px solid var(--border-strong);
    background: #ffffff;
    color: var(--text-faint);
}

[data-theme="light"] .chat-attach-btn:hover {
    border-color: rgba(43, 127, 255, 0.25);
    color: var(--primary);
    background: rgba(43, 127, 255, 0.04);
}

/* ── Upload drop zone ── */
[data-theme="light"] .upload-drop-zone,
[data-theme="light"] #uploadDropZone {
    border-color: var(--border-strong);
    background: #f8fafc;
}

[data-theme="light"] .upload-drop-zone:hover,
[data-theme="light"] .upload-drop-zone.drag-active {
    border-color: var(--primary);
    background: rgba(43, 127, 255, 0.03);
}

/* ── Uploaded tables bar / chips ── */
[data-theme="light"] .uploaded-tables-bar {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

[data-theme="light"] .table-chip {
    background: rgba(43, 127, 255, 0.06);
    border: 1px solid rgba(43, 127, 255, 0.12);
}

[data-theme="light"] .table-chip:hover {
    background: rgba(43, 127, 255, 0.1);
    border-color: rgba(43, 127, 255, 0.2);
}

[data-theme="light"] .table-chip-name {
    color: var(--primary);
}

[data-theme="light"] .table-chip-meta {
    color: var(--text-faint);
}

[data-theme="light"] .table-collection {
    background: rgba(43, 127, 255, 0.02);
    border: 1px solid var(--border);
}

[data-theme="light"] .collection-label {
    color: var(--primary);
}

/* ── Form inputs ── */
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] select {
    background: #ffffff;
    border: 1px solid var(--border-strong);
    color: var(--text);
}

[data-theme="light"] .form-group input:focus,
[data-theme="light"] .form-group select:focus,
[data-theme="light"] .form-group textarea:focus,
[data-theme="light"] input:focus,
[data-theme="light"] select:focus {
    border-color: rgba(43, 127, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.06);
}

[data-theme="light"] label {
    color: var(--text-body);
}

[data-theme="light"] .field-help {
    color: var(--text-fainter);
}

[data-theme="light"] .required {
    color: #ea580c;
}

/* ── Connect page ── */
[data-theme="light"] .connect-mode-tabs {
    background: #f8fafc;
    border: 1px solid var(--border);
}

[data-theme="light"] .connect-mode-tab {
    color: var(--text-faint);
}

[data-theme="light"] .connect-mode-tab:hover {
    color: var(--text-body);
    background: rgba(43, 127, 255, 0.03);
}

[data-theme="light"] .connect-mode-tab.active {
    background: rgba(43, 127, 255, 0.06);
    color: var(--primary);
    box-shadow: inset 0 -2px 0 var(--primary);
}

[data-theme="light"] .test-result-panel.test-success {
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.15);
    color: #065f46;
}

[data-theme="light"] .test-result-panel.test-error {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #991b1b;
}

[data-theme="light"] .test-table-item {
    background: #f8fafc;
}

[data-theme="light"] .test-table-name {
    color: var(--secondary);
}

[data-theme="light"] .auto-meta-section {
    background: rgba(43, 127, 255, 0.03);
    border: 1px solid rgba(43, 127, 255, 0.1);
}

[data-theme="light"] .auto-meta-section h3 {
    color: var(--primary);
}

[data-theme="light"] .auto-meta-preview {
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text-faint);
}

/* ── Buttons ── */
[data-theme="light"] .btn-primary {
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35), 0 6px 24px rgba(43, 127, 255, 0.2);
}

[data-theme="light"] .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5), 0 10px 32px rgba(6, 182, 212, 0.25);
}

[data-theme="light"] .btn-secondary {
    background: #f1f5f9;
    border: 1px solid var(--border-strong);
    color: var(--text-body);
}

[data-theme="light"] .btn-secondary:hover {
    background: #e2e8f0;
}

[data-theme="light"] .btn-outline {
    border: 1px solid rgba(43, 127, 255, 0.2);
    color: var(--primary);
}

[data-theme="light"] .btn-outline:hover {
    background: rgba(43, 127, 255, 0.04);
}

[data-theme="light"] .btn-ghost {
    background: transparent;
    color: var(--text-faint);
    border-color: transparent;
}

[data-theme="light"] .btn-ghost:hover {
    background: #f1f5f9;
    color: var(--text-body);
    border-color: var(--border);
}

[data-theme="light"] .btn-danger {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

[data-theme="light"] .btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

[data-theme="light"] .btn-glow::after {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(6, 182, 212, 0.35));
    opacity: 0.45;
}

[data-theme="light"] .btn-glow::before {
    background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.45) 50%, transparent 100%);
}

/* ── Arrow / flow ── */
[data-theme="light"] .flow-arrow {
    color: var(--text-fainter);
}

[data-theme="light"] .arrow-icon {
    background: rgba(43, 127, 255, 0.06);
    color: var(--primary);
}

[data-theme="light"] .flow-connector::before {
    background: linear-gradient(180deg, rgba(43, 127, 255, 0.2), rgba(43, 127, 255, 0.04));
}

/* ── Auth card ── */
[data-theme="light"] .auth-card {
    background: #ffffff;
    border: 1px solid var(--border);
    backdrop-filter: none;
    box-shadow: 0 8px 32px rgba(10, 18, 36, 0.06);
}

[data-theme="light"] .auth-card .form-group label {
    color: var(--text-faint);
}

[data-theme="light"] .auth-card .form-group input,
[data-theme="light"] .auth-card .form-group select {
    background: #f8fafc;
    border: 1px solid var(--border-strong);
    color: var(--text);
}

[data-theme="light"] .auth-card .form-group input:focus,
[data-theme="light"] .auth-card .form-group select:focus {
    border-color: rgba(43, 127, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.06);
}

[data-theme="light"] .auth-card button[type="submit"] {
    box-shadow: 0 4px 12px rgba(43, 127, 255, 0.2);
}

[data-theme="light"] .auth-card .auth-footer {
    color: var(--text-fainter);
}

[data-theme="light"] .auth-card .auth-footer a {
    color: var(--primary);
}

/* ── Anomaly section ── */
[data-theme="light"] .anomaly-selector {
    background: #f8fafc;
    border: 1px solid var(--border);
}

[data-theme="light"] .anomaly-selector label {
    color: var(--text-fainter);
}

[data-theme="light"] .anomaly-selector select {
    color: var(--text-strong);
}

[data-theme="light"] .anomaly-summary {
    background: #f8fafc;
    border: 1px solid var(--border);
}

[data-theme="light"] .anomaly-summary h3 {
    color: var(--text-strong);
}

[data-theme="light"] .anomaly-summary-text {
    color: var(--text-body);
}

[data-theme="light"] .anomaly-stat {
    background: #ffffff;
    border: 1px solid var(--border);
}

[data-theme="light"] .anomaly-stat-label {
    color: var(--text-fainter);
}

[data-theme="light"] .anomaly-stat-value {
    color: var(--text-strong);
}

[data-theme="light"] .anomaly-list-item {
    background: #f8fafc;
    border: 1px solid var(--border);
}

[data-theme="light"] .anomaly-chip {
    background: rgba(43, 127, 255, 0.06);
    color: var(--primary);
}

[data-theme="light"] .anomaly-z {
    color: var(--text-faint);
}

[data-theme="light"] .anomaly-detail-list {
    color: var(--text-body);
}

[data-theme="light"] .anomaly-detail-list dt {
    color: var(--text-fainter);
}

/* ── Anomaly modal ── */
[data-theme="light"] .anomaly-modal-checkbox {
    background: #f8fafc;
    border: 1px solid var(--border);
}

[data-theme="light"] .anomaly-filter-row {
    background: #f8fafc;
    border: 1px solid var(--border);
}

[data-theme="light"] .anomaly-filter-column,
[data-theme="light"] .anomaly-filter-value,
[data-theme="light"] .anomaly-modal-input,
[data-theme="light"] .anomaly-modal-card select {
    background: #ffffff;
    border: 1px solid var(--border-strong);
    color: var(--text);
}

[data-theme="light"] .anomaly-modal-label {
    color: var(--text-body);
}

[data-theme="light"] .anomaly-filter-remove {
    background: rgba(239, 68, 68, 0.06);
    color: #dc2626;
}

[data-theme="light"] .anomaly-filter-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ── Connection cards ── */
[data-theme="light"] .connection-card-name {
    color: var(--text-strong);
}

[data-theme="light"] .connection-card-meta .conn-meta-tag {
    background: rgba(43, 127, 255, 0.06);
    color: var(--primary);
}

[data-theme="light"] .connection-metadata {
    border-top: 1px solid var(--border);
}

[data-theme="light"] .metadata-toggle {
    color: var(--text-faint);
}

[data-theme="light"] .metadata-toggle:hover {
    color: var(--text-body);
}

/* ── Saved connections ── */
[data-theme="light"] .saved-conn-info h4 {
    color: var(--text-strong);
}

[data-theme="light"] .saved-conn-meta {
    color: var(--text-faint);
}

/* ── Help steps ── */
[data-theme="light"] .help-step-number {
    background: linear-gradient(135deg, rgba(43, 127, 255, 0.08), rgba(56, 189, 248, 0.06));
    border: 1px solid rgba(43, 127, 255, 0.15);
    color: var(--primary);
}

[data-theme="light"] .help-step h4 {
    color: var(--text-strong);
}

[data-theme="light"] .help-step p {
    color: var(--text-faint);
}

/* ── Connect help cards ── */
[data-theme="light"] .connect-help-card h4 {
    color: var(--text-body);
}

[data-theme="light"] .connect-help-card p {
    color: var(--text-faint);
}

/* ── Source help text ── */
[data-theme="light"] .source-help-grid h4 {
    color: var(--text-body);
}

/* ── Role badges ── */
[data-theme="light"] .role-admin {
    background: rgba(43, 127, 255, 0.06);
    color: var(--primary);
}

[data-theme="light"] .role-user {
    background: rgba(100, 116, 139, 0.06);
    color: var(--text-faint);
}

/* ── Status dots ── */
[data-theme="light"] .status-active {
    background: var(--success);
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.3);
}

/* ── kbd / shortcuts ── */
[data-theme="light"] kbd {
    background: #f1f5f9;
    border: 1px solid var(--border-strong);
    color: var(--text-faint);
    box-shadow: 0 1px 2px rgba(10, 18, 36, 0.04);
}

/* ── Footer ── */
[data-theme="light"] .site-footer {
    border-top: 1px solid var(--border);
    color: var(--text-fainter);
}

/* ── Text utilities ── */
[data-theme="light"] .text-link {
    color: var(--primary);
}

[data-theme="light"] .text-link:hover {
    color: var(--primary-dark);
}

[data-theme="light"] .text-muted {
    color: var(--text-faint);
}

[data-theme="light"] .back-link {
    color: var(--text-fainter);
}

[data-theme="light"] .back-link:hover {
    color: var(--text-body);
}

/* ── Section labels ── */
[data-theme="light"] .section-label {
    color: var(--text-fainter);
}

/* ── Detail labels ── */
[data-theme="light"] .detail-label {
    color: var(--text-fainter);
}

/* ── Empty state icons (softer tints) ── */
[data-theme="light"] .empty-icon-sql {
    background: rgba(43, 127, 255, 0.06);
    border-color: rgba(43, 127, 255, 0.12);
}

[data-theme="light"] .empty-icon-results {
    background: rgba(56, 189, 248, 0.06);
    border-color: rgba(56, 189, 248, 0.12);
}

[data-theme="light"] .empty-icon-analysis {
    background: rgba(56, 142, 255, 0.06);
    border-color: rgba(56, 142, 255, 0.12);
}

[data-theme="light"] .empty-icon-forecast {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.12);
}

/* ── Alerts ── */
[data-theme="light"] .alert-error,
[data-theme="light"] .flash-messages .alert-danger {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #991b1b;
}

[data-theme="light"] .alert-success,
[data-theme="light"] .flash-messages .alert-success {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
    color: #065f46;
}

[data-theme="light"] .alert-info,
[data-theme="light"] .flash-messages .alert-info {
    background: rgba(56, 189, 248, 0.05);
    border: 1px solid rgba(56, 189, 248, 0.15);
    color: #0c4a6e;
}

/* ── Form divider ── */
[data-theme="light"] .form-divider {
    background: var(--border);
}

/* ── Scrollbar ── */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: transparent;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(10, 18, 36, 0.12);
    border-radius: 999px;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(10, 18, 36, 0.2);
}

/* ── Highlight.js override for light ── */
[data-theme="light"] .hljs {
    background: #f8fafc !important;
    color: var(--text) !important;
}

/* ── Notification toast ── */
[data-theme="light"] .notification-toast {
    backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    color: var(--text-body);
}

/* ── Smooth transition for theme switch ── */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 0.35s ease,
                color 0.35s ease,
                border-color 0.35s ease,
                box-shadow 0.35s ease !important;
}