/* =============================================================================
   odata2sql Server - Styles
   ============================================================================= */

:root {
    /* Layout */
    --sidebar-width: 250px;
    --top-bar-height: 50px;
    /* Colors */
    --color-primary: #008E8D;
    --color-secondary: #005576;
    --color-bg: #f8fafc;
    --color-surface: #fff;
    --color-surface-alt: #f1f5f9;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-secondary: #334155;
    --color-text-muted: #64748b;
    --color-text-hover: #1e293b;
    --color-hover-bg: #e2e8f0;
    --color-shadow: rgba(0, 0, 0, 0.08);
    /* Auth */
    --color-auth-bg: #eef2f6;
    /* Badges */
    --badge-active-bg: #dcfce7; --badge-active-text: #166534;
    --badge-inactive-bg: #fee2e2; --badge-inactive-text: #991b1b;
    --badge-running-bg: #ccfbf1; --badge-running-text: #065f5b;
    --badge-warning-bg: #fef3c7; --badge-warning-text: #92400e;
    --badge-pending-bg: #f1f5f9; --badge-pending-text: #475569;
    --badge-cancelled-bg: #e2e8f0; --badge-cancelled-text: #64748b;
    --badge-info-bg: #d9eef7; --badge-info-text: #005576;
    /* Feedback */
    --color-error-bg: #fee2e2; --color-error-text: #991b1b;
    --color-success-bg: #dcfce7; --color-success-text: #166534;
}

[data-theme="dark"] {
    --color-primary: #4ecdc4;
    --color-secondary: #6bb8d6;
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-surface-alt: #334155;
    --color-border: #475569;
    --color-text: #f1f5f9;
    --color-text-secondary: #e2e8f0;
    --color-text-muted: #94a3b8;
    --color-text-hover: #f8fafc;
    --color-hover-bg: #334155;
    --color-shadow: rgba(0, 0, 0, 0.3);
    --color-auth-bg: #0f172a;
    --badge-active-bg: #166534; --badge-active-text: #dcfce7;
    --badge-inactive-bg: #991b1b; --badge-inactive-text: #fee2e2;
    --badge-running-bg: #065f5b; --badge-running-text: #ccfbf1;
    --badge-warning-bg: #92400e; --badge-warning-text: #fef3c7;
    --badge-pending-bg: #334155; --badge-pending-text: #94a3b8;
    --badge-cancelled-bg: #475569; --badge-cancelled-text: #94a3b8;
    --badge-info-bg: #005576; --badge-info-text: #d9eef7;
    --color-error-bg: #450a0a; --color-error-text: #fca5a5;
    --color-success-bg: #14532d; --color-success-text: #bbf7d0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Avenir Next', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

/* ===== Main Layout ===== */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface-alt);
    border-right: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    transition: width 0.2s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    min-height: 53px;
}

/* Sidebar logo */
.sidebar-logo {
    height: 28px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-logo-dark {
    display: none;
}

[data-theme="dark"] .sidebar-logo-light {
    display: none;
}

[data-theme="dark"] .sidebar-logo-dark {
    display: block;
}

.sidebar-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 2px 8px;
    line-height: 1;
    flex-shrink: 0;
}

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

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    min-width: 0;
}

.top-bar {
    height: var(--top-bar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
}

.top-bar-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-bar-spacer {
    flex: 1;
}

.expand-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 2px 8px;
    line-height: 1;
}

.expand-toggle:hover {
    background: var(--color-surface-alt);
    color: var(--color-text-hover);
}

.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.content-area > h1:first-child {
    display: none;
}

/* ===== Navigation Menu ===== */
.nav-menu {
    padding: 8px 0;
    overflow-y: auto;
    flex: 1;
}

.nav-menu-items {
    background: transparent !important;
    border: none !important;
}

