/* minusonedb Console - Styles
   Dark mode, developer-focused aesthetic with Databricks polish */

/* ================================
   CSS Variables & Theme
   ================================ */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-elevated: #1f1f23;
    --bg-hover: #27272a;
    --bg-active: #2d2d32;

    --border-subtle: #27272a;
    --border-default: #3f3f46;
    --border-strong: #52525b;

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-disabled: #52525b;

    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-primary-muted: rgba(59, 130, 246, 0.15);

    --accent-success: #22c55e;
    --accent-success-muted: rgba(34, 197, 94, 0.15);

    --accent-warning: #f59e0b;
    --accent-warning-muted: rgba(245, 158, 11, 0.15);

    --accent-danger: #ef4444;
    --accent-danger-muted: rgba(239, 68, 68, 0.15);

    --accent-purple: #6C2BD9;
    --accent-purple-muted: rgba(168, 85, 247, 0.15);

    /* Ops-sidebar palette (theme-aware) */
    --ops-sidebar-bg: #0c1218;
    --ops-sidebar-border: #1e2a36;
    --ops-sidebar-active-bg: rgba(6, 182, 212, 0.1);
    --ops-sidebar-active-text: #06b6d4;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.875rem;
    --text-lg: 1rem;
    --text-xl: 1.125rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Layout */
    --sidebar-width: 240px;
    --header-height: 64px;
    --border-radius-sm: 4px;
    --border-radius: 6px;
    --border-radius-lg: 8px;
    --border-radius-xl: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);

    /* Transitions */
    --transition-fast: 0.1s ease;
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* Ops mode — utilitarian management console (the dealership) */
[data-app-mode="ops"] {
    --accent-primary: #06b6d4;
    --accent-primary-hover: #0891b2;
    --accent-primary-muted: rgba(6, 182, 212, 0.15);
}

[data-app-mode="ops"] .sidebar {
    background: var(--ops-sidebar-bg);
    border-right-color: var(--ops-sidebar-border);
}

[data-app-mode="ops"] .sidebar-header {
    border-bottom-color: var(--ops-sidebar-border);
}

[data-app-mode="ops"] .nav-item.active {
    background: var(--ops-sidebar-active-bg);
    color: var(--ops-sidebar-active-text);
}

[data-app-mode="ops"] .sidebar-footer {
    border-top-color: var(--ops-sidebar-border);
}

[data-app-mode="ops"] .btn-primary {
    background: #06b6d4;
}

[data-app-mode="ops"] .btn-primary:hover {
    background: #0891b2;
}

/* Ops login — functional, management-oriented */
.ops-login-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.ops-login-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    color: #06b6d4;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--border-radius);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: var(--space-4);
}

.ops-login-subtitle {
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
}

[data-app-mode="ops"] .auth-tab.active {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
}

/* Environment mode — branded, polished (the car — where users live) */
/* Env keeps the default blue accent, full branding */

[data-app-mode="env"] .sidebar-logo .logo-wordmark {
    display: none;
}

.env-name-label {
    display: none;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent-primary);
    letter-spacing: 0.02em;
}

[data-app-mode="env"] .sidebar-logo .env-name-label {
    display: inline-block;
}

[data-app-mode="env"] .sidebar-logo .env-health-dot {
    display: inline-block;
}

[data-app-mode="env"] .sidebar-logo.env-health-link {
    cursor: pointer;
}

[data-app-mode="env"] .sidebar-logo.env-health-link:hover .env-name-label {
    color: #93c5fd;
}

/* Env login page — branded with env identity */
.env-login-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.env-login-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--accent-primary);
    background: var(--accent-primary-muted);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--border-radius);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: var(--space-4);
}

.env-login-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: var(--space-3) 0 var(--space-2);
    font-family: 'JetBrains Mono', monospace;
}

.env-login-subtitle {
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

/* Light theme (for completeness, default is dark) */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-active: #e2e8f0;

    --border-subtle: #e2e8f0;
    --border-default: #cbd5e1;
    --border-strong: #94a3b8;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-disabled: #94a3b8;

    --ops-sidebar-bg: #f8fafc;
    --ops-sidebar-border: #dbe5ef;
    --ops-sidebar-active-bg: rgba(6, 182, 212, 0.16);
    --ops-sidebar-active-text: #0e7490;
}

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

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

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

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

a:hover {
    text-decoration: underline;
}

code, pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

code {
    background: var(--bg-tertiary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--border-radius-sm);
    color: var(--accent-purple);
}

pre {
    background: var(--bg-tertiary);
    padding: var(--space-4);
    border-radius: var(--border-radius);
    overflow-x: auto;
}

/* ================================
   Loading Screen
   ================================ */
.loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 9999;
}

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

.loading-logo,
.auth-logo {
    margin-bottom: var(--space-4);
    text-align: center;
}

.auth-logo .logo-image {
    max-width: 160px;
}

.loading-logo .logo-image {
    max-width: 120px;
}

.logo-minus {
    color: var(--accent-primary);
}

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

.logo-image {
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.logo-image-small {
    max-width: 120px;
    height: auto;
    display: block;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

/* ================================
   Auth Screen
   ================================ */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at top, rgba(59, 130, 246, 0.1), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(168, 85, 247, 0.08), transparent 50%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: var(--space-8);
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-logo {
    font-size: var(--text-3xl);
    font-weight: 700;
    margin-bottom: var(--space-4);
}

.auth-header h1 {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.auth-subtitle {
    color: var(--text-secondary);
}

.env-login-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.5rem 0 0;
    font-family: 'JetBrains Mono', monospace;
}

.auth-tabs {
    display: flex;
    gap: var(--space-1);
    background: var(--bg-secondary);
    padding: var(--space-1);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--space-6);
}

.auth-tab {
    flex: 1;
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.auth-tab.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-group label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: var(--text-base);
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
}

.form-group-checkbox {
    flex-direction: row;
    align-items: center;
}
.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}
.form-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.auth-help, .auth-terms {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

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

.demo-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
}

.demo-panel h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.demo-panel p {
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.demo-features {
    list-style: none;
    text-align: left;
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

.demo-features li {
    padding: var(--space-2) 0;
    padding-left: var(--space-6);
    position: relative;
    color: var(--text-secondary);
}

.demo-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-success);
}

.demo-buttons { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-4); }

/* ================================
   Buttons
   ================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

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

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

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

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

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

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

.btn-danger {
    background: var(--accent-danger);
    color: white;
}

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

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
}

.btn-icon {
    padding: var(--space-2);
    width: 32px;
    height: 32px;
}

/* ================================
   App Layout
   ================================ */
.app {
    display: flex;
    min-height: 100vh;
    overflow: hidden;  /* Constrain child content */
}

.hidden {
    display: none !important;
}

/* ================================
   Sidebar
   ================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    z-index: 100;
}

.sidebar-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.sidebar-logo .logo-icon {
    width: 28px;
    height: 28px;
}

.logo-wordmark {
    font-family: 'Satoshi', var(--font-sans);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-1);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

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

.nav-item.active {
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
}

/* Emphasize Query Studio + AELTL in the sidebar */
.nav-item[data-view="query"] > span:first-of-type,
.nav-item[data-view="eltl"] > span:first-of-type {
    color: var(--accent-primary);
    font-weight: 700;
}

.nav-item[data-view="query"] .nav-icon,
.nav-item[data-view="eltl"] .nav-icon {
    color: var(--accent-primary);
}

.nav-item.nav-disabled {
    opacity: 0.35;
    pointer-events: none;
    cursor: default;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    padding: 2px 6px;
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--accent-primary);
    color: white;
    border-radius: 10px;
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

/* Environment Selector */
.env-selector {
    position: relative;
    margin-bottom: var(--space-4);
}

.env-current {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.env-current:hover {
    border-color: var(--border-strong);
}

.env-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
}

.env-status.online {
    background: var(--accent-success);
}

.env-status.deleting {
    background: #f59e0b;
    animation: m1StatusPulse 1.1s ease-in-out infinite;
}

.env-name {
    flex: 1;
    font-size: var(--text-sm);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.env-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

.env-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: var(--space-2);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow: hidden;
}

.env-search {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}

.env-search input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.env-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.env-list {
    max-height: 200px;
    overflow-y: auto;
    padding: var(--space-2);
}

.env-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

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

.env-item.selected {
    background: var(--accent-primary-muted);
}

.env-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-3);
    background: transparent;
    border: none;
    border-top: 1px solid var(--border-subtle);
    color: var(--accent-primary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.env-add:hover {
    background: var(--accent-primary-muted);
}

.env-add svg {
    width: 16px;
    height: 16px;
}

.env-health-dot {
    display: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-tertiary);
}

.env-health-dot.ok {
    background: var(--accent-success);
}

.env-health-dot.warn {
    background: var(--accent-warning);
}

.env-health-dot.bad {
    background: var(--accent-danger);
}

.env-health-dot.unknown {
    background: var(--text-tertiary);
}

/* User Menu */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.user-menu:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary-muted);
    border-radius: 50%;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent-primary);
}

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

.user-name {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-account {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.user-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

.user-menu.open {
    background: var(--bg-hover);
}

.user-menu.open .user-chevron {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + var(--space-2));
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-2);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 120;
}

