/* MySQL to Sheets Dashboard - Main Stylesheet
 * Consolidated from templates for DRY compliance
 * Supports light and dark mode via CSS variables + Tailwind dark: classes
 */

/* ==========================================================================
   CSS Variables - Light Mode (Default)
   ========================================================================== */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: rgba(37, 99, 235, 0.1);
    --success: #16a34a;
    --error: #dc2626;
    --warning: #ca8a04;
    --info: #0891b2;
    --bg: #f8fafc;
    --bg-hover: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Monaco', 'Menlo', 'Consolas', monospace;
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-lg: 0.5rem;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   CSS Variables - Dark Mode
   ========================================================================== */
.dark {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: rgba(59, 130, 246, 0.15);
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --bg: #0f172a;
    --bg-hover: #1e293b;
    --card-bg: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Dark mode body background */
.dark body {
    background-color: var(--bg);
    color: var(--text);
}

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

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    padding: 0;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.main-content {
    padding: 2rem;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.version {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Navigation
   ========================================================================== */
nav {
    background: #f8f9fa;
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--border);
}

nav .nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}

nav a {
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s ease;
    color: var(--text-muted);
    padding: 0.25rem 0;
}

nav a.active {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
    border-radius: var(--radius);
    padding: 0.25rem 0.5rem;
    margin: 0 -0.5rem;
}

nav a:hover {
    color: var(--primary);
}

/* Active dropdown parent indicator */
.nav-dropdown.has-active > .nav-dropdown-toggle {
    color: var(--primary);
    position: relative;
}

.nav-dropdown.has-active > .nav-dropdown-toggle::before {
    content: '';
    position: absolute;
    left: -0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 1rem;
    background: var(--primary);
    border-radius: 2px;
}

.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user span {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.tier-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.tier-free { background: #f3f4f6; color: #6b7280; }
.tier-starter { background: #dbeafe; color: #1d4ed8; }
.tier-professional { background: #dcfce7; color: #166534; }
.tier-enterprise { background: #fef3c7; color: #92400e; }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.dark .card {
    background: #1e293b;
    border-color: #334155;
}

.dark .card h2 {
    color: #f1f5f9;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h2 {
    margin-bottom: 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--card-bg);
    color: var(--text);
    text-decoration: none;
    font-family: inherit;
}

button:hover, .btn:hover {
    background: var(--bg);
}

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

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

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

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

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

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.button-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.toolbar-actions {
    display: flex;
    gap: 0.5rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row .form-group {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    background: white;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dark input[type="text"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="number"],
.dark input[type="url"],
.dark textarea,
.dark select {
    background: #1e293b;
    border-color: #475569;
    color: #f1f5f9;
}

.dark input:focus,
.dark textarea:focus,
.dark select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.dark label {
    color: #e2e8f0;
}

textarea {
    min-height: 100px;
    resize: vertical;
    font-family: var(--font-mono);
}

select {
    cursor: pointer;
}

input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

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

/* Inline save button pattern from index.html */
.save-btn {
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}

.save-btn:hover {
    background: #e2e8f0;
}

.remove-btn {
    padding: 0.5rem 0.625rem;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--error);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
}

.remove-btn:hover {
    background: #fecaca;
}

.manage-link {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    padding: 0.5rem 0;
}

.manage-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ==========================================================================
   Tables
   ========================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg);
    font-size: 0.75rem;
    text-transform: uppercase;
}

tr:hover {
    background: var(--bg);
}

.dark th, .dark td {
    border-color: #334155;
}

.dark th {
    background: #1e293b;
    color: #94a3b8;
}

.dark tr:hover {
    background: #334155;
}

.truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checkbox-cell {
    width: 40px;
}

/* ==========================================================================
   Badges & Status
   ========================================================================== */
.badge, .status-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success, .status-success {
    background: #dcfce7;
    color: var(--success);
}

.badge-error, .status-error {
    background: #fee2e2;
    color: var(--error);
}

.badge-warning, .status-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: var(--primary);
}

.status-pending {
    background: #fef3c7;
    color: var(--warning);
}

.status-disabled {
    background: #f1f5f9;
    color: var(--text-muted);
}

/* ==========================================================================
   Alerts
   ========================================================================== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background: #dcfce7;
    color: var(--success);
    border: 1px solid #86efac;
}

.alert-error {
    background: #fee2e2;
    color: var(--error);
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.alert-info {
    background: #dbeafe;
    color: var(--primary);
    border: 1px solid #93c5fd;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

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

/* ==========================================================================
   Loading & Empty States
   ========================================================================== */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}

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

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Info Rows
   ========================================================================== */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

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

.info-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.info-value {
    font-weight: 500;
    font-size: 0.875rem;
}

/* ==========================================================================
   Actions
   ========================================================================== */
.actions {
    display: flex;
    gap: 0.5rem;
}

/* ==========================================================================
   Stats Grid
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-card {
    text-align: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Error Categories (for history tables)
   ========================================================================== */
.error-code {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    background: #fee2e2;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    margin-left: 0.25rem;
}

.error-category {
    font-size: 0.625rem;
    display: inline-block;
    padding: 0.0625rem 0.25rem;
    border-radius: 9999px;
    margin-left: 0.25rem;
}

.error-category-transient { background: #fef3c7; color: #92400e; }
.error-category-config { background: #dbeafe; color: #1d4ed8; }
.error-category-permission { background: #f3e8ff; color: #7c3aed; }
.error-category-permanent { background: #fee2e2; color: #dc2626; }

/* ==========================================================================
   Scheduler Status
   ========================================================================== */
.scheduler-status {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.scheduler-status .stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.scheduler-status .stat-value {
    font-weight: 600;
    font-size: inherit;
}

/* ==========================================================================
   Help Icons & Inline Help
   ========================================================================== */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: help;
    margin-left: 0.375rem;
    vertical-align: middle;
}

.help-icon:hover {
    background: #e2e8f0;
    color: var(--text);
}

/* Tooltip styles for help icons */
.label-with-help {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.label-with-help label {
    margin-bottom: 0;
}

/* Field hint text below inputs */
.field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.field-hint code {
    background: #f1f5f9;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
}

/* ==========================================================================
   Sync Progress Indicator
   ========================================================================== */
.sync-progress {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.sync-progress.active {
    display: block;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border);
    transform: translateY(-50%);
    z-index: 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    position: relative;
    z-index: 1;
}

.progress-step .step-icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.progress-step.active .step-icon {
    border-color: var(--primary);
    color: var(--primary);
}

.progress-step.completed .step-icon {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.progress-step.error .step-icon {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

.progress-step .step-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.progress-step.active .step-label {
    color: var(--primary);
    font-weight: 500;
}

.progress-step.completed .step-label {
    color: var(--success);
}

/* Progress bar animation */
.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-bar-fill.indeterminate {
    width: 30%;
    animation: indeterminate 1.5s infinite ease-in-out;
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* ==========================================================================
   Collapsible Sections (Progressive Disclosure)
   ========================================================================== */
.collapsible-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.collapsible-section summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.collapsible-section summary::-webkit-details-marker {
    display: none;
}

.collapsible-section summary::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid var(--text-muted);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 0.2s ease;
}

.collapsible-section[open] summary::before {
    transform: rotate(90deg);
}

.collapsible-section summary:hover {
    color: var(--text);
}

.collapsible-section .collapsible-content {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

/* ==========================================================================
   Quick Insert Buttons (SQL Examples)
   ========================================================================== */
.quick-insert-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.quick-insert-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.quick-insert-btn:hover {
    background: #e2e8f0;
    color: var(--text);
    border-color: #cbd5e1;
}

/* ==========================================================================
   Navigation Dropdowns
   ========================================================================== */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    padding: 0.25rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-dropdown-toggle:hover {
    color: var(--primary);
}

.nav-dropdown-toggle::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    margin-left: 0.25rem;
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    z-index: 100;
    display: none;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-menu:hover {
    display: block;
    animation: dropdownFadeIn 0.15s ease-out;
}

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

/* Prevent accidental dropdown triggers with delay */
.nav-dropdown .nav-dropdown-menu {
    transition: visibility 0s linear 0.1s;
    visibility: hidden;
}

.nav-dropdown:hover .nav-dropdown-menu {
    visibility: visible;
    transition-delay: 0s;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
}

.nav-dropdown-menu a:hover {
    background: var(--bg);
    color: var(--primary);
}

.nav-dropdown-menu a.active {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
    font-weight: 500;
    border-left: 3px solid var(--primary);
    padding-left: calc(1rem - 3px);
}

.nav-dropdown-menu a.nav-disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.nav-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

/* ==========================================================================
   Tier Usage Meters
   ========================================================================== */
.tier-usage-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 0.75rem;
}

.usage-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.usage-item .usage-label {
    color: var(--text-muted);
}

.usage-item .usage-value {
    font-weight: 500;
    color: var(--text);
}

.usage-item .usage-value.warning {
    color: var(--warning);
}

.usage-item .usage-value.error {
    color: var(--error);
}

.usage-divider {
    width: 1px;
    height: 1rem;
    background: var(--border);
}

.upgrade-link {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.upgrade-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Section Visibility (for simplified index layout)
   ========================================================================== */
.section-collapsed {
    display: none;
}

.section-collapsed.show {
    display: block;
}

.toggle-section-btn {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

.toggle-section-btn:hover {
    color: var(--primary);
}

/* ==========================================================================
   Tier Alerts (Upgrade Prompts)
   ========================================================================== */
.tier-alert {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    gap: 1rem;
}

.tier-alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.tier-alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.tier-alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.tier-alert-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.tier-alert-content strong {
    font-weight: 600;
}

.tier-alert-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.tier-alert-cta {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid currentColor;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
}

.tier-alert-cta:hover {
    background: white;
    transform: translateY(-1px);
}

.tier-alert-dismiss {
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0;
}

.tier-alert-dismiss:hover {
    opacity: 1;
}

@media (max-width: 640px) {
    .tier-alert {
        flex-direction: column;
        align-items: flex-start;
    }

    .tier-alert-actions {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
    }
}

/* ==========================================================================
   Visual Query Builder (Phase 3)
   ========================================================================== */

/* Query mode tabs */
.query-mode-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.query-mode-tabs .tab {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}

.query-mode-tabs .tab:hover {
    color: var(--text);
}

.query-mode-tabs .tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.query-mode-tabs .tab svg {
    flex-shrink: 0;
}

/* Query panels */
.query-panel {
    margin-bottom: 1rem;
}

/* Column checkboxes grid */
.column-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.column-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
}

.column-checkbox:hover {
    background: #e2e8f0;
}

.column-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    cursor: pointer;
}

.column-checkbox .column-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.column-checkbox .column-type {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    background: #f1f5f9;
    padding: 0.0625rem 0.25rem;
    border-radius: 2px;
}

/* Filter rows */
.filter-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.filter-row .form-select,
.filter-row .form-control {
    font-size: 0.8125rem;
    padding: 0.375rem 0.5rem;
}

.filter-row .filter-remove {
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    line-height: 1;
}

.filter-column {
    min-width: 120px;
}

.filter-operator {
    min-width: 100px;
}

.filter-value {
    min-width: 100px;
}

/* Range slider for limit */
.form-range {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* Code editor textarea */
.code-editor {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.5;
    tab-size: 2;
}

/* Button link style */
.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

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

/* Responsive adjustments for query builder */
@media (max-width: 640px) {
    .column-checkboxes {
        grid-template-columns: 1fr;
    }

    .filter-row {
        grid-template-columns: 1fr;
        gap: 0.375rem;
    }

    .filter-row .filter-remove {
        justify-self: end;
    }
}

/* ==========================================================================
   Onboarding Checklist (Phase 5)
   ========================================================================== */

.onboarding-checklist {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.checklist-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.checklist-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
    flex-shrink: 0;
}

.checklist-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}

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

.progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-muted);
}

.checklist-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.checklist-items li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bg);
    font-size: 0.8125rem;
}

.checklist-items li:last-child {
    border-bottom: none;
}

.checklist-items li.completed {
    color: var(--success);
}

.checklist-items li.completed .item-text {
    text-decoration: line-through;
    opacity: 0.7;
}

.check-icon {
    width: 1.25rem;
    text-align: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.item-text {
    flex: 1;
}

.action-link {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
}

.action-link:hover {
    text-decoration: underline;
}

.completion-message {
    text-align: center;
    padding: 0.75rem;
    background: #dcfce7;
    border-radius: var(--radius);
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--success);
}

.dismiss-checklist {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Collapsible checklist */
.onboarding-checklist.collapsible.collapsed .checklist-items,
.onboarding-checklist.collapsible.collapsed .completion-message {
    display: none;
}

/* ==========================================================================
   Breadcrumb Navigation (Phase 5)
   ========================================================================== */

.breadcrumb-nav {
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.8125rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.breadcrumb-item a:hover {
    color: var(--primary);
}

.breadcrumb-item.active {
    color: var(--text);
    font-weight: 500;
}

.breadcrumb .home-icon {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
   Keyboard Shortcuts Modal (Phase 5)
   ========================================================================== */

.modal.open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 1rem 0;
}

.shortcut-group h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.shortcut-group dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.375rem 1rem;
    margin: 0;
}

.shortcut-group dt {
    text-align: right;
    white-space: nowrap;
}

.shortcut-group dd {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text);
}

kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    box-shadow: 0 1px 0 var(--border);
    color: var(--text);
}

/* ==========================================================================
   Navigation Sections (Phase 5)
   ========================================================================== */

.nav-section {
    margin-bottom: 0.75rem;
}

.nav-section-title {
    font-size: 0.6875rem;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.nav-section-title.clickable {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-section-title.clickable:hover {
    color: var(--text);
}

.collapse-chevron {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.nav-section.collapsible.collapsed .nav-section-items {
    display: none;
}

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

.nav-item.external {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.external-icon {
    width: 10px;
    height: 10px;
    opacity: 0.5;
}

/* ==========================================================================
   Shortcuts Modal Additional Styles (Phase 5)
   ========================================================================== */

.shortcuts-modal .modal-content {
    max-width: 550px;
}

.shortcuts-list {
    margin: 0;
    padding: 0;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0;
}

.shortcut-item dt {
    text-align: right;
    min-width: 70px;
    white-space: nowrap;
}

.shortcut-item dd {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    gap: 1rem;
}

.shortcuts-tip {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

.shortcuts-tip kbd {
    background: var(--primary);
    color: white;
    border: none;
}

.nav-shortcuts-hint {
    padding: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.nav-shortcuts-hint kbd {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.6875rem;
}

/* ==========================================================================
   Sidebar Layout System
   ========================================================================== */

/* Sidebar container */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 240px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.dark .sidebar {
    background: #1e293b;
    border-color: #334155;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-shortcuts-hint,
.sidebar.collapsed .sidebar-user-info {
    display: none;
}

.sidebar.collapsed .sidebar-logo-full {
    display: none;
}

.sidebar.collapsed .sidebar-logo-icon {
    display: block;
}

/* Sidebar header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    min-height: 64px;
}

.dark .sidebar-header {
    border-color: #334155;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.875rem;
}

.sidebar-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.sidebar-logo-full {
    display: block;
}

.sidebar-toggle {
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-toggle:hover {
    background: var(--bg);
    color: var(--text);
}

/* Sidebar content (scrollable) */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

/* Sidebar Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-nav .nav-section {
    padding: 0.5rem 0;
}

.sidebar-nav .nav-section-title {
    padding: 0.5rem 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.sidebar-nav .nav-section-title.clickable {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-nav .nav-section-title.clickable:hover {
    color: var(--text);
}

.sidebar-nav .nav-section.collapsed .nav-section-items {
    display: none;
}

.sidebar-nav .nav-section .collapse-chevron {
    transition: transform 0.2s ease;
}

.sidebar-nav .nav-section.collapsed .collapse-chevron {
    transform: rotate(-90deg);
}

.sidebar-nav .nav-section-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 0.875rem;
}

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

.sidebar-nav .nav-item.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    font-weight: 500;
    border-right: 2px solid var(--primary);
}

.dark .sidebar-nav .nav-item.active {
    background: rgba(59, 130, 246, 0.15);
}

.dark .sidebar-nav .nav-item:hover {
    background: #334155;
}

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

.sidebar-nav .external-link-icon {
    width: 12px;
    height: 12px;
    margin-left: auto;
    opacity: 0.5;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* Dark mode toggle button */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 1rem;
    margin-bottom: 0.75rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dark-mode-toggle:hover {
    background: var(--bg);
    color: var(--text);
    border-color: var(--primary);
}

.dark-mode-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.dark-mode-icon.sun-icon {
    display: none;
}

.dark .dark-mode-icon.sun-icon {
    display: block;
}

.dark .dark-mode-icon.moon-icon {
    display: none;
}

/* Collapsed sidebar - hide text */
.sidebar.collapsed .dark-mode-toggle {
    justify-content: center;
    padding: 0.625rem;
}

.sidebar.collapsed .dark-mode-toggle .sidebar-text {
    display: none;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

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

.sidebar-user-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .sidebar-user-name {
    color: #f1f5f9;
}

.sidebar-user-role {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.dark .sidebar-user-avatar {
    background: #334155;
    color: #94a3b8;
}

/* Main content with sidebar */
.has-sidebar .main-content {
    margin-left: 240px;
    transition: margin-left 0.2s ease;
}

.dark .main-content {
    background: #0f172a;
}

.dark h1, .dark h2, .dark h3 {
    color: #f1f5f9;
}

.dark .version {
    color: #94a3b8;
}

.has-sidebar.sidebar-collapsed .main-content {
    margin-left: 64px;
}

/* Mobile hamburger button */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 150;
    padding: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.mobile-nav-toggle svg {
    width: 20px;
    height: 20px;
    color: var(--text);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.sidebar-overlay.active {
    display: block;
}

/* Mobile responsive */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

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

    .mobile-nav-toggle {
        display: block;
    }

    .has-sidebar .main-content {
        padding-top: 4rem;
    }
}

/* Onboarding wrapper for layout */
.onboarding-wrapper {
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Page Transition Loading Bar (Phase 3)
   ========================================================================== */

.page-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 9999;
    pointer-events: none;
}

.page-loading-bar .bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    transition: width 0.2s ease;
}

.page-loading-bar.loading .bar {
    animation: pageLoadProgress 2s ease-in-out infinite;
}

@keyframes pageLoadProgress {
    0% { width: 0%; }
    20% { width: 30%; }
    50% { width: 60%; }
    80% { width: 85%; }
    100% { width: 85%; }
}

.page-loading-bar.complete .bar {
    width: 100%;
    animation: none;
    transition: width 0.2s ease, opacity 0.3s ease 0.2s;
    opacity: 0;
}

/* ==========================================================================
   Loading Skeleton (Phase 3)
   ========================================================================== */

.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.medium {
    width: 70%;
}

.skeleton-text.long {
    width: 90%;
}

.skeleton-row {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.skeleton-cell {
    height: 1rem;
    flex: 1;
}

.skeleton-cell.narrow {
    flex: 0 0 80px;
}

.skeleton-cell.wide {
    flex: 2;
}

.skeleton-table {
    width: 100%;
}

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

/* ==========================================================================
   Enhanced Onboarding Checklist (Phase 4)
   ========================================================================== */

.checklist-items li.pending .check-icon {
    animation: pendingPulse 2s ease-in-out infinite;
}

@keyframes pendingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.checklist-items li .time-estimate {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}

/* ==========================================================================
   Improved First-Run Banner (Phase 4)
   ========================================================================== */

.first-run-banner {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.first-run-banner .banner-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.first-run-banner .banner-icon {
    width: 2rem;
    height: 2rem;
    background: #f59e0b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.first-run-banner h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #92400e;
    margin: 0;
}

.first-run-banner .step-indicator {
    font-size: 0.75rem;
    color: #92400e;
    opacity: 0.8;
    margin-left: auto;
}

.first-run-banner .credentials-box {
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 0.75rem 0;
}

.first-run-banner .credential-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.first-run-banner .credential-row:last-child {
    margin-bottom: 0;
}

.first-run-banner .credential-label {
    font-size: 0.8125rem;
    color: #92400e;
    font-weight: 500;
    min-width: 70px;
}

.first-run-banner .credential-value {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text);
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex: 1;
}

.first-run-banner .credential-value.password {
    letter-spacing: 0.05em;
}

.first-run-banner .copy-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.15s ease;
}

.first-run-banner .copy-btn:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

.first-run-banner .copy-btn.copied {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.first-run-banner .banner-warning {
    font-size: 0.8125rem;
    color: #92400e;
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.first-run-banner .banner-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.first-run-banner .dismiss-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #92400e;
    cursor: pointer;
    opacity: 0.7;
    padding: 0.25rem;
    line-height: 1;
}

.first-run-banner .dismiss-btn:hover {
    opacity: 1;
}

/* ==========================================================================
   Keyboard Shortcuts Hint Badge (Phase 2)
   ========================================================================== */

.shortcuts-hint-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.shortcuts-hint-badge:hover {
    background: #e2e8f0;
    color: var(--text);
}

.shortcuts-hint-badge kbd {
    font-size: 0.625rem;
    padding: 0 0.25rem;
    background: white;
    margin-left: 0.125rem;
}

/* Hide after 3 visits */
.shortcuts-hint-badge.dismissed {
    display: none;
}

/* ==========================================================================
   Input Debounce Visual Feedback (Phase 3)
   ========================================================================== */

input.debouncing,
textarea.debouncing {
    border-color: var(--primary);
    background-image: linear-gradient(90deg, transparent 0%, rgba(37, 99, 235, 0.05) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: debounceShimmer 1s ease-in-out;
}

@keyframes debounceShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   Sync Progress Enhancements (Phase 1)
   ========================================================================== */

.progress-message {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.progress-message .row-count {
    font-weight: 500;
    color: var(--primary);
}

.progress-message .time-estimate {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* ==========================================================================
   Dark Mode Variants
   ========================================================================== */

/* Tier Alerts - Dark Mode */
.dark .tier-alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border-color: #3b82f6;
}

.dark .tier-alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border-color: #f59e0b;
}

.dark .tier-alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: #ef4444;
}

.dark .tier-alert-cta {
    background: rgba(0, 0, 0, 0.3);
}

.dark .tier-alert-cta:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Error Code/Category Badges - Dark Mode */
.dark .error-code {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.dark .error-category-transient {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.dark .error-category-config {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.dark .error-category-permission {
    background: rgba(168, 85, 247, 0.2);
    color: #c4b5fd;
}

.dark .error-category-permanent {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Help Icon - Dark Mode */
.dark .help-icon {
    background: var(--bg-hover);
    border-color: var(--border);
}

.dark .help-icon:hover {
    background: #334155;
    color: #f1f5f9;
}

/* Field Hint Code - Dark Mode */
.dark .field-hint code {
    background: #334155;
    color: #e2e8f0;
}

/* Column Checkbox - Dark Mode */
.dark .column-checkbox:hover {
    background: #334155;
}

.dark .column-checkbox .column-type {
    background: #334155;
    color: #94a3b8;
}

/* Quick Insert Buttons - Dark Mode */
.dark .quick-insert-btn {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-muted);
}

.dark .quick-insert-btn:hover {
    background: #334155;
    color: #f1f5f9;
    border-color: #475569;
}

/* Shortcuts Hint Badge - Dark Mode */
.dark .shortcuts-hint-badge {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-muted);
}

.dark .shortcuts-hint-badge:hover {
    background: #334155;
    color: #f1f5f9;
}

.dark .shortcuts-hint-badge kbd {
    background: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
}

/* First-Run Banner - Dark Mode */
.dark .first-run-banner {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.15) 100%);
    border-color: #b45309;
}

.dark .first-run-banner h3,
.dark .first-run-banner .step-indicator {
    color: #fcd34d;
}

.dark .first-run-banner .banner-icon {
    background: #b45309;
}

.dark .first-run-banner .credentials-box {
    background: rgba(0, 0, 0, 0.3);
}

.dark .first-run-banner .credential-label {
    color: #fcd34d;
}

.dark .first-run-banner .credential-value {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #475569;
}

.dark .first-run-banner .copy-btn {
    background: #1e293b;
    border-color: #475569;
    color: #f1f5f9;
}

.dark .first-run-banner .copy-btn:hover {
    background: #334155;
    border-color: var(--primary);
    color: var(--primary);
}

.dark .first-run-banner .copy-btn.copied {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.dark .first-run-banner .banner-warning {
    color: #fcd34d;
}

.dark .first-run-banner .dismiss-btn {
    color: #fcd34d;
}

/* Super Admin Section - Dark Mode */
.super-admin-title {
    color: #a855f7;
}

.dark .super-admin-title {
    color: #c4b5fd;
}

.super-admin-link {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.13) 0%, rgba(168, 85, 247, 0.13) 100%) !important;
}

.dark .super-admin-link {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.25) 0%, rgba(168, 85, 247, 0.25) 100%) !important;
}

.super-admin-icon {
    color: #7c3aed !important;
}

.dark .super-admin-icon {
    color: #a78bfa !important;
}

/* Collapsible Section - Dark Mode */
.dark .collapsible-section {
    border-color: var(--border);
}

.dark .collapsible-section summary {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.dark .collapsible-section summary:hover {
    color: var(--text);
}

.dark .collapsible-section .collapsible-content {
    border-color: var(--border);
}

/* Badges - Dark Mode */
.dark .badge-success, .dark .status-success {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.dark .badge-error, .dark .status-error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.dark .badge-warning, .dark .status-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.dark .badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.dark .status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.dark .status-disabled {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

/* Alerts - Dark Mode */
.dark .alert-success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border-color: #22c55e;
}

.dark .alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: #ef4444;
}

.dark .alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border-color: #f59e0b;
}

.dark .alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border-color: #3b82f6;
}

/* Tier Badges - Dark Mode */
.dark .tier-free {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

.dark .tier-starter {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.dark .tier-professional {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.dark .tier-enterprise {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

/* Skeleton Loading - Dark Mode */
.dark .skeleton {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    background-size: 200% 100%;
}

/* Save/Remove Buttons - Dark Mode */
.dark .save-btn {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text);
}

.dark .save-btn:hover {
    background: #334155;
}

.dark .remove-btn {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #fca5a5;
}

.dark .remove-btn:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* Modal - Dark Mode */
.dark .modal-content {
    background: var(--card-bg);
    border-color: var(--border);
}

.dark .modal-header h3 {
    color: var(--text);
}

.dark .modal-close {
    color: var(--text-muted);
}

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

.dark .modal-footer {
    border-color: var(--border);
}

/* Keyboard Shortcuts Modal - Dark Mode */
.dark .shortcut-group h4 {
    color: var(--text-muted);
}

.dark .shortcut-group dd {
    color: var(--text);
}

.dark kbd {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text);
    box-shadow: 0 1px 0 var(--border);
}

.dark .shortcuts-tip kbd {
    background: var(--primary);
    color: white;
    border: none;
}

/* Onboarding Checklist - Dark Mode */
.dark .onboarding-checklist {
    background: var(--card-bg);
    border-color: var(--border);
}

.dark .checklist-items li {
    border-color: var(--bg-hover);
}

.dark .checklist-items li.completed {
    color: var(--success);
}

.dark .completion-message {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

/* Query Builder - Dark Mode */
.dark .column-checkboxes {
    background: var(--bg-hover);
    border-color: var(--border);
}

.dark .column-checkbox .column-name {
    color: var(--text);
}

.dark .query-mode-tabs .tab {
    color: var(--text-muted);
}

.dark .query-mode-tabs .tab:hover {
    color: var(--text);
}

.dark .query-mode-tabs .tab.active {
    color: var(--primary);
}

/* Loading Spinner - Dark Mode */
.dark .loading {
    border-color: #475569;
    border-top-color: var(--primary);
}