/* ===== Auth Layout (Login, Setup, Access Denied) ===== */
.auth-layout {
    min-height: 100vh;
    background: var(--color-auth-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.auth-layout-header {
    text-align: center;
    margin-bottom: 32px;
}

/* Auth logo */
.auth-logo {
    height: 80px;
    width: auto;
}

.auth-logo-dark {
    display: none;
}

[data-theme="dark"] .auth-logo-light {
    display: none;
}

[data-theme="dark"] .auth-logo-dark {
    display: inline;
}

.auth-layout-content {
    width: 100%;
    max-width: 420px;
    padding: 0 16px;
}

.auth-container {
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: 0 2px 12px var(--color-shadow);
    padding: 40px 36px 36px;
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 4px;
}

.auth-container > p {
    text-align: center;
    color: var(--color-text-muted);
    margin-top: 0;
    margin-bottom: 24px;
}

/* ===== Grid ===== */
.api-sources-grid,
.sync-jobs-grid,
.detail-grid {
    margin-top: 16px;
}

/* Toolbar SVG icons (replacing dx-icon-* font that doesn't render) */
.tb-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: currentColor;
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
}
.tb-icon-add {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E");
}
.tb-icon-play {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='5 3 19 12 5 21 5 3'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='5 3 19 12 5 21 5 3'/%3E%3C/svg%3E");
}
.tb-icon-clock {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
}

/* Grid action icons */
.grid-actions { display: flex; gap: 2px; align-items: center; justify-content: center; }
.grid-action-separator { width: 1px; height: 16px; background: var(--color-border, #e2e8f0); margin: 0 4px; }
.grid-action-btn { cursor: pointer; padding: 4px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; background: none; border: none; color: var(--color-text-muted, #64748b); }
.grid-action-btn:hover { color: var(--color-primary, #008E8D); background: var(--color-hover-bg, #e2e8f0); }
.grid-action-btn.danger:hover { color: #dc3545; }
.grid-action-btn svg { width: 16px; height: 16px; }

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-active,
.badge-completed {
    background: var(--badge-active-bg);
    color: var(--badge-active-text);
}

.badge-inactive,
.badge-failed {
    background: var(--badge-inactive-bg);
    color: var(--badge-inactive-text);
}

.badge-running {
    background: var(--badge-running-bg);
    color: var(--badge-running-text);
}

.badge-warning {
    background: var(--badge-warning-bg);
    color: var(--badge-warning-text);
}

.badge-pending {
    background: var(--badge-pending-bg);
    color: var(--badge-pending-text);
}

.badge-cancelled {
    background: var(--badge-cancelled-bg);
    color: var(--badge-cancelled-text);
}

.badge-info {
    background: var(--badge-info-bg);
    color: var(--badge-info-text);
}

/* ===== Headings ===== */
h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 16px 0;
    outline: none;
}

h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin: 0 0 12px 0;
}

/* ===== Detail page ===== */
.detail-status-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    width: 100%;
}

.detail-status-actions {
    margin-left: auto;
    display: flex;
    flex-shrink: 0;
    gap: 8px;
}

.detail-form {
    margin-bottom: 24px;
}

.form-value {
    padding: 6px 0;
    color: var(--color-text-secondary);
}

.error-message {
    color: var(--color-error-text);
    background: var(--color-error-bg);
    padding: 8px 12px;
    border-radius: 4px;
    white-space: pre-wrap;
    margin-bottom: 12px;
}

/* ===== Error Boundary ===== */
.error-boundary {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text);
}

.error-boundary h2 {
    color: var(--color-error-text);
    margin-bottom: 12px;
}

.error-boundary p {
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

/* ===== Action bar ===== */
.action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.job-feedback {
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border-radius: 4px;
}

.job-feedback a {
    color: var(--color-success-text);
    font-weight: 600;
}

/* ===== Tabs ===== */
.tab-empty {
    padding: 16px;
    color: var(--color-text-muted);
}

/* Edit page tab layout */
.edit-tabs .dxbl-tabs-panel {
    padding-top: 4px;
}

.edit-tab-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px 20px;
}

/* ===== Dashboard cards ===== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
}

.card-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.card-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
}

/* ===== Analytics KPI Cards ===== */
.analytics-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}
.analytics-kpi-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
.analytics-kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}
.analytics-kpi-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Documentation Explorer ===== */
.doc-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}
.doc-api-selector { max-width: 280px; flex: 1; }
.doc-search-box { max-width: 280px; flex: 1; }
.doc-table-count { font-size: 0.8rem; color: var(--color-text-muted); white-space: nowrap; }

.doc-explorer-layout {
    display: flex;
    gap: 16px;
    min-height: 500px;
}
.doc-table-list {
    width: 260px;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow-y: auto;
    max-height: 700px;
}
.doc-table-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    position: relative;
}
.doc-table-item:last-child { border-bottom: none; }
.doc-table-item:hover { background: var(--color-hover-bg); }
.doc-table-selected { background: var(--color-primary-bg, #e3f2fd); }
.doc-table-item-name { font-size: 0.85rem; font-weight: 500; }
.doc-table-selected .doc-table-item-name { font-weight: 700; }
.doc-table-item-heading { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 1px; }
.doc-table-item-badge { position: absolute; right: 8px; top: 8px; font-size: 0.65em; }

.doc-detail-panel { flex: 1; min-width: 0; }

.doc-table-header {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}
.doc-table-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.doc-table-title h4 { margin: 0; font-size: 1.1rem; }
.doc-table-description {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    line-height: 1.4;
}
.doc-table-description strong { display: block; color: var(--color-text); margin-bottom: 2px; }
.doc-table-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.doc-meta-item {
    display: flex;
    flex-direction: column;
    min-width: 80px;
}
.doc-meta-label { font-size: 0.7rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.doc-meta-value { font-size: 0.9rem; font-weight: 600; }

.doc-section { margin-bottom: 16px; }
.doc-section-title { margin: 0 0 6px 0; font-size: 0.9rem; }

.doc-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--color-text-muted);
}

/* ===== Dashboard Timeline ===== */
.timeline-section {
    margin-top: 8px;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.timeline-header h2 {
    margin: 0;
    white-space: nowrap;
}

.timeline-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.horizon-selector {
    width: 180px;
}

/* ===== Tables filter ===== */
.tables-filter-full {
    width: 100%;
    margin-bottom: 16px;
}

/* ===== Two-Factor Authentication ===== */
.security-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.qr-code-container {
    display: flex;
    justify-content: center;
    padding: 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin: 16px 0;
}

.qr-code-container img {
    image-rendering: pixelated;
}

.manual-key-section {
    text-align: center;
    margin: 16px 0;
}

.manual-key {
    display: inline-block;
    padding: 8px 16px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: var(--color-text);
    user-select: all;
}

.recovery-codes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    margin: 16px 0;
}

.recovery-code {
    display: block;
    padding: 8px 12px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    text-align: center;
    color: var(--color-text);
    user-select: all;
}

.wizard-step {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
}

/* ===== Help Caption & Icon ===== */
.help-caption {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    padding-right: 12px;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--color-text-muted);
    color: var(--color-surface);
    font-size: 0.6rem;
    font-weight: 700;
    font-style: normal;
    cursor: help;
    vertical-align: middle;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.help-icon:hover {
    opacity: 1;
}

/* ===== Secret field with toggle ===== */
.secret-field {
    display: flex;
    gap: 8px;
    align-items: center;
}

.secret-field > :first-child {
    flex: 1;
}

/* ===== ComboBox with action buttons (New, Test) ===== */
.combo-with-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.combo-with-actions > :first-child {
    flex: 1;
}

.secret-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}