.user-menu-item {
    width: 100%;
    border: none;
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: var(--text-sm);
    text-align: left;
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    transition: var(--transition);
}

.user-menu-item:hover {
    background: var(--bg-hover);
}

.user-menu-item.danger {
    color: var(--error);
}

/* ================================
   Main Content
   ================================ */
.main-content {
    flex: 1;
    min-width: 0;  /* Required for flex child to shrink below content width */
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-primary);
    overflow: hidden;  /* Constrain child content */
}

.view {
    display: none;
    padding: var(--space-8);
    max-width: 1600px;
    margin: 0 auto;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-8);
}

.view-title h1 {
    font-size: var(--text-2xl);
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.view-subtitle {
    color: var(--text-secondary);
}

.view-actions {
    display: flex;
    gap: var(--space-3);
}

/* ================================
   Dashboard
   ================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-default);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.environments {
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
}

.stat-icon.stores {
    background: var(--accent-success-muted);
    color: var(--accent-success);
}

.stat-icon.users {
    background: var(--accent-purple-muted);
    color: var(--accent-purple);
}

.stat-icon.queries {
    background: var(--accent-warning-muted);
    color: var(--accent-warning);
}

.stat-value {
    display: block;
    font-size: var(--text-2xl);
    font-weight: 600;
    font-family: var(--font-mono);
}

.stat-label {
    display: block;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.dashboard-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    grid-template-rows: auto auto;
    gap: var(--space-6);
}

.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.panel-header h2 {
    font-size: var(--text-base);
    font-weight: 600;
}

.panel-content {
    padding: var(--space-4) var(--space-5);
    overflow-y: auto;
}

/* Account Detail */
.account-detail-section {
    margin-bottom: var(--space-5);
}

.account-detail-section h3 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-3);
}

.account-detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.account-detail-section-header h3 {
    margin-bottom: 0;
}

.account-detail-section-actions {
    display: flex;
    gap: var(--space-2);
}

.account-detail-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
}

.loading-placeholder {
    padding: var(--space-8);
    text-align: center;
    color: var(--text-tertiary);
}

/* Environment Card */
.env-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.env-card:hover {
    background: var(--bg-hover);
}

.env-card-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-success);
}

.env-card-info {
    flex: 1;
}

.env-card-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.env-card-url {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.env-card-stores {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Account Cards (multi-account dashboard) */
.account-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg, 12px);
    padding: var(--space-5, 20px);
    margin-bottom: var(--space-3);
    transition: var(--transition);
}

.account-card:hover {
    border-color: var(--border-default);
}

.account-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.account-card-name {
    font-weight: 600;
    font-size: var(--text-base, 1rem);
}

.account-role-badge {
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 500;
    text-transform: capitalize;
}

.account-role-badge.role-admin {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.account-role-badge.role-member {
    background: rgba(113, 113, 122, 0.15);
    color: #a1a1aa;
}

.account-role-badge.role-demo {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.account-perms {
    display: flex;
    gap: var(--space-1, 4px);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.perm-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary, rgba(255,255,255,0.05));
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.account-envs {
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-3);
}

.account-env-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
}

.env-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
    flex-shrink: 0;
}

.env-status-dot.online {
    background: var(--accent-success);
}

.env-status-dot.provisioning {
    background: #f59e0b;
}

.env-status-dot.unknown {
    background: var(--text-tertiary);
}

.account-env-name {
    font-weight: 500;
    font-size: var(--text-sm);
}

.account-env-meta {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    flex: 1;
}

.env-trial-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    font-weight: 500;
}

.account-env-empty {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    padding: var(--space-2) 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.account-card-add {
    border-style: dashed;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    opacity: 0.6;
    transition: var(--transition);
}

.account-card-add:hover {
    opacity: 1;
    border-color: var(--accent-primary);
}

.account-card-add-inner {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

/* No Accounts Empty State */
.no-accounts-state {
    text-align: center;
    padding: var(--space-8, 32px) var(--space-4);
}

.no-accounts-icon {
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
}

.no-accounts-state h3 {
    margin-bottom: var(--space-2);
}

.no-accounts-state p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-5, 20px);
}

.no-accounts-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
}

.glow-cta {
    box-shadow: 0 0 12px 4px rgba(124, 58, 237, 0.45);
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 12px 4px rgba(124, 58, 237, 0.4); }
    50%      { box-shadow: 0 0 20px 8px rgba(124, 58, 237, 0.65); }
}

/* Activity List */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 50%;
    color: var(--text-secondary);
}

.activity-icon svg {
    width: 16px;
    height: 16px;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: var(--text-sm);
    margin-bottom: 2px;
}

.activity-time {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}


/* ================================
   Products
   ================================ */
.products-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: var(--space-6);
}

.products-list-panel .panel-content {
    max-height: 70vh;
}

.products-list-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.products-list-item {
    text-align: left;
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: var(--space-3);
    cursor: pointer;
}

.products-list-item:hover {
    border-color: var(--border-default);
    background: var(--bg-hover);
}

.products-list-item.active {
    border-color: var(--accent-primary);
    background: var(--accent-primary-muted);
}

.products-list-item-name {
    font-weight: 600;
}

.products-list-item-meta {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.products-detail-panel .panel-content {
    max-height: 75vh;
}

.products-detail-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.products-section {
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    padding: var(--space-4);
}

.products-section h3 {
    margin: 0 0 var(--space-3) 0;
    font-size: var(--text-base);
}

.products-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.products-section-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.products-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.products-inline-checks {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.products-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.products-check-inline {
    font-size: var(--text-xs);
}

.products-form-actions {
    margin-top: var(--space-2);
}

.products-row-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.products-last-key {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    font-size: var(--text-sm);
}

.products-last-key code {
    font-family: var(--font-mono);
    color: var(--accent-primary);
}

.products-code-block {
    background: #0b1220;
    color: #e2e8f0;
    border: 1px solid #1e293b;
    border-radius: var(--border-radius);
    padding: var(--space-3);
    font-size: var(--text-xs);
    line-height: 1.5;
    max-height: 320px;
    overflow: auto;
    margin: 0;
}

/* ================================
   Audience Builder
   ================================ */
.audb-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr) minmax(280px, 0.8fr);
    gap: var(--space-5);
}

.audb-section-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.audb-ai {
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    max-height: 280px;
    min-height: 180px;
}

