/* CSS Variables */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --bg-card: #1f2940;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --text-muted: #6c6c6c;
    --accent-primary: #4a9eff;
    --accent-secondary: #7c3aed;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;
    --border-color: #2d3748;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --radius: 8px;
    --radius-lg: 12px;
}

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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* App Layout */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

.app-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.tab-nav {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

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

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

.app-content {
    flex: 1;
    padding: 2rem;
    width: 100%;
    position: relative;
}

/* Constrain upload tab width */
#tab-upload {
    max-width: 1200px;
    margin: 0 auto;
}

.app-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-branding {
    color: var(--text-secondary);
}

/* Tab Content */
.tab-content {
    display: none;
}

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

/* Warning Banner */
.warning-banner {
    background: var(--accent-warning);
    color: #000;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.warning-icon {
    font-size: 1.25rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

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

.loading-message {
    margin-top: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
}

/* Status Section */
.status-section {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.status-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.status-card h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

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

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

.status-dot.pending {
    background: var(--accent-warning);
    animation: pulse 1.5s infinite;
}

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

.status-dot.error {
    background: var(--accent-error);
}

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

.existing-tables-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.table-tag {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.table-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.25rem;
    border-radius: 50%;
    transition: all 0.15s;
}

.table-delete-btn:hover {
    background: var(--accent-error);
    color: white;
}

.empty-state {
    color: var(--text-muted);
    font-style: italic;
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--bg-card);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(74, 158, 255, 0.05);
}

.file-input {
    display: none;
}

.upload-label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    font-size: 3rem;
}

.upload-icon-img {
    width: 150px;
    height: 150px;
    object-fit: contain;
}

.upload-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.upload-primary {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.upload-secondary {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Config Section */
.config-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.config-section h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.config-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.sheets-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

/* Sheet Card */
.sheet-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.sheet-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
}

.sheet-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.sheet-info {
    flex: 1;
}

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

.sheet-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sheet-table-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sheet-table-name label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sheet-table-name input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.4rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 200px;
}

.sheet-table-name input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.sheet-columns {
    padding: 1rem;
}

.columns-toggle {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.columns-toggle:hover {
    text-decoration: underline;
}

.columns-list {
    margin-top: 0.75rem;
    display: none;
    overflow-x: auto;
}

.columns-list.expanded {
    display: block;
}

.column-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    table-layout: auto;
}

.column-table th,
.column-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.column-table th {
    color: var(--text-secondary);
    font-weight: 500;
}

.column-type {
    color: var(--accent-secondary);
    font-family: monospace;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: #3d8be6;
}

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

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

/* Results Section */
.results-section {
    margin-top: 1.5rem;
}

.results-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.results-card.success {
    border-color: var(--accent-success);
}

.results-card h3 {
    color: var(--accent-success);
    margin-bottom: 1rem;
}

#results-summary {
    color: var(--text-secondary);
}

#results-summary ul {
    list-style: none;
    margin-top: 0.5rem;
}

#results-summary li {
    padding: 0.25rem 0;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   QUERY EDITOR TAB STYLES
   ======================================== */

/* Query Layout - 3 panel design */
.query-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1rem;
    height: calc(100vh - 180px);
    min-height: 500px;
}

/* Schema Panel (Left) */
.schema-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.panel-header h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 0;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    border-radius: var(--radius);
}

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

.schema-tree {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Tree View Styles */
.tree-table {
    margin-bottom: 0.25rem;
}

.tree-table-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.15s;
}

.tree-table-header:hover {
    background: var(--bg-tertiary);
}

.tree-toggle {
    color: var(--text-muted);
    font-size: 0.7rem;
    width: 1rem;
    text-align: center;
}

.tree-table-icon {
    color: var(--accent-primary);
    font-size: 0.9rem;
}

.tree-table-name {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.tree-columns {
    display: none;
    padding-left: 1.5rem;
}

.tree-columns.expanded {
    display: block;
}

.tree-column {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
}

.tree-column-icon {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.tree-column-name {
    color: var(--text-secondary);
}

.tree-column-type {
    color: var(--accent-secondary);
    font-family: monospace;
    font-size: 0.75rem;
    margin-left: auto;
}

/* Main Panel */
.main-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

/* Editor Section */
.editor-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.btn-icon-text {
    margin-right: 0.25rem;
}

.query-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.query-status.running {
    color: var(--accent-warning);
}

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

.query-status.error {
    color: var(--accent-error);
}

.sql-editor {
    background: var(--bg-primary);
    border-radius: var(--radius);
    overflow: hidden;
}

/* Results Panel */
.results-panel {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 200px;
    overflow: hidden;
}

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

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

.results-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.results-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.results-grid {
    flex: 1;
    min-height: 0;
}

/* AG-Grid Dark Theme Overrides */
.ag-theme-quartz-dark {
    --ag-background-color: var(--bg-card);
    --ag-header-background-color: var(--bg-tertiary);
    --ag-odd-row-background-color: var(--bg-secondary);
    --ag-row-hover-color: var(--bg-tertiary);
    --ag-border-color: var(--border-color);
    --ag-header-foreground-color: var(--text-secondary);
    --ag-foreground-color: var(--text-primary);
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    min-width: 180px;
    padding: 0.25rem 0;
}

.context-menu-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: background 0.15s;
}

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

/* Query Error Display */
.query-error {
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--accent-error);
    border-radius: var(--radius);
    margin: 1rem;
    color: var(--accent-error);
    font-family: monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
}