.secret-toggle-btn:hover {
    color: var(--color-text);
    border-color: var(--color-text-muted);
}

.help-tooltip {
    position: fixed;
    background: var(--color-text);
    color: var(--color-bg);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.4;
    max-width: 320px;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 12px var(--color-shadow);
    opacity: 0;
    transition: opacity 0.12s;
}

/* ===== Theme Switcher ===== */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 2px;
}

.theme-switcher button {
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.theme-switcher button:hover {
    color: var(--color-text);
}

.theme-switcher button.active {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 1px 2px var(--color-shadow);
}

/* Auth layout theme switcher positioning */
.auth-theme-switcher {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
}

/* ===== Footer ===== */
.app-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    flex-shrink: 0;
}

.app-footer a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.app-footer a:hover {
    color: var(--color-text-muted);
    text-decoration: none;
}

.footer-copyright {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
}

.footer-logo-link {
    display: inline-flex;
    align-items: center;
}

.footer-logo {
    height: 16px;
    width: auto;
    display: inline-block;
}

.footer-logo.footer-logo-dark {
    display: none;
}

[data-theme="dark"] .footer-logo.footer-logo-light {
    display: none;
}

[data-theme="dark"] .footer-logo.footer-logo-dark {
    display: inline-block;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

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

.footer-separator-inline {
    display: none;
}

/* Main layout: single-line footer */
.main-content .app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    text-align: unset;
    line-height: normal;
}

.main-content .footer-copyright {
    margin-bottom: 0;
}

.main-content .footer-separator-inline {
    display: inline;
}

.footer-version {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    opacity: 0.7;
}

/* Auth layout footer spacing */
.auth-layout .app-footer {
    margin-top: 32px;
    border-top: none;
}