.audb-ai .nl-chat-header {
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.audb-ai .nl-chat-messages {
    padding: var(--space-2) var(--space-3);
}

.audb-ai-draft {
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
    padding: var(--space-2) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.audb-ai-draft-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.audb-ai-draft-header h4 {
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 600;
}

.audb-ai-draft-risk {
    line-height: 1.4;
}

.audb-ai-draft-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.audb-ai-draft-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 180px;
    overflow: auto;
}

.audb-ai-chip {
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    padding: var(--space-2);
}

.audb-ai-chip-low {
    border-color: color-mix(in srgb, #f97316 35%, var(--border-subtle));
    background: color-mix(in srgb, #f97316 10%, var(--bg-secondary));
}

.audb-ai-chip-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}

.audb-ai-chip-check {
    margin-top: 2px;
}

.audb-ai-chip-main {
    flex: 1;
    min-width: 0;
}

.audb-ai-chip-summary {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audb-ai-chip-meta {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    margin-top: 2px;
}

.audb-ai-confidence {
    font-size: var(--text-xs);
    color: var(--accent-primary);
    background: var(--accent-primary-muted);
    border: 1px solid color-mix(in srgb, var(--accent-primary) 24%, transparent);
    border-radius: 999px;
    padding: 1px 8px;
}

.audb-ai-rationale {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: 1.35;
}

.audb-ai-draft-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
}

.audb-ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: var(--space-2);
}

.audb-ai-suggestion-btn {
    font-size: var(--text-xs);
}

.audb-ai-send {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audb-builder-panel .panel-content,
.audb-summary-panel .panel-content,
.audb-explorer-panel .panel-content {
    max-height: 72vh;
    overflow: auto;
}

.audb-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.audb-filter-header h3 {
    margin: 0;
    font-size: var(--text-base);
}

.audb-filters {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.audb-filter-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) 130px minmax(0, 1fr) auto;
    gap: var(--space-2);
    align-items: center;
    padding: var(--space-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
}

.audb-hidden {
    visibility: hidden;
}

.audb-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
}

.audb-metric-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.audb-metric-label {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.audb-metric-value {
    font-size: var(--text-xl);
    font-weight: 700;
}

.audb-guardrail-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.audb-guardrail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.audb-guardrail-header h3 {
    margin: 0;
    font-size: var(--text-sm);
}

.audb-quality-score {
    border-radius: 999px;
    padding: 2px 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.audb-quality-score-strong {
    color: #166534;
    border-color: color-mix(in srgb, #16a34a 35%, transparent);
    background: color-mix(in srgb, #16a34a 14%, transparent);
}

.audb-quality-score-fair {
    color: #a16207;
    border-color: color-mix(in srgb, #f59e0b 35%, transparent);
    background: color-mix(in srgb, #f59e0b 14%, transparent);
}

.audb-quality-score-weak {
    color: #991b1b;
    border-color: color-mix(in srgb, #ef4444 35%, transparent);
    background: color-mix(in srgb, #ef4444 14%, transparent);
}

.audb-guardrail-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.audb-guardrail-item {
    font-size: var(--text-sm);
    line-height: 1.4;
    border-radius: var(--border-radius-sm);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.audb-guardrail-good {
    border-color: color-mix(in srgb, #16a34a 35%, transparent);
    background: color-mix(in srgb, #16a34a 10%, transparent);
}

.audb-guardrail-warn {
    border-color: color-mix(in srgb, #f59e0b 35%, transparent);
    background: color-mix(in srgb, #f59e0b 10%, transparent);
}

.audb-guardrail-critical {
    border-color: color-mix(in srgb, #ef4444 35%, transparent);
    background: color-mix(in srgb, #ef4444 10%, transparent);
}

.audb-guardrail-info {
    border-color: var(--border-subtle);
    background: var(--bg-secondary);
}

.audb-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.audb-breakdown-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    padding: var(--space-3);
}

.audb-breakdown-card h3 {
    margin: 0 0 var(--space-2);
    font-size: var(--text-sm);
}

.audb-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.audb-breakdown-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: var(--space-2);
    align-items: center;
    font-size: var(--text-sm);
}

.audb-breakdown-key {
    color: var(--text-primary);
}

.audb-breakdown-value {
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.audb-breakdown-lift {
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.audb-step-panel h3 {
    margin: 0 0 var(--space-2);
    font-size: var(--text-sm);
}

.audb-step-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.audb-step-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2);
    align-items: center;
    font-size: var(--text-sm);
    padding: var(--space-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    background: var(--bg-tertiary);
}

.audb-step-label {
    color: var(--text-secondary);
}

.audb-step-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.audb-attribute-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.audb-attribute-group h4 {
    margin: 0 0 var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.audb-attribute-group-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.audb-attribute-item {
    width: 100%;
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.audb-attribute-item:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary-muted);
}

.audb-attribute-name {
    text-align: left;
    font-size: var(--text-sm);
}

.audb-attribute-meta {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.audb-saved-panel {
    margin-top: var(--space-5);
}

.audb-compare-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.audb-compare-controls select {
    flex: 1;
    min-width: 260px;
}

.audb-compare-result {
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    padding: var(--space-3);
    margin-bottom: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.audb-compare-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
}

.audb-compare-header h3 {
    margin: 0;
    font-size: var(--text-sm);
}

.audb-compare-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-2);
}

.audb-compare-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    padding: var(--space-2) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.audb-compare-card-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.audb-compare-card-value {
    font-size: var(--text-base);
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* ================================
   Query Studio
   ================================ */
#view-query {
    padding: 0;
    max-width: none;
}

.query-studio {
    display: flex;
    height: 100vh;
    overflow: hidden;  /* Constrain content to prevent page-level scroll */
}

.query-builder {
    width: 480px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
}

.query-builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.query-tabs {
    display: flex;
    gap: var(--space-1);
}

.query-tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.query-tab svg {
    width: 16px;
    height: 16px;
}

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

.query-tab.active {
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
}

.query-actions {
    display: flex;
    gap: var(--space-1);
}

.query-mode {
    display: none;
    flex: 1;
    overflow: hidden;
}

.query-mode.active {
    display: flex;
    flex-direction: column;
}

/* Visual Builder */
.query-visual-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.schema-sidebar {
    width: 200px;
    display: flex;
    flex-direction: column;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-subtle);
}

.schema-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.schema-header h3 {
    font-size: var(--text-sm);
    font-weight: 600;
}

.schema-search {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.schema-search svg {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

.schema-search input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.schema-search input:focus {
    outline: none;
}

.schema-tree {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}

.schema-loading {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

.schema-field {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.schema-field:hover {
    background: var(--bg-hover);
}

.schema-field.dragging {
    opacity: 0.5;
}

.field-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    border-radius: 2px;
}

.field-icon.string {
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
}

.field-icon.number {
    background: var(--accent-success-muted);
    color: var(--accent-success);
}

.field-icon.boolean {
    background: var(--accent-warning-muted);
    color: var(--accent-warning);
}

.field-icon.date {
    background: var(--accent-purple-muted);
    color: var(--accent-purple);
}

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

.field-name {
    flex: 1;
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Builder Area */
.builder-area {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    font-size: var(--text-sm);
}

.builder-section {
    margin-bottom: var(--space-5);
}

.builder-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    margin-bottom: var(--space-3);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.section-header .builder-label {
    margin-bottom: 0;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.store-selector select,
.builder-section select {
    width: 100%;
    padding: var(--space-2);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: var(--text-xs);
    cursor: pointer;
}

.store-selector select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Filter Builder */
.filter-builder {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.filter-group {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    padding: var(--space-3);
}

.filter-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.filter-logic-label {
    padding: var(--space-1) var(--space-2);
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-logic-select {
    padding: var(--space-1) var(--space-2);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-xs);
}

.remove-group {
    opacity: 0.55;
}

.remove-group:hover {
    opacity: 1;
    color: var(--accent-danger);
    background: var(--accent-danger-muted);
}

/* Clickable result cells */
#results-tbody td {
    cursor: pointer;
    transition: background 0.1s;
}

#results-tbody td:hover {
    background: var(--accent-primary-muted, rgba(99,102,241,0.08));
}

.filter-conditions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.filter-condition {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
    padding-right: calc(var(--space-3) + 34px);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-subtle);
    position: relative;
}

.filter-condition .filter-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.filter-condition select,
.filter-condition input {
    padding: var(--space-2);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: var(--text-xs);
}

.filter-condition .filter-field {
    width: 100%;
}

.filter-condition .filter-operator {
    width: 100%;
}

.filter-value-wrapper {
    width: 100%;
    position: relative;
}

.filter-value-wrapper input {
    width: 100%;
}

.filter-condition .remove-condition {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
}

.filter-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.filter-row-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-condition select,
.filter-condition .filter-operator {
    width: 100%;
}

.add-condition {
    margin-top: var(--space-2);
}

/* Sort Builder */
.sort-builder {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sort-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius-sm);
}

.sort-item select {
    flex: 1;
    padding: var(--space-2);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: var(--text-xs);
}

.sort-item .remove-sort {
    flex-shrink: 0;
}

.group-builder,
.metric-builder {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.group-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    padding: var(--space-3);
    padding-right: calc(var(--space-3) + 34px);
}

.group-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.group-row label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.group-row select {
    width: 100%;
    padding: var(--space-2);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: var(--text-xs);
}

.group-item .remove-group-item {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
}

.remove-group,
.filter-condition .remove-condition,
.sort-item .remove-sort,
.group-item .remove-group-item {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    color: var(--text-tertiary);
    background: transparent;
    border: 1px solid transparent;
    transition: opacity 0.15s, color 0.15s, background 0.15s, border-color 0.15s;
}

.remove-group svg,
.filter-condition .remove-condition svg,
.sort-item .remove-sort svg,
.group-item .remove-group-item svg {
    width: 14px;
    height: 14px;
}

.filter-condition .remove-condition:hover,
.sort-item .remove-sort:hover,
.group-item .remove-group-item:hover {
    color: var(--accent-danger);
    background: var(--accent-danger-muted);
    border-color: rgba(239, 68, 68, 0.35);
}

.empty-state {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-default);
    border-radius: var(--border-radius);
}

/* Fields Selector */
.fields-selector {
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    min-height: 80px;
}

.selected-fields {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.field-tag {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--accent-primary-muted);
    border-radius: var(--border-radius-sm);
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    color: var(--accent-primary);
}

.field-tag button {
    display: flex;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
}

.field-tag button svg {
    width: 12px;
    height: 12px;
}

.fields-type-input {
    margin-top: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.fields-type-input::placeholder {
    color: var(--text-tertiary);
}

.fields-type-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.fields-hint {
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Limit */
.limit-selector {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.limit-selector input {
    width: 100px;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.limit-hint {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* Raw Editor */
.raw-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.editor-label {
    flex: 1;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.raw-editor {
    flex: 1;
    padding: var(--space-4);
    background: var(--bg-primary);
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    resize: none;
}

.raw-editor:focus {
    outline: none;
}

.editor-status {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    border-top: 1px solid var(--border-subtle);
}

.editor-status.error {
    color: var(--accent-danger);
    background: var(--accent-danger-muted);
}

.editor-status.valid {
    color: var(--accent-success);
}

/* Query Run Bar */
.query-run-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-subtle);
}

.query-preview {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    overflow: hidden;
}

.preview-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.preview-code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    background: transparent;
    padding: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#run-query {
    flex-shrink: 0;
}

/* Query Preview Section (at top) */
.query-preview-section {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    border: 1px solid var(--accent-primary-muted);
}

.query-preview-top {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.query-preview-top .preview-label {
    font-size: var(--text-sm);
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.preview-code-large {
    font-family: var(--font-mono);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--bg-primary);
    padding: var(--space-4);
    border-radius: var(--border-radius-sm);
    min-height: 64px;
    max-height: 130px;
    overflow-y: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.6;
    border: 1px solid var(--accent-primary-muted);
}

#run-query-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
}

#run-query-raw {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.run-query-label {
    min-width: 0;
}

.run-query-shortcut {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.run-query-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* Results Panel */
.query-results {
    flex: 1;
    min-width: 0;   /* Required for flex child to shrink below content width */
    min-height: 0;  /* Required for flex child scrolling */
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.results-tabs {
    display: flex;
    gap: var(--space-1);
}

.results-tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: var(--transition);
}

.results-tab svg {
    width: 16px;
    height: 16px;
}

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

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

.results-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.table-scroll-controls {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.table-scroll-btn {
    min-width: 34px;
    padding: 0 var(--space-2);
    font-family: var(--font-mono);
    font-weight: 600;
}

.results-count {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.export-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-4);
    background: none;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

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

.results-content {
    flex: 1;
    min-height: 0;  /* Required for flex child scrolling */
    overflow: auto;
    position: relative;
}

/* Empty State */
.results-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-8);
    text-align: center;
}

.empty-illustration {
    width: 120px;
    height: 120px;
    margin-bottom: var(--space-6);
    color: var(--text-tertiary);
}

.results-empty h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.results-empty p {
    color: var(--text-secondary);
}

/* Loading State */
.results-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: var(--space-4);
}

.results-loading p {
    color: var(--text-secondary);
}

/* Table View */
.results-table-container {
    height: 100%;
    min-height: 0;  /* Required for flex child scrolling */
    overflow: auto;
    /* Always show horizontal scrollbar so users without trackpads can scroll */
    overflow-x: scroll;
}

/* Force visible scrollbar on webkit (macOS hides by default) */
.results-table-container::-webkit-scrollbar {
    height: 12px;
    background: var(--bg-secondary);
}

.results-table-container::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 6px;
    border: 2px solid var(--bg-secondary);
}

.results-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.results-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.results-table th {
    position: sticky;
    top: 0;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-default);
    text-align: left;
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    white-space: nowrap;
}

.results-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* Chart View */
.results-chart-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chart-config {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.chart-hint {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
    font-size: var(--text-xs);
}

.chart-type-selector {
    display: flex;
    gap: var(--space-1);
}

.chart-type {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.chart-type svg {
    width: 18px;
    height: 18px;
}

.chart-type:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.chart-type.active {
    background: var(--accent-primary-muted);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.chart-axis-config {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    justify-content: flex-end;
}

.axis-select {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.axis-select label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.axis-select select {
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.chart-canvas-container {
    flex: 1;
    padding: var(--space-4);
}

#results-chart {
    width: 100% !important;
    height: 100% !important;
}

/* JSON View */
.results-json-container {
    height: 100%;
    overflow: auto;
}

.json-viewer {
    padding: var(--space-4);
    margin: 0;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* CSV View */
.results-csv-container {
    height: 100%;
    overflow: auto;
}

.csv-viewer {
    padding: var(--space-4);
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    line-height: 1.6;
    white-space: pre;
    word-wrap: normal;
    overflow-x: auto;
}

/* API Debug Panel */
.results-debug-container {
    padding: var(--space-4);
    overflow-y: auto;
    max-height: 600px;
}

.debug-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

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

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

.debug-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.debug-code {
    padding: var(--space-3);
    margin: 0;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-primary);
}

/* ==========================================
   Demo Welcome Overlay
   ========================================== */

.demo-welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
    transition: background 0.3s ease, backdrop-filter 0.3s ease;
    padding: var(--space-6);
}

.demo-welcome-overlay.visible {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.demo-welcome {
    position: relative;
    max-width: 580px;
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl, 16px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    padding: var(--space-8, 2rem);
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.demo-welcome-overlay.visible .demo-welcome {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.demo-welcome-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}

.demo-welcome-close:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.demo-welcome-close svg {
    width: 20px;
    height: 20px;
}

.demo-welcome-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.demo-welcome-badge {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    border-radius: 100px;
    margin-bottom: var(--space-3);
}

.demo-welcome-title {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 var(--space-3);
    color: var(--text-primary);
}

.demo-welcome-subtitle {
    font-size: var(--text-base, 1rem);
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    max-width: 460px;
    margin-inline: auto;
}

.demo-welcome-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--border);
}

.demo-welcome-stat {
    text-align: center;
}

.demo-welcome-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.demo-welcome-stat-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: 2px;
}

.demo-welcome-body {
    margin-bottom: var(--space-6);
}

.demo-welcome-body p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0 0 var(--space-3);
}

.demo-welcome-hint {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    font-size: var(--text-sm) !important;
}

.demo-welcome-hint em {
    color: var(--text-primary);
    font-style: normal;
    font-weight: 500;
}

.demo-welcome-actions {
    text-align: center;
}

.demo-welcome-actions .btn-lg {
    padding: 10px 32px;
    font-size: var(--text-base, 1rem);
}

@media (max-width: 600px) {
    .demo-welcome {
        padding: var(--space-5);
    }
    .demo-welcome-title {
        font-size: 1.35rem;
    }
    .demo-welcome-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================
   Natural Language Chat Interface
   ========================================== */

.nl-chat {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border-default);
    max-height: 320px;
    min-height: 140px;
}

.nl-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.nl-chat-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.nl-chat-title svg {
    color: var(--accent-primary);
}

.nl-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-height: 0;
}

.nl-msg {
    display: flex;
    gap: var(--space-2);
    max-width: 100%;
    animation: nlFadeIn 0.2s ease;
}

@keyframes nlFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.nl-msg-avatar {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

.nl-msg-user .nl-msg-avatar {
    background: var(--accent-primary-muted);
    color: var(--accent-primary);
}

.nl-msg-assistant .nl-msg-avatar {
    background: var(--accent-success-muted, rgba(34, 197, 94, 0.15));
    color: var(--accent-success);
}

.nl-msg-body {
    flex: 1;
    min-width: 0;
}

.nl-msg-text {
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.nl-msg-user .nl-msg-text {
    color: var(--text-secondary);
}

.nl-msg-query {
    margin-top: var(--space-2);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.nl-msg-query code {
    display: block;
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
    color: var(--accent-primary);
    white-space: pre;
    overflow-x: auto;
    max-height: 120px;
}

.nl-msg-actions {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.nl-chat-input-row {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    align-items: flex-end;
}

.nl-chat-input {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    resize: none;
    line-height: 1.4;
    max-height: 120px;
    outline: none;
    transition: border-color 0.15s;
}

.nl-chat-input:focus {
    border-color: var(--accent-primary);
}

.nl-chat-input::placeholder {
    color: var(--text-tertiary);
}

#nl-chat-send {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Typing indicator */
.nl-typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.nl-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: nlBounce 1.4s infinite ease-in-out both;
}

.nl-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.nl-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes nlBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Facets Sidebar */
.facets-sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    display: none;
}

.facets-sidebar.visible {
    display: flex;
    flex-direction: column;
}

.facets-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.facets-header h3 {
    font-size: var(--text-sm);
    font-weight: 600;
}

.facets-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
}

.facet-group {
    margin-bottom: var(--space-5);
}

.facet-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.facet-values {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.facet-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.facet-value:hover {
    background: var(--bg-hover);
}

.facet-value.selected {
    background: var(--accent-primary-muted);
}

.facet-label {
    font-size: var(--text-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.facet-count {
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    color: var(--text-tertiary);
}

/* ================================
   Environments View
   ================================ */
.environments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-4);
}

.environments-grid.environments-grid--detail {
    display: block;
}

.environments-grid.environments-grid--detail .environment-detail-card {
    width: 100%;
}

.account-detail-envs-grid {
    display: block;
}

.account-detail-envs-grid .environment-card {
    margin-bottom: var(--space-3);
    width: 100%;
}

.account-detail-envs-grid .environment-card:last-child {
    margin-bottom: 0;
}

.environment-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5);
    cursor: pointer;
    transition: var(--transition);
}

.environment-card:hover {
    border-color: var(--border-default);
}

.environment-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.environment-card-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.environment-card-status.online {
    background: var(--accent-success);
}

.environment-card-status.provisioning {
    background: #f59e0b;
}

.environment-card-status.offline {
    background: var(--accent-danger);
}

.environment-card-status.unknown {
    background: var(--text-tertiary);
}

.environment-card-status.deleting {
    background: #f59e0b;
    animation: m1StatusPulse 1.1s ease-in-out infinite;
}

.env-item-deleting .env-item-select {
    opacity: 0.9;
}

.env-delete-progress {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    color: #f59e0b;
    font-weight: 600;
    white-space: nowrap;
}

.env-delete-progress::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f59e0b;
    animation: m1StatusPulse 1.1s ease-in-out infinite;
}

.icon-spin {
    animation: m1IconSpin 1s linear infinite;
}

.environment-delete-notice {
    margin: 0 0 var(--space-3);
    padding: var(--space-3);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--border-radius);
    background: rgba(245, 158, 11, 0.08);
    color: #f59e0b;
    font-size: var(--text-sm);
}

@keyframes m1StatusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

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

.environment-card-name {
    flex: 1;
    font-size: var(--text-lg);
    font-weight: 600;
}

.environment-card-url {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
}

.environment-card-stats {
    display: flex;
    gap: var(--space-4);
}

.environment-card-actions {
    margin-top: var(--space-4);
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

.environment-stat {
    display: flex;
    flex-direction: column;
}

.environment-stat-value {
    font-size: var(--text-xl);
    font-weight: 600;
    font-family: var(--font-mono);
}

.environment-stat-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.environment-detail-card {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

.environment-detail-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.environment-detail-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.environment-detail-title-row h2 {
    margin: 0;
}

.environment-detail-url {
    margin: 0;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.environment-detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: var(--space-4);
}

.environment-detail-actions {
    margin-top: var(--space-5);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* ================================
   Data View
   ================================ */
.data-tabs, .users-tabs {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-6);
    padding: var(--space-1);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    width: fit-content;
}

.data-tab, .users-tab {
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.data-tab.active, .users-tab.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.data-panel, .users-panel {
    display: none;
}

.data-panel.active, .users-panel.active {
    display: block;
}

/* Schema Editor */
.schema-editor {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
}

.schema-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.schema-editor-header h3 {
    font-size: var(--text-base);
    font-weight: 600;
}

.schema-actions {
    display: flex;
    gap: var(--space-3);
}

#add-property-form:not(.hidden) {
    display: flex;
}

.schema-list {
    padding: var(--space-4);
}

.schema-property {
    display: grid;
    grid-template-columns: minmax(240px, 1.2fr) minmax(220px, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}

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

.schema-property-main {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.schema-property-name {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schema-property-type {
    padding: var(--space-1) var(--space-2);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-secondary);
}

.schema-property-description {
    width: 100%;
    min-width: 0;
    height: 34px;
    font-size: var(--text-sm);
}

.schema-property-actions {
    display: flex;
    gap: var(--space-2);
}

.schema-property-system {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    padding: 1px 6px;
}

@media (max-width: 980px) {
    .schema-property {
        grid-template-columns: 1fr;
    }

    .schema-property-actions {
        justify-content: flex-start;
    }
}

/* Publish Wizard */
.publish-wizard {
    max-width: 600px;
}

.publish-step {
    margin-bottom: var(--space-6);
    padding: var(--space-5);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    opacity: 0.5;
    transition: var(--transition);
}

.publish-step.active {
    opacity: 1;
}

.publish-step h3 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.publish-input-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.input-tab {
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: var(--transition);
}

.input-tab.active {
    background: var(--accent-primary-muted);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

#publish-json {
    width: 100%;
    min-height: 200px;
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    resize: vertical;
}

#publish-json:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.publish-preview {
    min-height: 100px;
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-4);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

/* ================================
   Users View
   ================================ */
.users-list {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
}

.user-row {
    display: flex;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

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

.user-avatar-sm {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary-muted);
    border-radius: 50%;
    margin-right: var(--space-4);
    font-weight: 600;
    color: var(--accent-primary);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-email {
    font-weight: 500;
    margin-bottom: 2px;
    overflow-wrap: anywhere;
}

.user-role {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.user-perms {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    row-gap: 4px;
    margin-top: 2px;
    min-width: 0;
    max-width: 100%;
}
.perm-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    max-width: 100%;
    overflow-wrap: anywhere;
}
.perm-read { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.perm-write { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.perm-manage { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.perm-admin { background: rgba(239, 68, 68, 0.15); color: #dc2626; }

/* CORS Config */
.cors-form {
    max-width: 500px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5);
}

.cors-form h3 {
    margin-bottom: var(--space-4);
}

.setting-inline-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
}

#cors-origin-input {
    flex: 1;
    min-width: 260px;
}

#cors-origin-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* ================================
   Settings View
   ================================ */
.settings-sections {
    max-width: 600px;
}

.settings-section {
    margin-bottom: var(--space-8);
}

.settings-section h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.settings-section.danger h2 {
    color: var(--accent-danger);
}

.settings-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
}

.settings-section.danger .settings-card {
    border-color: var(--accent-danger-muted);
}

.env-health-sections {
    max-width: 760px;
}

.env-health-checks {
    padding: var(--space-3) var(--space-4);
}

.env-health-check-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.env-health-check-row:last-child {
    border-bottom: none;
}

.env-health-check-name {
    font-weight: 600;
    color: var(--text-primary);
}

.env-health-check-msg {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-top: 2px;
    word-break: break-word;
}

.env-health-check-actions {
    margin-top: var(--space-2);
}

.env-health-check-status {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.env-health-check-status.ok {
    color: var(--accent-success);
}

.env-health-check-status.warn {
    color: var(--accent-warning);
}

.env-health-check-status.bad {
    color: var(--accent-danger);
}

.store-health-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.store-health-badge.ok {
    color: var(--accent-success);
    background: var(--accent-success-muted);
}

.store-health-badge.warn {
    color: var(--accent-warning);
    background: var(--accent-warning-muted);
}

.store-health-badge.bad {
    color: var(--accent-danger);
    background: var(--accent-danger-muted);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-info label {
    display: block;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.setting-info span, .setting-info code, .setting-info a {
    font-size: var(--text-base);
}

.theme-toggle {
    display: flex;
    gap: var(--space-1);
    padding: var(--space-1);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.theme-btn {
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: var(--transition);
}

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

.theme-btn.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* ================================
   Trial Environment Banner (env mode)
   ================================ */
.trial-env-banner {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.18), rgba(34, 211, 238, 0.10));
    color: var(--text-primary);
    backdrop-filter: blur(8px);
}

.trial-env-banner.hidden {
    display: none;
}

.trial-env-banner-content {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    font-size: var(--text-sm);
}

.trial-env-banner-content strong {
    font-family: var(--font-display);
    letter-spacing: 0.02em;
}

.trial-env-banner-content span {
    color: var(--text-secondary);
}

.trial-env-banner-close {
    border: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    width: 32px;
    height: 28px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.trial-env-banner-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ================================
   Modal
   ================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.modal {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

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

.modal-header h2 {
    font-size: var(--text-lg);
    font-weight: 600;
}

.modal-close {
    display: flex;
    padding: var(--space-2);
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

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

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    flex: 1;
    padding: var(--space-5);
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-subtle);
}

/* ================================
   Toast Notifications
   ================================ */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    z-index: 2000;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 400px;
    animation: slideIn 0.2s ease;
}

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

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.toast-close {
    display: flex;
    padding: var(--space-1);
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
}

.toast-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toast-close svg {
    width: 16px;
    height: 16px;
}

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

.toast.error .toast-icon {
    color: var(--accent-danger);
}

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

.toast.info .toast-icon {
    color: var(--accent-primary);
}

/* ================================
   Tour
   ================================ */
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    pointer-events: none;
}

.tour-highlight {
    position: absolute;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    border-radius: var(--border-radius);
    pointer-events: auto;
    transition: all 0.3s ease;
}

.tour-tooltip {
    position: absolute;
    width: 320px;
    padding: var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    pointer-events: auto;
}

.tour-content {
    margin-bottom: var(--space-4);
}

.tour-content h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.tour-content p {
    color: var(--text-secondary);
}

.tour-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tour-progress {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.tour-actions {
    display: flex;
    gap: var(--space-2);
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 1200px) {
    .dashboard-panels {
        grid-template-columns: 1fr;
    }

    .environments-panel {
        grid-row: auto;
    }


    .products-layout {
        grid-template-columns: 1fr;
    }

    .products-list-panel .panel-content,
    .products-detail-panel .panel-content {
        max-height: none;
    }

    .audb-layout {
        grid-template-columns: 1fr;
    }

    .audb-builder-panel .panel-content,
    .audb-summary-panel .panel-content,
    .audb-explorer-panel .panel-content {
        max-height: none;
    }
}

@media (max-width: 1024px) {
    .query-studio {
        flex-direction: column;
    }

    .query-builder {
        width: 100%;
        height: auto;
        max-height: 50vh;
    }

    .query-results {
        height: 50vh;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .view {
        padding: var(--space-4);
    }

    .view-header {
        flex-direction: column;
        gap: var(--space-4);
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .products-form-grid {
        grid-template-columns: 1fr;
    }

    .products-section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .audb-metrics {
        grid-template-columns: 1fr;
    }

    .audb-breakdown-grid {
        grid-template-columns: 1fr;
    }

    .audb-filter-row {
        grid-template-columns: 1fr;
    }

    .audb-compare-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .audb-compare-controls select {
        min-width: 0;
    }

    .audb-compare-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ================================
   Utilities
   ================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.font-mono {
    font-family: var(--font-mono);
}

.text-success {
    color: var(--accent-success);
}

.text-warning {
    color: var(--accent-warning);
}

.text-danger {
    color: var(--accent-danger);
}

/* ================================
   Query Manager Styles
   ================================ */

.query-actions {
    display: flex;
    gap: var(--space-2);
}

.query-actions .btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
}

.query-actions .btn svg {
    width: 16px;
    height: 16px;
}

.query-history-container {
    max-height: 60vh;
    overflow-y: auto;
}

.query-section-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin: var(--space-4) 0 var(--space-2) 0;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
}

.query-section-title:first-child {
    margin-top: 0;
}

.query-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.query-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.query-list-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
}

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

.query-list-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.query-list-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.query-list-preview {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--accent-primary);
    background: var(--bg-tertiary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--space-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.query-list-meta {
    display: flex;
    gap: var(--space-3);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.query-list-actions {
    display: flex;
    gap: var(--space-1);
}

.template-item {
    background: var(--bg-tertiary);
}

.modal-intro {
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.code-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    padding: var(--space-3);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    max-height: 150px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.form-input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

/* Raw Query Header */
.raw-query-header {
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--space-3);
}

.raw-query-run {
    display: flex;
    justify-content: flex-start;
}

.raw-query-run .btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ================================
   Storm Panel — right-side pull-out
   ================================ */
.storm-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 380px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 90;
    display: flex;
    flex-direction: column;
}

.storm-panel.open {
    transform: translateX(0);
}

.storm-panel-tab {
    position: absolute;
    left: -36px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 72px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-right: none;
    border-radius: 8px 0 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
}

.storm-panel-tab:hover {
    background: var(--bg-hover);
    color: #00d4aa;
}

.storm-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.storm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.storm-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Cost Meters */
.cost-meters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.cost-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cost-card.m1db { border-top: 2px solid #6C2BD9; }
.cost-card.snowflake { border-top: 2px solid #29b5e8; }
.cost-card.databricks { border-top: 2px solid #ff3621; }
.cost-card.bigquery { border-top: 2px solid #4285f4; }

.cost-platform {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cost-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.cost-value.counting {
    animation: costPulse 0.6s ease infinite alternate;
}

@keyframes costPulse {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

.cost-pq {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    font-family: 'JetBrains Mono', monospace;
}

.cost-pq.per-query-note {
    font-size: 0.6rem;
    opacity: 0.55;
}

/* Cost Divergence Chart */
#storm-divergence-chart {
    width: 100%;
    height: 180px;
    margin: var(--space-3) 0;
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
}

/* Cost Comparison Summary */
.cost-comparison-summary {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.comparison-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
}

.comparison-row.competitor {
    border-left: 3px solid #ef4444;
}

.comparison-row.m1db {
    border-left: 3px solid #6C2BD9;
}

.comparison-row.savings {
    border-left: 3px solid #22c55e;
    background: rgba(34, 197, 94, 0.08);
}

.comparison-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.comparison-value {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.comparison-row.competitor .comparison-value {
    color: #ef4444;
}

.comparison-row.m1db .comparison-value {
    color: #6C2BD9;
}

.comparison-row.savings .comparison-value {
    color: #22c55e;
}

.cost-mult {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-warning);
}

/* Storm Controls */
.storm-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.storm-control-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.storm-control-row label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.storm-control-row select,
.storm-control-row input[type="range"] {
    width: 100%;
}

.storm-btn-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.storm-btn-row .btn-primary {
    flex: 1;
}

/* Progress Bar */
.storm-progress-bar {
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
    flex-shrink: 0;
}

.storm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6C2BD9, #3b82f6);
    width: 0%;
    transition: width 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: #000;
    font-family: 'JetBrains Mono', monospace;
}

/* Live Feed */
.storm-feed {
    flex: 1;
    min-height: 120px;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
}

.storm-feed-header {
    display: flex;
    gap: 4px;
    padding: 4px var(--space-2);
    border-bottom: 2px solid var(--border-default);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 1;
}

.storm-feed-header .feed-num,
.storm-feed-header .feed-type,
.storm-feed-header .feed-query,
.storm-feed-header .feed-rows,
.storm-feed-header .feed-latency,
.storm-feed-header .feed-costs {
    color: var(--text-tertiary);
}

.storm-feed-entry {
    display: flex;
    gap: 4px;
    padding: 3px var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
    align-items: center;
}

.storm-feed-entry:last-child {
    border-bottom: none;
}

.feed-num {
    color: var(--text-tertiary);
    width: 32px;
    flex-shrink: 0;
}

.feed-type {
    color: var(--accent-purple);
    width: 72px;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-query {
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-latency {
    color: var(--accent-success);
    width: 24px;
    flex-shrink: 0;
    text-align: right;
}

.feed-costs {
    color: var(--text-tertiary);
    width: 110px;
    flex-shrink: 0;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Projections Table */
.storm-projections {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.65rem;
    table-layout: fixed;
}

.storm-projections th,
.storm-projections td {
    padding: 3px 4px;
    text-align: right;
    border-bottom: 1px solid var(--border-subtle);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.storm-projections th {
    font-weight: 600;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.storm-projections th:first-child,
.storm-projections td:first-child {
    width: 52px;
}

.storm-projections td:first-child,
.storm-projections th:first-child {
    text-align: left;
    color: var(--text-secondary);
}

.storm-projections .projection-annual td {
    font-weight: 700;
    font-size: 0.8rem;
    border-top: 2px solid var(--border-default);
}

/* SQL Translation Panel */
.sql-panel {
    padding: var(--space-4);
}

.sql-dialect-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.sql-dialect {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.sql-dialect:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sql-dialect.active {
    background: var(--accent-primary-muted);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.sql-note {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-top: var(--space-3);
    font-style: italic;
}

/* Calibration Modal */
.calibration-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.calibration-platform h4 {
    margin: 0 0 var(--space-2) 0;
    font-size: 0.85rem;
}

.calibration-platform label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    margin: var(--space-2) 0 var(--space-1);
}

.calibration-platform .form-input {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.85rem;
}

/* API Quick Reference — collapsible helper for agents and developers */
.api-quick-ref {
    font-size: 0.75rem;
    color: var(--text-tertiary, #888);
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}
.api-quick-ref summary {
    cursor: pointer;
    opacity: 0.6;
    font-weight: 500;
}
.api-quick-ref summary:hover {
    opacity: 1;
}
.api-quick-ref dl {
    margin: var(--space-2) 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-1) var(--space-3);
}
.api-quick-ref dt {
    font-weight: 600;
    white-space: nowrap;
}
.api-quick-ref dd {
    margin: 0;
    word-break: break-word;
}
.api-quick-ref h3 {
    font-size: 0.75rem;
    margin: var(--space-2) 0 var(--space-1);
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════
   ELTL — Extract, Load, Transform, Load
   ═══════════════════════════════════════════════ */

/* Step tabs */
/* Section tabs (no step numbers — independent sections, not a wizard) */
.eltl-sections {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: var(--space-3);
}

.eltl-section-tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all 0.15s;
}

.eltl-section-tab:hover { color: var(--text-secondary); background: var(--bg-hover); }
.eltl-section-tab.active { color: var(--accent-primary); background: rgba(59, 130, 246, 0.1); font-weight: 500; }

/* Work queue badge */
.eltl-wq-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0 5px;
}

/* Transform rule cards */
.eltl-rule-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
}
.eltl-rule-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.eltl-rule-card-header code { font-weight: 600; }
.eltl-rule-card-header .btn-icon { margin-left: auto; }

/* Add rule form */
.eltl-add-rule {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}
.eltl-add-rule-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}
.eltl-add-rule-row .form-input-sm { flex: 1; max-width: 180px; }
.eltl-add-rule-predicate {
    margin-top: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
}
.eltl-add-rule-predicate .form-input-sm { max-width: 220px; }

/* Denorm preflight */
.eltl-denorm-preflight {
    margin-top: var(--space-4);
    padding: var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
}
.eltl-denorm-intro {
    margin-bottom: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
}
.eltl-denorm-intro p {
    margin: 6px 0;
}
.eltl-denorm-readiness {
    margin-bottom: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
}
.eltl-denorm-readiness.is-ready {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.08);
}
.eltl-denorm-readiness.is-warning {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.08);
}
.eltl-denorm-readiness.is-blocked {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(248, 113, 113, 0.08);
}
.eltl-denorm-readiness .actions {
    margin-top: var(--space-2);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.eltl-denorm-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}
.eltl-denorm-head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.eltl-denorm-preflight textarea {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    margin-top: var(--space-2);
    min-height: 140px;
}
.eltl-denorm-wizard {
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
    padding: var(--space-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
}
.eltl-denorm-wizard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-2);
}
.eltl-denorm-wizard-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.eltl-denorm-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-2);
    margin-top: var(--space-2);
}
.eltl-denorm-actions .btn {
    width: 100%;
    min-width: 0;
    text-align: center;
    white-space: normal;
    line-height: 1.25;
}
.eltl-denorm-report {
    margin-top: var(--space-3);
}
.eltl-denorm-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    padding: var(--space-3);
    margin-bottom: var(--space-2);
}
.eltl-denorm-metrics {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-2);
}
.eltl-denorm-metric {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
}
@media (max-width: 900px) {
    .eltl-denorm-head {
        flex-direction: column;
        align-items: flex-start;
    }
    .eltl-denorm-head-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .eltl-denorm-wizard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 560px) {
    .eltl-denorm-wizard-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Scan files button */
.eltl-scan-files {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    flex-wrap: wrap;
}
.eltl-scan-files #eltl-schema-detected-summary {
    margin-left: auto;
}

/* Layout: main + copilot sidebar */
.eltl-layout {
    display: flex;
    gap: var(--space-6);
    min-height: 500px;
}

.eltl-main { flex: 1; min-width: 0; }

.eltl-panel { display: none; }
.eltl-panel.active { display: block; }

/* Drop zone */
.eltl-dropzone {
    border: 2px dashed var(--border-default);
    border-radius: var(--border-radius-lg);
    padding: var(--space-12) var(--space-8);
    text-align: center;
    color: var(--text-tertiary);
    transition: all 0.2s;
    cursor: pointer;
}

.eltl-dropzone:hover,
.eltl-dropzone.dragover {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.05);
    color: var(--text-secondary);
}

.eltl-dropzone svg { margin: 0 auto var(--space-3); opacity: 0.5; }
.eltl-dropzone .btn-link { color: var(--accent-primary); background: none; border: none; cursor: pointer; text-decoration: underline; font-size: inherit; }

/* Local preview gate (load is blocked until user signs in or connects demo) */
.eltl-local-load-gate {
    margin-top: var(--space-5);
    padding: var(--space-6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    text-align: center;
}
.eltl-local-load-icon {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-3);
    color: var(--text-tertiary);
    opacity: 0.9;
}
.eltl-local-load-gate h3 {
    margin-bottom: var(--space-2);
}
.eltl-local-load-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    margin-top: var(--space-5);
    flex-wrap: wrap;
}
.eltl-local-load-actions .btn {
    min-width: 120px;
}

/* Inventory table */
.eltl-inventory { margin-top: var(--space-6); }
.eltl-inventory.collapsed .eltl-table { display: none; }
.eltl-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); gap: var(--space-3); }
.eltl-section-header .eltl-section-title { margin-bottom: 0; }
.eltl-section-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-3); }

/* Data preview */
.eltl-preview { margin-top: var(--space-4); }
.eltl-preview-table-wrap { overflow-x: auto; max-height: 300px; overflow-y: auto; border: 1px solid var(--border-primary); border-radius: var(--radius-md); }
.eltl-preview-table { font-size: 0.75rem; }
.eltl-preview-table th { position: sticky; top: 0; background: var(--bg-secondary); z-index: 1; }
.eltl-preview-table td { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-input-sm { font-size: 0.75rem; padding: var(--space-1) var(--space-2); height: auto; max-width: 180px; }

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

.eltl-table th {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    color: var(--text-tertiary);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
}

.eltl-table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

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

.eltl-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.6875rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Store info (target store context + repair controls) */
.eltl-store-info {
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}
.eltl-store-info.ok {
    border-color: var(--accent-primary);
    background: var(--accent-primary-muted);
}
.eltl-store-info.warn {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.10);
}
.eltl-store-info.bad {
    border-color: rgba(244, 63, 94, 0.35);
    background: rgba(244, 63, 94, 0.10);
}
.eltl-store-info-main {
    min-width: 0;
    flex: 1;
}
.eltl-store-info-line {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}
#eltl-target-store-select {
    min-width: 160px;
    max-width: 240px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    height: 30px;
}
.eltl-store-info-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Store selector (legacy — unused) */
.eltl-store-selector { margin-top: var(--space-6); }

.eltl-store-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.eltl-store-row .form-input { flex: 1; }

/* Actions bar */
.eltl-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

/* Schema table */
.eltl-schema-table-wrap { overflow-x: auto; }

/* Schema issues (actionable suggestions) */
.eltl-schema-issues { margin-top: var(--space-4); display: grid; gap: var(--space-3); }
.eltl-schema-issue-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    padding: var(--space-4);
}
.eltl-schema-issue-card .eltl-schema-issue-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.eltl-schema-issue-card .eltl-schema-issue-title { font-weight: 600; }
.eltl-schema-issue-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); align-items: center; }
.eltl-schema-issue-actions select { max-width: 220px; }
.eltl-schema-issue-pre { margin-top: var(--space-2); max-height: 160px; overflow: auto; padding: var(--space-2) var(--space-3); border-radius: 12px; background: rgba(0, 0, 0, 0.15); border: 1px solid rgba(255, 255, 255, 0.08); }

/* Ingest compatibility health */
.eltl-ingest-health {
    margin: var(--space-3) 0 var(--space-4);
    padding: var(--space-3);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
}
.eltl-ingest-health.ok {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.08);
}
.eltl-ingest-health.warn {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.1);
}
.eltl-ingest-health.bad {
    border-color: rgba(244, 63, 94, 0.35);
    background: rgba(244, 63, 94, 0.1);
}
.eltl-ingest-health-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}
.eltl-ingest-health-title {
    font-size: 0.875rem;
    font-weight: 600;
}
.eltl-ingest-health-meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}
.eltl-ingest-health-list {
    margin-top: var(--space-2);
    display: grid;
    gap: 4px;
    font-size: 0.8125rem;
}
.eltl-ingest-health-actions {
    margin-top: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Add Property form */
.eltl-add-property {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    padding: var(--space-3);
    margin-bottom: var(--space-4);
}
.eltl-add-property-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}
.eltl-add-property-row .form-input-sm {
    flex: 1;
    max-width: 200px;
}
#eltl-add-prop-hint {
    margin-top: var(--space-2);
    line-height: 1.45;
}
.eltl-add-property.prefilled {
    border-color: var(--accent-primary);
    background: var(--accent-primary-muted);
}
.eltl-add-property.prefilled #eltl-add-prop-hint {
    color: var(--accent-primary);
    font-weight: 500;
}

.eltl-type-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    padding: 2px 6px;
    font-size: 0.8125rem;
    font-family: var(--font-mono);
}

.eltl-conf {
    font-weight: 600;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}
.eltl-conf-high { color: var(--accent-success); }
.eltl-conf-med { color: var(--accent-warning); }
.eltl-conf-low { color: var(--accent-danger); }

.eltl-row-warn { background: rgba(245, 158, 11, 0.05); }
.eltl-issue-badge { display: inline-block; padding: 1px 6px; border-radius: 3px; background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); font-size: 0.6875rem; font-weight: 600; }