/* Batch Results Display */
.batch-results {
    padding: 1rem;
    color: var(--text-primary);
}

.batch-results-header {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.batch-results-summary {
    font-size: 0.9rem;
    color: var(--accent-success);
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: var(--radius);
}

.batch-results-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.batch-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.batch-result-item.success {
    border-left: 3px solid var(--accent-success);
}

.batch-result-item.error {
    border-left: 3px solid var(--accent-error);
    background: rgba(239, 68, 68, 0.1);
}

.batch-result-icon {
    font-size: 1rem;
}

.batch-result-item.success .batch-result-icon {
    color: var(--accent-success);
}

.batch-result-item.error .batch-result-icon {
    color: var(--accent-error);
}

.batch-result-num {
    color: var(--text-secondary);
    min-width: 85px;
}

.batch-result-type {
    color: var(--accent-secondary);
    font-family: monospace;
    font-size: 0.8rem;
    min-width: 70px;
}

.batch-result-detail {
    color: var(--text-primary);
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 1rem;
    }

    .status-section {
        grid-template-columns: 1fr;
    }

    .sheet-header {
        flex-wrap: wrap;
    }

    .sheet-table-name {
        width: 100%;
        margin-top: 0.5rem;
    }

    .sheet-table-name input {
        flex: 1;
    }

    .query-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .schema-panel {
        max-height: 200px;
    }

    .results-toolbar {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

/* ========================================
   DASHBOARD STYLES
   ======================================== */

/* Dashboard View Container */
.dashboard-view {
    max-width: 1400px;
    margin: 0 auto;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.dashboard-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.dashboard-header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Dashboard List */
.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.dashboard-list-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.dashboard-list-info {
    flex: 1;
}

.dashboard-list-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.dashboard-list-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

/* Dashboard Form */
.dashboard-form {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

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

.form-input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

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

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

/* Cards Section */
.cards-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

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

.cards-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Card List */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: grab;
    transition: all 0.15s;
}

.card-list-item:hover {
    border-color: var(--accent-primary);
}

.card-list-item.dragging {
    opacity: 0.5;
    border-style: dashed;
}

.card-drag-handle {
    color: var(--text-muted);
    font-size: 1rem;
    cursor: grab;
}

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

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

.card-list-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.card-list-actions {
    display: flex;
    gap: 0.35rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

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

.modal-footer-right {
    display: flex;
    gap: 0.75rem;
}

/* Card Config Area */
.card-config-area {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.config-blurb {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Button Variants */
.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

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

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

/* ========================================
   DASHBOARD VIEWER STYLES
   ======================================== */

/* Viewer Header */
.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.viewer-load-options {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.viewer-load-options .form-group {
    margin-bottom: 0;
    min-width: 250px;
}

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

/* Paste JSON Area */
.paste-json-area {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.paste-json-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Dashboard Title in Viewer */
.viewer-dashboard-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.viewer-dashboard-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Dashboard Grid (2 columns) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Dashboard Card */
.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

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

.dashboard-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dashboard-card-body {
    padding: 1.25rem;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-card-body-table {
    padding: 0;
    display: block;
    min-height: 200px;
    max-height: 400px;
    overflow: auto;
}

.dashboard-grid-container {
    width: 100%;
    min-height: 200px;
}

/* Chart Container */
.chart-container {
    width: 100%;
    height: 100%;
    min-height: 220px;
    position: relative;
}

/* HTML Block Card */
.html-block-content {
    width: 100%;
    color: var(--text-primary);
    line-height: 1.6;
}

.html-block-content h1,
.html-block-content h2,
.html-block-content h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.html-block-content p {
    margin-bottom: 0.75rem;
}

.html-block-content a {
    color: var(--accent-primary);
}

/* Icon Buttons for Dashboard Import/Export */
.btn-icon-only {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

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

.btn-icon-only svg {
    width: 18px;
    height: 18px;
}

/* File input hidden but accessible */
.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Responsive Dashboard Grid */
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .viewer-header {
        flex-direction: column;
        align-items: stretch;
    }

    .viewer-load-options {
        flex-direction: column;
    }

    .viewer-load-options .form-group {
        min-width: auto;
    }

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

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
}