/* ===== Template Dropdown ===== */
.template-dropdown {
    position: relative;
    display: inline-block;
}

.template-dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 240px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 4px 0;
}

.template-dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--color-text);
    white-space: nowrap;
}

.template-dropdown-item:hover {
    background: var(--color-surface-alt);
}

/* ===== Sync Progress Bar ===== */
.sync-progress-container {
    position: relative;
    height: 22px;
    background: var(--color-surface-alt);
    border-radius: 4px;
    overflow: hidden;
    min-width: 100px;
}

.sync-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--color-primary);
    opacity: 0.25;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.sync-progress-text {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text);
    z-index: 1;
}

.sync-progress-lg {
    height: 28px;
    margin-bottom: 8px;
}

.sync-progress-lg .sync-progress-text {
    font-size: 0.85rem;
}

.sync-live-progress {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.sync-current-table {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* ===== Schedule Editor ===== */
.schedule-toolbar {
    margin-bottom: 12px;
}

/* ===== Item List Table ===== */
.item-list-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.item-list-table th, .item-list-table td { padding: 8px 10px; border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: middle; }
.item-list-table th { font-weight: 600; font-size: 0.85rem; color: var(--color-text-secondary); white-space: nowrap; }
.item-list-table td { font-size: 0.9rem; }
.item-list-table code { font-size: 0.85rem; background: var(--color-surface-alt); padding: 1px 6px; border-radius: 3px; }
.item-list-table tbody tr:hover { background: var(--color-surface-alt); }

.schedule-validation {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.schedule-validation-ok {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.schedule-validation-error {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.schedule-next-runs {
    margin: 4px 0 0;
    padding-left: 20px;
    list-style: disc;
}

.schedule-next-runs li {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
}

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

/* ===== Data Export ===== */

.export-objects-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.export-objects-table th,
.export-objects-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

.export-objects-table th {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.export-objects-table td:last-child {
    width: 80px;
    text-align: center;
}

/* ===== Dashboard layout ===== */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.dashboard-header h1 {
    margin: 0;
}

.mb-16 {
    margin-bottom: 16px;
}

/* ===== Extracted Inline Styles ===== */

/* -- Spacing utilities -- */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }

/* -- Flex button groups (popup footers, inline action groups) -- */
.btn-group-flex {
    display: flex;
    gap: 8px;
}

/* -- Toolbar left-aligned group (e.g. columns + reset) -- */
.toolbar-left-group {
    display: flex;
    gap: 8px;
    margin-right: auto;
}

/* -- Auth page centered links below forms -- */
.auth-link-centered {
    margin-top: 16px;
    text-align: center;
}

.auth-link {
    margin-top: 12px;
}

.auth-buttons-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.auth-external-divider {
    margin-top: 20px;
}

.auth-microsoft-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px 16px;
    border: 1px solid var(--color-border, #ccc);
    border-radius: 4px;
    background: var(--color-surface, #fff);
    color: var(--color-text, #333);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    box-sizing: border-box;
}

.auth-microsoft-btn:hover {
    background: var(--color-surface-hover, #f5f5f5);
    border-color: var(--color-border-hover, #999);
    text-decoration: none;
    color: var(--color-text, #333);
}

/* -- Auth toggle link (e.g. "use recovery code instead") -- */
.auth-toggle-link {
    color: var(--color-primary);
    font-size: 0.9rem;
}

/* -- OR separator text in auth pages -- */
.auth-or-divider {
    margin-bottom: 12px;
    color: var(--text-secondary, #999);
    font-size: 0.85rem;
}

/* -- Alert close button (inline dismiss) -- */
.alert-close-btn {
    float: right;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.2em;
}

/* -- Small hint/secondary text -- */
.text-sm {
    font-size: 0.85rem;
}

.text-secondary-hint {
    color: var(--text-secondary, #999);
}

.text-muted-notice {
    color: var(--text-muted, #6c757d);
}

/* -- Scrollable popup content -- */
.popup-scroll-content {
    max-height: 60vh;
    overflow: auto;
}

/* -- Pre-formatted report text -- */
.report-pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.85em;
    margin: 0;
}

/* -- Popup form layout (replaces DxFormLayout inside DxPopup to avoid dispose bugs) -- */
.popup-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.popup-form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}
.popup-form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}
.popup-form-label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--color-text-secondary);
}
.popup-form-help {
    font-size: 0.8em;
    color: var(--color-text-secondary);
    margin-top: 2px;
}
.popup-objects-table {
    width: 100%;
    border-collapse: collapse;
}
.popup-objects-table th {
    text-align: left;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--color-text-secondary);
    padding: 4px 8px 8px 0;
}
.popup-objects-table td {
    padding: 2px 8px 2px 0;
}

/* -- Cron preview -- */
.cron-preview {
    background: var(--color-bg-secondary, #f5f5f5);
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.85em;
    font-family: var(--font-mono, monospace);
}
.cron-preview-item {
    padding: 2px 0;
    color: var(--color-text-secondary);
}

/* -- Tab section padding (config export tabs) -- */
.tab-section {
    padding: 16px 0;
}

/* -- Passkey table -- */
.passkey-table {
    width: 100%;
    margin-bottom: 16px;
}

/* -- Confirmation box (e.g. passkey delete) -- */
.confirm-box {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
}

/* -- Danger zone -- */
.action-bar-danger {
    border-top-color: #fee2e2;
}

/* -- Grid action button danger color (reset sync state) -- */
.grid-action-btn-danger {
    color: var(--danger-color, #dc3545);
}

/* ===== Utility Classes ===== */
.page-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.next-execution-tiles {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.next-execution-tiles > .dashboard-card {
    flex: 1;
    min-width: 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 1000;
        height: 100vh;
    }

    .sidebar.collapsed {
        width: 0;
    }

    /* Sidebar backdrop on mobile */
    .sidebar:not(.collapsed) ~ .main-content::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
    }

    /* Touch targets for grid action buttons (44x44px minimum) */
    .grid-action-btn {
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
    }

    .grid-action-btn svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 576px) {
    /* Content area padding */
    .content-area {
        padding: 12px;
    }

    /* Top bar padding */
    .top-bar {
        padding: 0 12px;
        gap: 8px;
    }

    /* Auth container padding */
    .auth-container {
        padding: 24px 20px 20px;
    }

    .auth-layout-header {
        margin-bottom: 20px;
    }

    /* Footer responsive */
    .app-footer {
        padding: 12px;
        font-size: 0.75rem;
    }

    .main-content .app-footer {
        flex-direction: column;
        gap: 4px;
    }

    .main-content .footer-separator-inline {
        display: none;
    }

    /* Detail status bar wrapping */
    .detail-status-bar {
        flex-wrap: wrap;
    }

    .detail-status-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }

    /* Dashboard cards gap */
    .dashboard-cards {
        gap: 8px;
    }

    .dashboard-card {
        padding: 12px;
    }

    /* Secret field wrapping */
    .secret-field {
        flex-wrap: wrap;
    }

    .secret-field > :first-child {
        flex-basis: 100%;
    }


    /* Action bar/buttons wrapping */
    .action-bar {
        flex-wrap: wrap;
    }

    .action-buttons {
        width: 100%;
    }

    /* Security/Wizard padding */
    .security-section {
        padding: 16px;
    }

    .wizard-step {
        padding: 16px;
    }

    /* Next execution tiles stack on mobile */
    .next-execution-tiles {
        flex-direction: column;
    }

    /* Heading size */
    h1 {
        font-size: 1.25rem;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .content-area {
        padding: 16px;
    }
}

/* =============================================================================
   Blazor Server Reconnect Modal
   ============================================================================= */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

#components-reconnect-modal.components-reconnect-show {
    display: flex;
}

#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

.reconnect-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    text-align: center;
    box-shadow: 0 8px 32px var(--color-shadow);
    max-width: 380px;
    width: 90%;
}

.reconnect-icon {
    width: 40px;
    height: 40px;
    color: var(--color-primary);
    margin-bottom: 1rem;
    animation: reconnect-spin 1.5s linear infinite;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-icon,
#components-reconnect-modal.components-reconnect-rejected .reconnect-icon {
    animation: none;
    color: var(--badge-inactive-text);
}

@keyframes reconnect-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.reconnect-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 0.5rem;
}

.reconnect-message {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
}

.reconnect-failed-message {
    font-size: 0.875rem;
    color: var(--badge-inactive-text);
    margin: 0;
    display: none;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-message,
#components-reconnect-modal.components-reconnect-rejected .reconnect-message {
    display: none;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-failed-message,
#components-reconnect-modal.components-reconnect-rejected .reconnect-failed-message {
    display: block;
}

.reconnect-failed-message a {
    color: var(--color-primary);
    text-decoration: underline;
    font-weight: 500;
}