/* String duplicate toggle */
.eltl-str-dup-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.eltl-str-dup-toggle:hover, .eltl-str-dup-toggle.suggested {
    opacity: 0.85;
}
.eltl-str-dup-toggle.suggested span {
    color: #c084fc;
}
.eltl-str-dup-check {
    width: 14px;
    height: 14px;
    accent-color: #c084fc;
    cursor: pointer;
}
.eltl-str-dup-check:checked + span {
    color: #c084fc;
    font-weight: 600;
}

/* Progress bar */
.eltl-progress-header { margin-bottom: var(--space-4); }

.eltl-progress-bar-wrap {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--space-2);
}

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

.eltl-progress-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.eltl-progress-subtext {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.eltl-progress-subtext.ok {
    color: var(--accent-success);
}

.eltl-progress-subtext.warn {
    color: var(--accent-warning);
}

.eltl-progress-subtext.error {
    color: var(--accent-danger);
}

/* Live errors */
.eltl-live-errors { margin-top: var(--space-6); }

.eltl-error-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}

.eltl-error-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Load complete card */
.eltl-complete-card {
    margin-top: var(--space-6);
    padding: var(--space-6);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
}

.eltl-complete-card h3 { margin-bottom: var(--space-3); }
.eltl-complete-actions { display: flex; gap: var(--space-3); margin-top: var(--space-4); }

/* Cleansing report (load complete) */
.eltl-cleansing-details { margin-top: var(--space-3); }
.eltl-cleansing-summary { cursor: pointer; user-select: none; }
.eltl-cleansing-grid { margin-top: var(--space-3); display: grid; gap: var(--space-3); }
.eltl-cleansing-metrics { line-height: 1.35; }
.eltl-cleansing-subhead { margin-bottom: 6px; }
.eltl-cleansing-list { display: grid; gap: 6px; }
.eltl-cleansing-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.eltl-cleansing-note {
    padding: var(--space-2);
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
}
.eltl-cleansing-note-warn { border-color: rgba(250, 204, 21, 0.25); background: rgba(250, 204, 21, 0.07); }
.eltl-cleansing-note-bad { border-color: rgba(244, 63, 94, 0.25); background: rgba(244, 63, 94, 0.07); }
.eltl-cleansing-note-msg { margin-top: 3px; }
.eltl-cleansing-pre {
    margin-top: var(--space-2);
    max-height: 260px;
    overflow: auto;
    padding: var(--space-3);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Fix cards */
.eltl-fix-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}
.eltl-fix-card-schema {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.eltl-fix-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.eltl-fix-samples { margin: var(--space-3) 0; }
.eltl-sample-val { background: var(--bg-tertiary); padding: 1px 6px; border-radius: 3px; font-size: 0.75rem; margin-right: var(--space-1); }

.eltl-fix-suggestions { margin: var(--space-3) 0; }

.eltl-fix-option {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-1) 0;
    font-size: 0.8125rem;
    cursor: pointer;
}

.eltl-fix-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); }

/* AI Copilot sidebar */
.eltl-copilot {
    width: 320px;
    min-width: 320px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    max-height: 600px;
}

.eltl-copilot.hidden { display: none; }

.eltl-copilot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.eltl-copilot-title { font-weight: 600; font-size: 0.875rem; }

.eltl-copilot-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.eltl-msg { display: flex; gap: var(--space-2); }

.eltl-msg-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    flex-shrink: 0;
}

.eltl-msg-user .eltl-msg-avatar { background: rgba(59, 130, 246, 0.15); color: var(--accent-primary); }
.eltl-msg-assistant .eltl-msg-avatar { background: rgba(34, 197, 94, 0.15); color: var(--accent-success); }

.eltl-msg-body { flex: 1; min-width: 0; }
.eltl-msg-text { font-size: 0.8125rem; line-height: 1.5; color: var(--text-primary); }
.eltl-msg-actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); flex-wrap: wrap; }

/* Typing indicator */
.eltl-typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.eltl-typing-dots span {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text-tertiary);
    animation: eltlBounce 1.4s infinite ease-in-out both;
}
.eltl-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.eltl-typing-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes eltlBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Code blocks inside copilot messages */
.eltl-msg-text pre {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: var(--space-2) var(--space-3);
    overflow-x: auto;
    font-size: 0.75rem;
    margin: var(--space-2) 0;
}
.eltl-msg-text code {
    background: var(--bg-tertiary);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.8em;
}
.eltl-msg-text pre code { background: none; padding: 0; }

/* Proactive messages */
.eltl-msg-proactive .eltl-msg-avatar {
    background: rgba(168, 85, 247, 0.15);
    color: #6C2BD9;
}

/* Welcome message */
.eltl-msg-welcome .eltl-msg-text { color: var(--text-secondary); }

/* Markdown lists */
.eltl-msg-text ul { margin: var(--space-1) 0; padding-left: var(--space-4); }
.eltl-msg-text li { margin-bottom: 2px; }

.eltl-copilot-input-row {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3);
    border-top: 1px solid var(--border-subtle);
}

.eltl-copilot-input-row textarea {
    flex: 1;
    resize: none;
    font-size: 0.8125rem;
    min-height: 36px;
}

/* Animations */
.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

/* Source mode tabs */
.eltl-source-tabs {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
}

.eltl-source-tab {
    padding: var(--space-2) var(--space-4);
    background: none;
    border: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all 0.15s;
}

.eltl-source-tab:hover { color: var(--text-secondary); border-color: var(--border-default); }
.eltl-source-tab.active { color: var(--accent-primary); border-color: var(--accent-primary); background: rgba(59, 130, 246, 0.08); }

/* S3 Browser */
.eltl-s3-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.eltl-s3-form-row {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.eltl-s3-form-row:last-child { margin-bottom: 0; }

.eltl-s3-field { flex: 1; }
.eltl-s3-field label { display: block; margin-bottom: var(--space-1); }

.eltl-s3-creds {
    margin-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-3);
}

.eltl-s3-creds summary { cursor: pointer; }
.eltl-s3-creds summary:hover { color: var(--text-secondary); }

.eltl-s3-path {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.eltl-s3-crumb {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: 0.8125rem;
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--border-radius);
    font-family: var(--font-mono);
}

.eltl-s3-crumb:hover { background: var(--bg-hover); }

.eltl-s3-listing { max-height: 400px; overflow-y: auto; }

.eltl-s3-import-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
}

.eltl-badge-s3 {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
}

/* Responsive */
@media (max-width: 768px) {
    .eltl-layout { flex-direction: column; }
    .eltl-copilot { width: 100%; min-width: 0; max-height: 300px; }
    .eltl-sections { overflow-x: auto; flex-wrap: nowrap; }
    .eltl-s3-form-row { flex-direction: column; }
    .eltl-store-info { flex-direction: column; align-items: flex-start; }
    .eltl-scan-files #eltl-schema-detected-summary { margin-left: 0; width: 100%; }
}

/* ================================
   Trial Provisioning Modal
   ================================ */
.provision-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    padding: var(--space-6);
    animation: provisionFadeIn 0.3s ease;
}

.provision-overlay.hidden {
    display: none;
}

@keyframes provisionFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.provision-modal {
    width: 100%;
    max-width: 440px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-8);
    animation: provisionSlideUp 0.35s ease;
    max-height: 85vh;
    overflow: auto;
}

@keyframes provisionSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.provision-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.provision-spinner {
    margin-bottom: var(--space-4);
}

.provision-spin-icon {
    width: 40px;
    height: 40px;
    color: var(--accent-primary);
    animation: provisionSpin 1.5s linear infinite;
}

.provision-complete .provision-spin-icon {
    animation: none;
    color: var(--accent-success);
}

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

.provision-header h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.provision-subtitle {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    line-height: 1.5;
}

/* Steps */
.provision-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.provision-step {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
}

.provision-step-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.provision-step-icon .step-check,
.provision-step-icon .step-spinner {
    width: 20px;
    height: 20px;
    display: none;
}

.provision-step-icon .step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-default);
}

.provision-step-label {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    transition: color 0.2s ease;
}

/* Step states */
.provision-step.completed .step-check {
    display: block;
    color: var(--accent-success);
}

.provision-step.completed .step-dot,
.provision-step.completed .step-spinner {
    display: none;
}

.provision-step.completed .provision-step-label {
    color: var(--text-secondary);
}

.provision-step.active .step-spinner {
    display: block;
    color: var(--accent-primary);
    animation: provisionSpin 1.5s linear infinite;
}

.provision-step.active .step-dot {
    display: none;
}

.provision-step.active .step-check {
    display: none;
}

.provision-step.active .provision-step-label {
    color: var(--text-primary);
    font-weight: 500;
}

/* Footer */
.provision-footer {
    text-align: center;
}

.provision-footer.hidden {
    display: none;
}

.provision-error {
    text-align: center;
    padding: var(--space-4);
    background: var(--accent-danger-muted);
    border-radius: var(--border-radius);
    margin-top: var(--space-4);
}

.provision-error[data-kind="warning"] {
    background: var(--accent-warning-muted);
}

.provision-error.hidden {
    display: none;
}

.provision-error p {
    color: var(--accent-danger);
    font-size: var(--text-sm);
    margin-bottom: var(--space-3);
}

.provision-error[data-kind="warning"] p {
    color: var(--accent-warning);
}

.provision-error-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    flex-wrap: wrap;
}

.provision-error-actions .hidden {
    display: none;
}

.provision-progress {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

.provision-progress-line {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: var(--space-2);
}

.provision-progress-details summary {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    cursor: pointer;
    user-select: none;
}

.provision-progress-log {
    margin-top: var(--space-2);
    padding: var(--space-3);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-subtle);
    background: rgba(0,0,0,0.25);
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.45;
    max-height: 180px;
    overflow: auto;
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Auth alternate path (env users vs ops users) */
.auth-alt {
    margin-top: var(--space-6);
}

.auth-alt-divider {
    height: 1px;
    background: var(--border-subtle);
    margin-bottom: var(--space-4);
    opacity: 0.8;
}

.auth-alt-text {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
    text-align: center;
}

/* ================================
   Error Reporter Panel & Badge
   ================================ */

#error-reporter-badge {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    border: 1px solid var(--border-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.6;
}
#error-reporter-badge:hover { opacity: 1; }
#error-reporter-badge.has-errors {
    background: var(--accent-danger);
    color: #fff;
    border-color: var(--accent-danger);
    opacity: 1;
    animation: err-pulse 2s infinite;
}
@keyframes err-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

#error-reporter-panel {
    position: fixed;
    bottom: 56px;
    right: 16px;
    width: 420px;
    max-height: 480px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#error-reporter-panel.hidden { display: none; }

.err-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}
.err-panel-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}
.err-panel-actions { display: flex; gap: 6px; }
.err-panel-btn {
    background: none;
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
}
.err-panel-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.err-panel-body {
    overflow-y: auto;
    padding: 8px;
    flex: 1;
}

.err-entry {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-subtle, var(--border-primary));
    font-size: 12px;
}
.err-entry:last-child { border-bottom: none; }
.err-entry-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.err-tag {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.err-tag-api { background: rgba(239,68,68,0.15); color: #f87171; }
.err-tag-uncaught { background: rgba(245,158,11,0.15); color: #fbbf24; }
.err-tag-promise { background: rgba(168,85,247,0.15); color: #c084fc; }
.err-time { color: var(--text-tertiary); font-size: 11px; }
.err-route { color: var(--text-tertiary); font-size: 11px; margin-left: auto; }
.err-message {
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.4;
}
.err-autofix {
    margin-top: 4px;
    padding: 4px 8px;
    background: rgba(34,197,94,0.1);
    border-left: 2px solid #22c55e;
    color: #4ade80;
    font-size: 11px;
    border-radius: 2px;
}
.err-detail {
    color: var(--text-tertiary);
    font-size: 11px;
    font-family: var(--font-mono);
    margin-top: 2px;
}
.err-empty {
    text-align: center;
    color: var(--text-tertiary);
    padding: 24px;
    font-size: 13px;
}

/* ── Local Mode Banner ───────────────────────────── */

.local-mode-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-4);
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.15), rgba(59, 130, 246, 0.10));
    border-bottom: 1px solid rgba(168, 85, 247, 0.25);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}
.local-mode-banner a {
    color: #a78bfa;
    text-decoration: underline;
    font-weight: 500;
}
.local-mode-banner a:hover {
    color: #c4b5fd;
}
.local-mode-dismiss {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 18px;
    cursor: pointer;
    padding: 0 var(--space-2);
    line-height: 1;
}
.local-mode-dismiss:hover {
    color: var(--text-primary);
}

/* Browse table row hover */
#browse-container tr[data-doc-idx]:hover {
    background: var(--bg-hover);
}
