* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-deep: #060a14;
    --bg-light: rgba(15, 25, 50, 0.5);
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --main-area-bg: #eef2f7;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #94a3b8;
    --text-accent: #60a5fa;
    --border-color: #1c2333;;
    --glass: rgba(15, 25, 50, 0.55);
    --glass-border: #3b82f626;
    --highlight-color: #f87171;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.35);
    --secondary-green: #34d399;
    --text-primary-darkTheme: #f1f5f9;
    --border-focus-color: rgba(59, 130, 246, 0.5);
    --bg-lightTheme: #F8FAFC;

    /* Fonts */
    --font-display: 'Space Grotesk', 'Inter', ui-sans-serif, system-ui, sans-serif;
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

}

body {
    /* font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; */
    font-family: var(--font-sans) !important;
    background: var(--bg-deep);
    min-height: 100vh;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
}

#app {
    height: calc(100vh - 127px);
}

.hidden {
    display: none !important;
}

/* Login Page with Background */
.login-page {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    background-color: #060a14;
}

.login-page.hidden {
    display: none;
}

/* Left Section - Background Image */
.login-image-section {
    width:100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-width: 0;
    min-height: 100vh;
    padding-top: 64px;
    background: var(--bg-base);
    position: relative;
    overflow: hidden;

}

.login-image-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/assets/hero-circuit.jpg') center top / cover no-repeat;
  z-index: 0;
}

.bg-mesh {
  position: relative;
  will-change: transform;
}

.bg-mesh::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) perspective(500px) rotateX(60deg) translateY(var(--scroll-offset, 0));
  width: 200%;
  height: 60%;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.07) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 80%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

.login-form-wrap::after {
  inset: 0;
  background: linear-gradient(to bottom, transparent 15%, var(--bg-base) 75%);
  z-index: 0;
}

.headerBar {
    width: 100%;
    background: #060a14cc;
    backdrop-filter: blur(16px);
    border-bottom: 1px solid #3b82f626;
    transition: background 0.3s ease;
    height: 64px;
    position: fixed;
    top: 0;
    z-index: 100;
}

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

.logo-img {
    height: 63px;
    width: auto;
}

/* Right Section - Login Form */
.login-form-section {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: end;
    padding: 2rem 1.5rem 1.5rem;
    min-width: 0;
    position: relative;
}

.login-form-wrap {
    width: 500px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-powered-wrap {
    position: absolute;
    right: 1.5rem;
    bottom: 1.5rem;
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    text-align: right;
}

.login-powered-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.02em;
    text-transform: none;
    white-space: nowrap;
}

.login-powered-img {
    width: 110px;
    height: auto;
    display: block;
    object-fit: contain;
}

.login-form-panel {
    background: rgba(15, 25, 50, 0.55);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 75%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    /* Login Page - Mobile */
    .login-page {
        flex-direction: column;
    }

    .filterMenu{
        flex-direction: column;
    }

    .filterMenu label {
        margin-top: 4px;
    }

    .autocomplete-div {
        flex-direction: column;
        width: 100% !important;
    }

    .login-form-section {
        flex: 1;
        width: 100%;
        padding: 1rem;
        background-image: url("assets/hero-circuit.jpg");
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        position: relative;
    }
    
    .login-form-section::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(10, 14, 39, 0.75);
        z-index: 0;
    }
    
    .login-form-wrap {
        position: relative;
        z-index: 1;
    }

    .login-form-panel {
        padding: 2rem 1.5rem;
    }

    .login-powered-img {
        width: 100px;
    }

    .login-powered-wrap {
        position: static;
        margin-top: 1rem;
        justify-content: center;
    }
    
    .login-welcome {
        font-size: 1.5rem;
    }
    
    .login-subtitle {
        font-size: 0.9rem;
    }
    
    /* Main App - Mobile */
    header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    header h1 {
        font-size: 1.25rem;
        font-family: var(--font-display);
    }
    
    .header-actions {
        margin-top: 0.5rem;
        width: 100%;
        justify-content: space-between;
    }
    
    .folder-tabs-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .folder-tabs {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        gap: 0.25rem;
        flex-wrap: nowrap;
        width: 100%;
        padding-bottom: 0.5rem;
    }
    
    .folder-tabs::-webkit-scrollbar {
        height: 4px;
    }
    
    .folder-tabs::-webkit-scrollbar-track {
        background: var(--border-color);
        border-radius: 2px;
    }
    
    .folder-tabs::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 2px;
    }
    
    .folder-tab {
        white-space: nowrap;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        flex-shrink: 0;
        min-width: fit-content;
    }
    
    .btn-fly {
        width: 100%;
        margin-top: 0;
    }
    
    /* Update folder tabs for left panel layout */
    .folder-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .folder-tab {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .file-content {
        padding: 1rem;
    }
    
    .file-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .file-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    /* History Page - Mobile */
    .history-page-header,
    .fly-page-header,
    .build-page-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .history-page-header h2,
    .fly-page-header h2,
    .build-page-header h2 {
        font-size: 1.25rem;
    }
    
    .history-page-content,
    .fly-page-content,
    .build-page-content {
        padding: 1rem;
    }
    
    .build-form-section .form-row {
        grid-template-columns: 1fr;
    }
    
    .history-table {
        font-size: 0.85rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .history-table thead {
        display: none;
    }
    
    .history-table tbody {
        display: block;
    }
    
    .history-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 0.75rem;
        background-color: var(--glass);
        color: var(--text-primary-darkTheme);
    }
    
    .history-table td {
        padding: 0.5rem 0;
        display: block;
        text-align: left;
        border: none;
        color: var(--text-primary-darkTheme);
    }
    
    .history-table td:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        display: inline-block;
        min-width: 80px;
        color: var(--text-secondary);
    }
    
    /* Modal - Mobile */
    .modal-content {
        width: 95%;
        max-width: 95%;
        padding: 1.5rem;
        margin: 1rem;
    }

    .modal-trash-content {
        width: 100%;
        padding: 1.5rem;
        margin: 1rem;
    }

    .alert-content {
        width: 95%;
        max-width: 95%;
        padding: 1.5rem;
        margin: 1rem;
    }

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

    .modal-trash-large {
        width: 100%;
        max-width: 100%;
        height: 100%;
    }

    /* Profile Dropdown - Mobile */
    .profile-dropdown {
        width: 100%;
        position: relative;
        z-index: 1001;
    }
    
    .dropdown-menu {
        right: 0;
        left: 0;
        width: 100%;
        z-index: 9999 !important;
        max-height: none;
        overflow: visible;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* Ensure header doesn't clip dropdown on mobile */
    header {
        overflow: visible !important;
        z-index: 1000;
    }
    
    .header-actions {
        overflow: visible !important;
        position: relative;
        z-index: 1001;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    
    .folder-tabs-container {
        flex-wrap: wrap;
    }
}

/* Modal Styles (for other modals) */
.modal {
    display: flex;
    position: fixed;
    z-index: 8889;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-1 {
    top: 125px !important;
    height: 86% !important;
}

.modal.hidden {
    display: none;
}

#appModal {
    z-index: 100030;
}

.forgotPassword-content {
    background-color: var(--bg-deep);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
    border: 1px solid var(--glass-border);
}

.modal-content {
    background-color: var(--bg-deep);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
    border: 1px solid var(--glass-border);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.modal-trash-content {
    background-color: var(--bg-deep);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    animation: slideIn 0.3s ease-out;
}

.modal-trash-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.alert-content{
    background-color: var(--bg-deep);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--border-color);
    animation: slideIn 0.3s ease-out;
}

.alert-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: start;
}

/* Form Styles for Login Page */
.form-group-icon {
    position: relative;
    margin-bottom: 1.25rem;
}

.form-group-icon input {
    width: 100%;
    padding: 0.875rem 1rem;
    background-color: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-group-icon input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-group-icon input:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: rgba(30, 41, 59, 0.9);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Password visibility toggle on login */
.form-group-password input {
    padding-right: 2.75rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.password-toggle-btn:hover {
    color: rgba(255, 255, 255, 0.95);
}

.password-toggle-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

/* When input has autofill (grey/white background), use dark icon so it stays visible */
.form-group-password:has(input:-webkit-autofill) .password-toggle-btn,
.form-group-password:has(input:autofill) .password-toggle-btn {
    color: #1e293b;
}

.form-group-password:has(input:-webkit-autofill) .password-toggle-btn:hover,
.form-group-password:has(input:autofill) .password-toggle-btn:hover {
    color: #0f172a;
}

.password-toggle-icon .icon-eye,
.password-toggle-icon .icon-eye-off {
    display: block;
}

.password-toggle-icon .icon-eye-off.hidden,
.password-toggle-icon .icon-eye.hidden {
    display: none !important;
}

.form-group-forgot {
    text-align: right;
    margin-bottom: 1.5rem;
}

.forgot-password-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.forgot-password-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.btn-login {
    width: 100%;
    padding: 0.875rem;
    /* background-color: #3b82f6; */
    background: radial-gradient(circle at center, #0a1b2e 0%, #020508 100%) !important;
    color: #ffffff;
    border: 1px solid #60a5fa4d !important;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1.5rem;
}

.btn-login:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.forgotPassword-btns {
    background: radial-gradient(circle at center, #0a1b2e 0%, #020508 100%) !important;
}

.register-submit-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.register-loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: register-spin 0.8s linear infinite;
}

.register-loading-spinner.hidden {
    display: none;
}

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

.app-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 100020;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
}

.app-loading-overlay.hidden {
    display: none;
}

.app-loading-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.75rem 2rem;
    border-radius: 12px;
    background: var(--panel-bg, rgba(30, 41, 59, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.app-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--text-accent, #38bdf8);
    border-radius: 50%;
    animation: register-spin 0.75s linear infinite;
}

.app-loading-text {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
}

body.light-mode .app-loading-overlay-inner {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .app-loading-spinner {
    border-color: rgba(0, 0, 0, 0.12);
    border-top-color: var(--text-accent, #0284c7);
}

body.light-mode .app-loading-text {
    color: rgba(15, 23, 42, 0.9);
}

.create-account-link {
    text-align: center;
    margin-top: 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
}

.create-account-link a {
    color: var(--text-accent);
    text-decoration: none;
    font-weight: 500;
}

.create-account-link a:hover {
    text-decoration: underline;
}

.error-message {
    color: #ef4444;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    margin-bottom: 0;
    font-size: 0.875rem;
    border: none;
    min-height: 0;
}

.error-message:empty {
    display: none;
}

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

.success-message {
    color: #10b981;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    margin-bottom: 0;
    font-size: 0.875rem;
    border: none;
    min-height: 0;
}

.success-message:empty {
    display: none;
}

.form-hint {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    margin-top: 1rem;
    text-align: center;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 2rem;
}

.auth-tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.auth-tab:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.auth-tab.active {
    color: #ffffff;
    border-bottom-color: #3b82f6;
    background-color: rgba(255, 255, 255, 0.05);
}

.auth-tab-content {
    display: none;
    padding: 0;
}

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

.login-welcome {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    text-align: center;
    font-family: var(--font-display);
}

.login-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    text-align: center;
}

.auth-tab-content h2 {
    margin-bottom: 1.5rem;
    color: #ffffff;
    text-align: left;
    font-size: 1.5rem;
}

/* Profile Tabs */
.profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
}

.profile-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.profile-tab:hover {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.profile-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.profile-tab-content {
    display: none;
    padding-top: 1.5rem;
}

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

.modal-large {
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    background-color: var(--bg-deep);
    border: 1px solid var(--border-color);
    padding: 5px 5px 10px 4px;
    border-radius: 8px;
}

.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px;
    position: relative;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h2 {
    margin: 0px !important;
    color: var(--text-primary);
    text-align: center;
    flex: 1;
}

.alert-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.alert-header h2 {
    margin: 0px !important;
    color: var(--text-primary);
    text-align: start;
    flex: 1;
}

.btn-closeDialog {
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    position: relative;
    top: 1px;
    right: 10px;
    color: var(--text-primary-darkTheme);
}

.btn-closeDialog:hover {
    background-color: var(--border-color);
    color: var(--text-primary-darkTheme);
}

.btn-close {
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    position: relative;
    top: 1px;
    right: 10px;
    color: var(--text-primary-darkTheme);
}

.btn-close:hover {
    background-color: var(--border-color);
    color: var(--text-primary-darkTheme);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    padding: 2rem;
}

.register-modal-content {
    background-color: var(--bg-deep);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
    border: 1px solid var(--glass-border);
}

.register-modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary-darkTheme);
    text-align: center;
    font-family: var(--font-display);
}

.register-success-modal-message {
    margin: 0 0 1rem 0;
    color: var(--text-primary-darkTheme);
    line-height: 1.5;
}

.org-exists-request-wrap {
    margin-top: 1rem;
}

.org-exists-prompt {
    margin: 0 0 0.75rem 0;
    color: var(--text-primary-darkTheme);
}

.org-exists-request-wrap .btn {
    margin-right: 0.5rem;
}

.org-exists-success-wrap .org-exists-success-msg {
    margin: 0;
    color: var(--text-primary-darkTheme);
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

#profileModal .modal-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.profile-readonly-value {
    padding: 0.5rem 0;
    color: var(--text-primary-darkTheme);
    font-size: 1rem;
}

/* Profile: Flight animation toggle (on/off switch) */
.profile-preference-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.profile-preference-label {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.profile-toggle-wrap {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.profile-toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.profile-toggle-slider {
    display: inline-block;
    width: 2.75rem;
    height: 1.4rem;
    background: var(--border-color);
    border-radius: 1.4rem;
    transition: background 0.2s ease;
}

.profile-toggle-slider::after {
    content: '';
    display: block;
    width: 1.1rem;
    height: 1.1rem;
    margin: 0.15rem;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.profile-toggle-input:checked + .profile-toggle-slider {
    background: var(--primary-color, #2563eb);
}

.profile-toggle-input:checked + .profile-toggle-slider::after {
    transform: translateX(1.35rem);
}

.profile-toggle-input:focus-visible + .profile-toggle-slider {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.organizations-section {
    border-top: 1px solid var(--glass-border);
}

.organizations-section .organizations-subtitle {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary-darkTheme);
    margin-top: 1rem;
}

.organizations-list .organization-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary-darkTheme);
}

.org-default-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color, #2563eb);
    background: rgba(37, 99, 235, 0.12);
    border-radius: 4px;
}

.btn-small {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

.btn-set-default {
    margin-left: auto;
}

.btn-view-org {
    margin-left: 0.5rem;
}

.invite-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.invite-row input {
    flex: 1;
    min-width: 120px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.invite-by-org-row {
    margin-bottom: 1.25rem;
}

.invite-by-org-row .invite-row {
    margin-top: 0.5rem;
}

.command-display {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--glass);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.command-label {
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.command-display code {
    display: block;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-primary-darkTheme);
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.fly-status-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--glass);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.fly-status-label {
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.output-container {
    margin-top: 1rem;
    position: relative;
}

.output-container.status-running,
.output-container.status-completed,
.output-container.status-failed {
    padding: 3px;
    border-radius: 10px;
    background: transparent;
}

.output-container .output-label {
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

/* Animated gradient border for running status (Blue) */
.output-container.status-running {
    background: linear-gradient(90deg, #3b82f6, #60a5fa, #3b82f6);
    background-size: 200% 100%;
    animation: gradient-border-running 3s ease infinite;
}

@keyframes gradient-border-running {0% {
        background-position: 0% 50%;
    }

50% {
        background-position: 100% 50%;
    }

100% {
        background-position: 0% 50%;
    }}

/* Animated gradient border for completed status (Green) */
.output-container.status-completed {
    background: linear-gradient(90deg, #10b981, #34d399, #10b981);
    background-size: 200% 100%;
    animation: gradient-border-completed 2s ease infinite;
}

@keyframes gradient-border-completed {0% {
        background-position: 0% 50%;
    }

50% {
        background-position: 100% 50%;
    }

100% {
        background-position: 0% 50%;
    }}

/* Animated gradient border for failed status (Red) */
.output-container.status-failed {
    background: linear-gradient(90deg, #ef4444, #f87171, #ef4444);
    background-size: 200% 100%;
    animation: gradient-border-failed 2s ease infinite;
}

@keyframes gradient-border-failed {0% {
        background-position: 0% 50%;
    }

50% {
        background-position: 100% 50%;
    }

100% {
        background-position: 0% 50%;
    }}

/* Inner content wrapper to maintain dark background */
.output-container .output-content-wrapper {
    background-color: #000000;
    border-radius: 7px;
    padding: 0;
    overflow: hidden;
}

.output-container .output-content {
    margin: 0;
    border: none;
    background-color: #000000;
    color: #f8f8f2;
}

.output-label {
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.output-content {
    color: #f8f8f2;
    background-color: #000000;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre;
    border: 1px solid #334155;
}

/* Flight Path Progress Steps */
.fly-path-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary-darkTheme);
}

.fly-path-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.fly-path-bar-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
}

.fly-path-bar {
    width: 360px;
    height: 16px;
    background: #334155;
    border-radius: 4px;
    overflow: hidden;
}

.fly-path-bar-fill {
    height: 100%;
    width: 0;
    background: #3b82f6;
    border-radius: 4px;
    transition: width 0.3s ease;
    box-sizing: border-box;
}

.fly-path-step.fly-path-in-progress .fly-path-bar-fill {
    width: 0;
    background: #3b82f6;
    animation: fly-path-fill 16s linear forwards, fly-path-pulse 1.5s ease-in-out infinite 16s;
}

.fly-path-step.fly-path-complete .fly-path-bar-fill {
    width: 100%;
    background: #10b981;
    animation: none;
}

@keyframes fly-path-fill {0% { width: 0; }

100% { width: 80%; }}

@keyframes fly-path-pulse {0%, 100% { opacity: 0.85; }

50% { opacity: 1; }}

.fly-path-label {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #94a3b8;
}

.fly-path-step.fly-path-in-progress .fly-path-label {
    color: #3b82f6;
}

.fly-path-step.fly-path-complete .fly-path-label {
    color: #10b981;
}

.fly-path-tick {
    opacity: 0;
    color: #10b981;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.fly-path-step.fly-path-complete .fly-path-tick {
    opacity: 1;
}

.fly-path-raw-output {
    margin-top: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--glass);
    box-shadow: var(--shadow);
}

.fly-path-raw-output summary {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary-darkTheme);
}

.fly-path-raw-output summary:hover {
    color: #e2e8f0;
}

.fly-path-raw-output .output-content-wrapper {
    overflow: hidden;
}

/* Raw YAML Content */
#rawContentWrapper {
    display: flex;
    flex-direction: column;
}

.raw-content-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

#rawContent {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre;
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
    color: var(--text-primary-darkTheme);
    margin: 0;
}

#rawContent.hidden {
    display: none;
}

.raw-content-edit {
    width: 100%;
    min-height: 400px;
    max-height: 600px;
    padding: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
    background-color: var(--glass);
    color: var(--text-primary-darkTheme);
    box-sizing: border-box;
    display: none;
}

.raw-content-edit:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.raw-save-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.raw-content-edit.hidden {
    display: none !important;
}

#rawSaveSection.hidden {
    display: none !important;
}

/* Raw YAML accordion (collapsed by default) */
.raw-yaml-accordion {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.raw-yaml-accordion-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    font-size: 1rem;
    user-select: none;
}

.raw-yaml-accordion-summary::-webkit-details-marker,
.raw-yaml-accordion-summary::marker {
    display: none;
}

.raw-yaml-accordion-icon {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: 0.5rem;
    transition: transform 0.2s ease;
}

.raw-yaml-accordion[open] .raw-yaml-accordion-icon {
    transform: rotate(-135deg);
}

.raw-yaml-accordion-summary:hover {
    background: rgba(0, 0, 0, 0.03);
}

.raw-yaml-accordion-body {
    border-top: 1px solid var(--border-color);
    padding: 1rem;
}

/* Full page output (for fly page) */
.fly-page-content .output-content {
    max-height: calc(100vh - 300px);
    min-height: 400px;
}

.output-content::-webkit-scrollbar {
    width: 8px;
}

.output-content::-webkit-scrollbar-track {
    background: #111111;
}

.output-content::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.output-content::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Flight Execution Page (Full Page) */
#flyPage {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.fly-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: rgba(6, 10, 20, 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.fly-page-header h2 {
    margin: 0;
    color: var(--text-primary);
}

.fly-page-content {
    flex: 1;
    padding: 2rem;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
}

.fly-page-content .output-content {
    max-height: calc(100vh - 350px);
    min-height: 400px;
}

.fly-page-footer {
    padding: 1rem 2rem;
    text-align: center;
    border-top: 2px solid var(--glass-border);
    margin: 2rem 0px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
}

/* Flight execution status: heading left, flight path to end of screen; extra top/bottom padding so arc isn't clipped */
.fly-execution-status {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 1.25rem 2rem 1.25rem 2rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
    color: var(--text-primary-darkTheme);
    border-bottom: 1px solid var(--border-color);
    overflow: visible;
}

.fly-status-heading {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* Purple gradient animation on "Test in Progress" text when running */
.fly-execution-status--running .fly-status-heading {
    background: linear-gradient(90deg, #7c3aed, #a78bfa, #c4b5fd, #a78bfa, #7c3aed);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: heading-gradient 3s ease infinite;
}

@keyframes heading-gradient {0%, 100% { background-position: 0% center; }

50% { background-position: 100% center; }}

.fly-execution-status--completed .fly-status-heading,
.fly-execution-status--failed .fly-status-heading {
    color: var(--text-primary-darkTheme);
}

/* Flight path container: starts at end of heading text, extends to right edge of screen */
.fly-status-animation-wrap {
    flex: 1;
    min-width: 200px;
    margin-left: 0;
    overflow: visible;
}

/* Hide flight animation when user has turned it off in profile (default off) */
.fly-execution-status--animation-off .fly-status-animation-wrap {
    display: none;
}

.fly-status-animation {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 64px;
    overflow: visible;
    padding-top: 28px;
    padding-bottom: 8px;
}

.fly-execution-status .plane-icon {
    font-size: 2.5rem;
    line-height: 1;
    opacity: 0.95;
}

/* Flying: plane follows a parabolic path from left to right (arc up then down) */
.fly-execution-status--running .plane-icon {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: plane-flying 3s ease-in-out infinite;
}

/* Second plane starts when the first is near the right (~75% through its path) */
.fly-execution-status--running .plane-icon-2 {
    animation-delay: 2.25s;
}

@keyframes plane-flying {0% {
        left: 0;
        transform: translate(-50%, -50%) rotate(-8deg);
        opacity: 0.85;
    }

25% {
        left: 25%;
        transform: translate(-50%, calc(-50% - 18px)) rotate(0deg);
        opacity: 1;
    }

50% {
        left: 50%;
        transform: translate(-50%, calc(-50% - 28px)) rotate(5deg);
        opacity: 1;
    }

75% {
        left: 75%;
        transform: translate(-50%, calc(-50% - 18px)) rotate(0deg);
        opacity: 1;
    }

100% {
        left: 100%;
        transform: translate(-50%, -50%) rotate(-8deg);
        opacity: 0.85;
    }}

/* Landing: plane descends and settles */
.fly-execution-status--completed .plane-icon,
.fly-execution-status--failed .plane-icon {
    animation: plane-landing 1.2s ease-out forwards;
    color: var(--text-primary-darkTheme);
}

@keyframes plane-landing {0% {
        transform: translateY(-30px) rotate(-8deg);
        opacity: 0.9;
    }

60% {
        transform: translateY(4px) rotate(2deg) scale(1.05);
        opacity: 1;
    }

100% {
        transform: translateY(0) rotate(0) scale(1);
        opacity: 1;
    }}

/* History Page */
#historyPage {
    min-height: 100vh;
    background-color: var(--bg-deep);
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    /* Overridden in JS via syncHistoryPageStickyOffset() to match `.app-top-header` height (flush, no gap). */
    --history-sticky-offset: 5.75rem;
}

.history-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    margin: 0;
    background-color: rgba(6, 10, 20, 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    position: sticky;
    top: var(--history-sticky-offset);
    z-index: 60;
    flex-shrink: 0;
}

.history-header-actions {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

.history-header-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-header-actions .history-bulk-delete-header-btn {
    align-self: center;
    flex-shrink: 0;
}

.history-header-actions .history-permanent-purge-btn .history-permanent-purge-label {
    margin-left: 0.25rem;
    font-size: 0.8rem;
}

.tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.tooltip-wrapper button:disabled {
    pointer-events: none;
}

.history-page-header h1,
.history-page-header h2 {
    margin: 0;
    color: #ffffff;
}

.history-page-content {
    flex: 1;
    padding: 2rem;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    color: #fff;
    border-bottom: 1px solid #1c2333;
}

/* Offline Results Page (same light background as History/Organization pages) */
#offlineResultsPage {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.offline-results-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    background-color: rgba(6, 10, 20, 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
}

.offline-results-page-header h2 {
    margin: 0;
    color: #ffffff;
}

.offline-results-page-content {
    flex: 1;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.offline-upload-options {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.offline-upload-option {
    padding: 1.5rem;
    box-shadow: var(--shadow);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.offline-upload-option h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: var(--text-primary-darkTheme);
}

.offline-file-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.offline-file-group label,
.offline-file-group-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.offline-results-pickers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.offline-results-file-input.hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.offline-results-selection-wrap {
    min-height: 1.5rem;
}

.offline-file-input-wrap {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.offline-file-input-wrap .file-input {
    flex: 1 1 auto;
    min-width: 180px;
    padding: 0.5rem;
    color: #333;
    background-color: var(--glass);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.offline-file-input-wrap .file-input::file-selector-button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0.75rem;
}

.offline-file-input-wrap.has-selection .file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.offline-selected-name {
    color: var(--text-primary-darkTheme);
    font-size: 0.95rem;
}

.offline-folder-file-list {
    display: block;
    margin-top: 0.25rem;
    margin-left: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
}

.offline-file-input-wrap:not(.has-selection) .offline-selected-name,
.offline-file-input-wrap:not(.has-selection) .offline-change-btn,
.offline-results-selection-wrap:not(.has-selection) .offline-selected-name,
.offline-results-selection-wrap:not(.has-selection) .offline-change-btn {
    display: none;
}

.offline-change-btn.btn-small {
    padding: 0.35rem 0.65rem;
    font-size: 0.875rem;
}

.offline-upload-form .btn {
    white-space: nowrap;
}

.offline-upload-actions {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Organization page (full screen) */
#organizationPage {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.organization-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: rgba(6, 10, 20, 0.8);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.organization-page-header h2 {
    margin: 0;
    color: #ffffff;
}

.organization-page-content {
    flex: 1;
    padding: 2rem;
    background: #e8e1e1;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
    background: radial-gradient(ellipse at 60% 40%, rgba(251, 191, 36, 0.06) 0%, transparent 50%), var(--bg-deep);
}

.organization-main-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.organization-main-tab {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.organization-main-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.organization-main-tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.22);
    border-color: var(--accent);
}

.organization-main-pane {
    display: none;
}

.organization-main-pane.active {
    display: block;
}

.database-sub-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0 1rem 0;
}

.database-sub-tab {
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

.database-sub-tab:hover {
    background: rgba(255, 255, 255, 0.16);
}

.database-sub-tab.active {
    background: rgba(255, 255, 255, 0.24);
    border-color: var(--accent);
    color: #fff;
}

.database-sub-pane {
    display: none;
}

.database-sub-pane.active {
    display: block;
}

/* Database admin: shared tokens for form controls and cards */
.database-sub-panes {
    --db-field-bg: rgba(15, 23, 42, 0.45);
    --db-field-border: rgba(255, 255, 255, 0.28);
    --db-field-color: var(--text-primary-darkTheme);
    --db-field-focus-border: var(--border-focus-color);
    --db-field-focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.12);
    --db-card-bg: rgba(15, 23, 42, 0.25);
    --db-card-border: rgba(148, 163, 184, 0.28);
    --db-table-head-bg: rgba(15, 23, 42, 0.35);
    --db-table-head-border: rgba(148, 163, 184, 0.35);
}

body.light-mode .database-sub-panes {
    --db-field-bg: var(--card-bg);
    --db-field-border: var(--glass-border);
    --db-field-color: var(--text-primary);
    --db-card-bg: #f8fafc;
    --db-card-border: var(--glass-border);
    --db-table-head-bg: #e2e8f0;
    --db-table-head-border: #cbd5e1;
}

.database-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.database-models-header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: nowrap;
}

.database-sub-panes .database-models-header-actions input[type="text"],
.database-sub-panes .database-model-field-row input[type="text"],
.database-sub-panes .database-model-field-row select,
.database-sub-panes .database-model-field-row textarea,
.database-sub-panes .database-model-edit-fields .database-default-custom-row input[type="text"],
.database-sub-panes .database-model-edit-fields .database-pipextra-custom-row input[type="text"],
.database-sub-panes .database-model-edit-fields .database-provider-workflow-row .database-provider-workflow-select,
.database-sub-panes .database-provider-skus-table select,
.database-sub-panes .database-models-table .database-units-mapping-field select,
.database-sub-panes .database-engine-tuning-cell-input {
    border-radius: 6px;
    border: 1px solid var(--db-field-border);
    background: var(--db-field-bg);
    color: var(--db-field-color);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    box-shadow: none;
    box-sizing: border-box;
}

.database-sub-panes .database-models-header-actions input[type="text"] {
    min-width: 220px;
    padding: 0.45rem 0.65rem;
    font-size: 0.9rem;
}

.database-sub-panes .database-model-field-row input[type="text"],
.database-sub-panes .database-model-field-row select,
.database-sub-panes .database-model-edit-fields .database-default-custom-row input[type="text"],
.database-sub-panes .database-model-edit-fields .database-pipextra-custom-row input[type="text"],
.database-sub-panes .database-model-edit-fields .database-provider-workflow-row .database-provider-workflow-select,
.database-sub-panes .database-provider-skus-table select,
.database-sub-panes .database-model-edit-fields .database-quant-min-vram {
    width: 100%;
    padding: 0.55rem 0.7rem;
    font-size: 0.9rem;
}

.database-sub-panes .database-model-field-row textarea {
    width: 100%;
    min-height: 48px;
    max-height: 220px;
    resize: vertical;
    padding: 0.55rem 0.7rem;
    font-size: 0.82rem;
}

.database-sub-panes .database-engine-tuning-cell-input {
    width: 100%;
    min-width: 4.5rem;
    padding: 0.35rem 0.45rem;
    font-size: 0.78rem;
    font-family: inherit;
}

.database-sub-panes .database-model-edit-fields .database-provider-workflow-row .database-provider-workflow-select {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: 100%;
}

.database-sub-panes .database-models-header-actions input[type="text"]:focus,
.database-sub-panes .database-model-field-row input[type="text"]:focus,
.database-sub-panes .database-model-field-row select:focus,
.database-sub-panes .database-model-field-row textarea:focus,
.database-sub-panes .database-model-edit-fields .database-default-custom-row input[type="text"]:focus,
.database-sub-panes .database-model-edit-fields .database-pipextra-custom-row input[type="text"]:focus,
.database-sub-panes .database-model-edit-fields .database-provider-workflow-row .database-provider-workflow-select:focus,
.database-sub-panes .database-engine-tuning-cell-input:focus,
.database-sub-panes .database-models-table .database-units-mapping-field select:focus {
    outline: none;
    border-color: var(--db-field-focus-border);
    box-shadow: var(--db-field-focus-ring);
}

.database-models-header-actions > .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.database-admin-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.database-admin-list-name {
    min-width: 0;
}

.database-pane-header h4 {
    margin: 0;
    color: var(--text-primary-darkTheme);
}

.database-models-table {
    width: 100%;
    border-collapse: collapse;
}

.database-models-table th,
.database-models-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary-darkTheme);
}

.database-models-table th {
    font-weight: 600;
    font-size: 0.9rem;
}

.database-models-table .database-units-mapping-field {
    margin: 0;
    min-width: 12rem;
}

.database-models-table .database-units-mapping-field select {
    width: 100%;
    min-width: 12rem;
    max-width: 28rem;
}

.database-models-table tr.database-units-mapping-row-duplicate td {
    background: rgba(244, 63, 94, 0.08);
}

.database-models-table tr[data-admin-row-clickable="true"] {
    cursor: pointer;
}

.database-models-table tr[data-admin-row-clickable="true"]:hover td {
    background: rgba(148, 163, 184, 0.08);
}

body.light-mode .database-models-table tr[data-admin-row-clickable="true"]:hover td {
    background: rgba(15, 23, 42, 0.05);
}

.database-units-action-col,
.database-units-action-cell {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.database-units-action-cell .database-row-actions {
    justify-content: flex-end;
}

.database-model-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.database-model-edit-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.9rem;
}

.database-model-field-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.database-model-field-row label {
    font-size: 0.85rem;
    color: var(--text-primary-darkTheme);
    font-weight: 600;
}

.database-model-defaults-section {
    margin-top: 0.25rem;
}

.database-model-defaults-section .database-model-field-row {
    margin-bottom: 0.75rem;
}

.database-model-defaults-section .database-model-field-row:last-child {
    margin-bottom: 0;
}

.database-defaults-card {
    margin-top: 0.8rem;
    padding: 0.7rem;
    border: 1px solid var(--db-card-border);
    border-radius: 8px;
    background: var(--db-card-bg);
}

.database-engine-arch-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 1.75rem;
    margin-bottom: 0.5rem;
    padding: 0.35rem 0;
}

.database-model-edit-fields .database-engine-arch-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.4rem 0.3rem 0.65rem;
    border-radius: 6px;
    border: 1px solid rgba(56, 189, 248, 0.45);
    background: rgba(56, 189, 248, 0.14);
    color: var(--text-primary-darkTheme);
    font-size: 0.85rem;
    line-height: 1.3;
}

.database-model-edit-fields .database-engine-arch-chip-label {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary-darkTheme);
    font-weight: 500;
}

.database-model-edit-fields .database-engine-arch-chip-remove {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.1rem;
    min-width: auto;
    line-height: 1;
    border: none;
    background: transparent;
    color: var(--text-primary-darkTheme);
    cursor: pointer;
    opacity: 0.85;
}

.database-model-edit-fields .database-engine-arch-chip-remove:hover {
    opacity: 1;
}

.database-model-edit-fields .database-engine-arch-chip-remove .material-symbols-outlined {
    font-size: 1rem;
}

.database-engine-arch-add-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.45rem;
}

.database-engine-arch-add-row select {
    flex: 1;
    min-width: 10rem;
}

.database-engine-arch-add-row .database-new-engine-arch-input {
    flex: 1;
    min-width: 8rem;
}

.database-engine-defaults-section {
    margin-top: 0.35rem;
}

.database-engine-defaults-card .database-engine-defaults-fields {
    margin-bottom: 1rem;
}

.database-engine-adapters-section {
    margin-top: 0.35rem;
}

.database-engine-adapters-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.database-engine-adapter-card {
    padding: 0.65rem 0.75rem;
}

.database-engine-adapter-name-row .database-engine-adapter-name-row-input-wrap {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    max-width: 36rem;
}

.database-engine-adapter-name-row .database-engine-adapter-name-input {
    flex: 1 1 0;
    min-width: 0;
}

.database-engine-adapter-name-row .database-engine-adapter-remove-card-btn {
    flex: 0 0 auto;
}

.database-engine-adapter-subsection {
    margin-top: 0.65rem;
}

.database-engine-adapter-subheading {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
}

.database-engine-adapter-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.database-engine-adapter-table th,
.database-engine-adapter-table td {
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.35rem 0.45rem;
    vertical-align: top;
}

.database-engine-adapter-table th {
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.database-admin-table-head th {
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--db-field-color);
    background: var(--db-table-head-bg);
    border-bottom: 1px solid var(--db-table-head-border);
}

.database-engine-adapter-table-key {
    width: 14rem;
    min-width: 10rem;
}

.database-engine-adapter-table-key .database-engine-adapter-images-provider {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.database-engine-adapter-table-val .database-engine-tuning-cell-input,
.database-engine-adapter-table-val textarea.database-engine-tuning-cell-input {
    width: 100%;
    box-sizing: border-box;
}

.database-engine-adapter-images-picks-cell .database-engine-adapter-image-pick,
.database-engine-adapter-images-picks-cell .database-engine-adapter-image-pick-text {
    width: 100%;
    box-sizing: border-box;
}

.database-engine-adapter-table-actions {
    width: 2.5rem;
    text-align: center;
    vertical-align: middle;
}

.database-engine-adapter-overrides-table-wrap {
    overflow-x: auto;
    margin-bottom: 0.35rem;
    max-width: 100%;
}

.database-engine-adapter-overrides-table .database-engine-adapter-override-col-head {
    font-size: 0.65rem;
    line-height: 1.25;
    word-break: break-word;
    hyphens: auto;
    max-width: 11rem;
    min-width: 6.5rem;
    vertical-align: bottom;
}

.database-engine-adapter-overrides-actions-col {
    width: 2.5rem;
}

.database-engine-adapter-overrides-table .database-engine-adapter-override-cell {
    min-width: 7rem;
}

.database-engine-adapter-overrides-provider-cell {
    min-width: 9rem;
}

.database-engine-setup-section {
    margin-top: 0.35rem;
}

.database-engine-setup-row.database-default-custom-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.45rem;
}

.database-engine-setup-rows .database-engine-setup-row.database-default-custom-row:first-child {
    margin-top: 0;
}

.database-engine-setup-primary-input {
    flex: 0 0 12rem;
    min-width: 0;
}

.database-engine-setup-value-input {
    flex: 1 1 0;
    min-width: 0;
}

.database-engine-tuning-block {
    margin-top: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(148, 163, 184, 0.35);
}

.database-engine-tuning-subheading {
    margin: 0 0 0.55rem 0;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary-darkTheme);
}

.database-engine-tuning-table-scroll {
    overflow-x: auto;
    margin-bottom: 0.55rem;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.2);
}

.database-engine-tuning-schema-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 0.8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.database-engine-tuning-schema-table th,
.database-engine-tuning-schema-table td {
    padding: 0.35rem 0.45rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    vertical-align: middle;
    text-align: left;
}

.database-engine-tuning-schema-table tbody tr:last-child td {
    border-bottom: none;
}

select.database-engine-tuning-cell-input {
    cursor: pointer;
}

.database-engine-tuning-cell-input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.database-engine-tuning-actions-col {
    width: 2.5rem;
}

.database-engine-tuning-actions {
    text-align: center;
    white-space: nowrap;
}

.database-model-subheading {
    margin: 0.2rem 0 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-primary-darkTheme);
}

.database-model-subheading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.database-provider-config-toolbar {
    justify-content: flex-end;
}

.database-provider-config-entry {
    margin-top: 0.5rem;
}

.database-provider-config-entry:first-child {
    margin-top: 0;
}

.database-provider-config-add-form {
    margin-bottom: 0.75rem;
    padding-bottom: 0.35rem;
}

.database-provider-config-new-type-radios {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.database-radio-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.database-provider-config-new-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.database-icon-btn-34,
.database-default-add-btn,
.database-default-remove-btn,
.database-engine-tuning-actions .database-engine-tuning-del-btn,
.database-provider-workflow-row .database-provider-workflow-remove-btn {
    flex-shrink: 0;
    width: 34px;
    min-width: 34px;
    max-width: 34px;
    height: 34px;
    box-sizing: border-box;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.database-default-add-btn .material-symbols-outlined {
    font-size: 20px;
    line-height: 1;
}

.database-default-custom-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

/* Two-column rows: input + remove (allowed-value draft rows). */
.database-default-custom-row.database-provider-config-allowed-row,
.database-default-custom-row.database-provider-config-new-allowed-row {
    grid-template-columns: 1fr auto;
}

/* Workflow row: select, optional "new workflow" text field, and remove — one flex row (grid was 2 cols and pushed the button to a new line). */
.database-default-custom-row.database-provider-workflow-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
}

.database-model-edit-fields .database-provider-workflow-row .database-provider-workflow-custom-input:not(.hidden) {
    flex: 1 1 0;
    min-width: 0;
}

.database-default-custom-row.database-provider-config-new-kv-row {
    grid-template-columns: 1fr 1fr auto;
}

.database-pipextra-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.database-pipextra-actions .btn {
    white-space: nowrap;
}

.database-pipextra-custom-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.database-model-edit-fields .database-pipextra-custom-row label {
    font-size: 0.85rem;
    color: var(--text-primary-darkTheme);
    font-weight: 600;
}

.database-provider-skus-table select {
    width: 100%;
}

.database-default-remove-btn {
    background-color: rgba(244, 63, 94, 0.22);
    border-color: rgba(244, 63, 94, 0.45);
}

.database-default-remove-btn .material-symbols-outlined {
    font-size: 20px;
    color: #ff8ea0;
}

.database-quant-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.45rem;
}

.database-model-edit-fields .database-quant-min-vram {
    width: 130px;
    outline: none;
    box-shadow: none;
}

.database-model-edit-fields .database-quant-min-vram:not(:disabled) {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.database-model-edit-fields .database-quant-min-vram:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.database-quant-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 180px;
    color: var(--text-primary-darkTheme);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.database-row-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.database-row-action-btn {
    padding: 0.25rem;
    min-width: 30px;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.24) 0%, rgba(51, 65, 85, 0.28) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 2px 6px rgba(2, 6, 23, 0.35);
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background 120ms ease;
}

.database-row-action-btn .material-symbols-outlined {
    font-size: 18px;
    line-height: 1;
}

.database-row-action-btn:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        0 4px 10px rgba(2, 6, 23, 0.45);
}

.db-model-edit-btn {
    background-color: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.db-model-edit-btn .material-symbols-outlined {
    color: #4ade80;
    filter: drop-shadow(0 0 2px rgba(34, 197, 94, 0.45));
}

.db-model-edit-btn:hover {
    background-color: rgba(34, 197, 94, 0.2);
}

.db-model-delete-btn {
    background-color: rgba(244, 63, 94, 0.1);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.db-model-delete-btn .material-symbols-outlined {
    color: #fb7185;
    filter: drop-shadow(0 0 2px rgba(244, 63, 94, 0.45));
}

.db-model-delete-btn:hover {
    background-color: rgba(244,63,94,0.2);
}

.organization-details-section,
.organization-members-section,
.organization-api-tokens-section,
.organization-env-section {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.organization-details-section h3,
.organization-members-section h3,
.organization-api-tokens-section h3,
.organization-env-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: var(--text-primary-darkTheme);
}

.organization-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.organization-detail-item {
    display: flex;
    flex-direction: row;
    gap: 15px;
}

.organization-detail-item label {
    font-size: 16px;
    color: var(--text-primary-darkTheme);
}

.organization-detail-item span {
    font-size: 16px;
}

.organization-name {
    color: var(--text-primary-darkTheme);
}

.organization-table-wrap {
    overflow-x: auto;
}

.organization-members-table {
    width: 100%;
    border-collapse: collapse;
}

.organization-members-table th,
.organization-members-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary-darkTheme);
}

.organization-members-table th {
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    font-size: 0.9rem;
}

.organization-members-table td select.role-select {
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: var(--text-primary);
    color: var(--text-primary-darkTheme);
}

org-name{
  color: var(--text-primary-darkTheme);
}

.organization-api-tokens-section .form-hint {
    margin-bottom: 1rem;
}

.organization-api-tokens-table {
    width: 100%;
    border-collapse: collapse;
}

.organization-api-tokens-table th,
.organization-api-tokens-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary-darkTheme);
}

.organization-api-tokens-table th {
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    font-size: 0.9rem;
}

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

.organization-api-token-prefix {
    font-family: ui-monospace, monospace;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.organization-api-token-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.organization-api-token-copy {
    padding: 0.25rem;
    background: var(--glass);
    color: var(--text-primary-darkTheme);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
}

.organization-api-token-delete {
    padding: 0.25rem;
    color: var(--highlight-color);
    background: rgba(248, 113, 113, 0.1);
}

.organization-api-token-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
    color: var(--text-primary-darkTheme) !important;
}

.organization-api-tokens-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.organization-env-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.organization-env-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.organization-env-tab {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.organization-env-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.organization-env-tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.22);
    border-color: var(--accent);
}

.organization-env-tab-panels {
    position: relative;
}

.organization-env-tab-panel {
    display: none;
}

.organization-env-tab-panel.active {
    display: block;
}

.organization-env-tab-panel .organization-env-fields {
    padding-top: 0.5rem;
}

.organization-env-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.organization-env-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.organization-env-row label {
    flex-shrink: 0;
    min-width: 220px;
    font-size: 0.9rem;
    color: var(--text-primary-darkTheme);
}

.organization-env-colon {
    flex-shrink: 0;
    color: var(--text-muted);
    font-weight: 500;
}

.organization-env-row input {
    flex: 1;
    min-width: 0;
    max-width: 480px;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: var(--input-bg);
    color: var(--text-primary);
}

.organization-env-row input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
}

.organization-env-row input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.organization-env-custom-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.organization-env-custom-actions {
    margin-top: 0.5rem;
}

.organization-custom-env-row .custom-env-name {
    flex-shrink: 0;
    min-width: 220px;
    font-size: 0.9rem;
    color: var(--text-primary-darkTheme);
}

.organization-custom-env-row input.custom-env-name {
    min-width: 180px;
    max-width: 220px;
}

.organization-env-value-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    max-width: 480px;
}

.organization-env-value-wrap .custom-env-value,
.organization-env-value-wrap .org-env-value-input {
    padding-right: 2.75rem;
}

.organization-env-value-wrap .organization-env-value-toggle {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-primary-darkTheme);
}

.organization-env-value-wrap .organization-env-value-toggle:hover {
    color: var(--text-primary-darkTheme);
}

.organization-env-value-wrap .organization-env-value-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.organization-env-toggle-label {
    font-size: 0.75rem;
    font-weight: 500;
}

.organization-env-remove-custom {
    flex-shrink: 0;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    background: transparent;
    color: var(--text-primary-darkTheme);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    cursor: pointer;
}

.organization-env-remove-custom:hover {
    background: rgba(255, 255, 255, 0.08);
}

.organization-env-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.organization-env-actions .error-message,
.organization-env-actions .success-message {
    flex: 1;
    min-width: 0;
}

.org-role-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #f87171;
}

.org-role-owner {
    border-radius: 10px;
    position: relative;
    top: -3px;
    width: 70px;
    font-weight: bolder;
    text-align: center;
    background: var(--text-primary);
    border: 1px solid #f87171;
}

.org-role-developer { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }

.org-role-user { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }

/* Build Your Own page */
#buildYourOwnPage {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.build-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: rgba(6, 10, 20, 0.8);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.build-page-header h2 {
    margin: 0;
    color: #ffffff;
}

.build-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.build-page-content {
    flex: 1;
    padding: 2rem;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
    background: radial-gradient(ellipse at 60% 40%, rgba(251, 191, 36, 0.06) 0%, transparent 50%), var(--bg-deep);
}

#buildCustomYamlPage .build-page-content {
    display: flex;
    gap: 2rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.build-custom-steps-panel {
    flex: 0 0 180px;
    align-self: flex-start;
    position: sticky;
    top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 2rem;
    border-right: 1px solid var(--glass-border);
}

.build-step-tile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    background: var(--glass);
    font-size: 0.95rem;
    transition: opacity 0.25s, background 0.25s, border-color 0.25s;
}

.build-step-tile.dimmed {
    opacity: 0.75;
}

.build-step-tile.bright {
    opacity: 1;
    background: rgba(74, 158, 255, 0.22);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(74, 158, 255, 0.25), 0 0 12px rgba(74, 158, 255, 0.15);
    color: var(--text-primary-darkTheme);
}

.build-step-tile.completed {
    opacity: 1;
    background: rgba(74, 158, 255, 0.18);
    border-color: var(--accent);
    color: var(--accent);
}

.build-step-tile.dimmed .build-step-icon {
    background: rgba(255, 255, 255, 0.08);
}

.build-step-tile.bright .build-step-icon {
    background: var(--accent);
    color: #fff;
}

.build-step-tile.completed .build-step-icon {
    background: var(--accent);
    color: #fff;
}

.build-step-label {
    font-weight: 500;
}

#buildCustomYamlPage .build-custom-form {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    height: 65vh;
}

.build-flightplan-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: auto;
}

.build-form-section {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.build-form-section h3 {
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary-darkTheme);
    font-size: 1.1rem;
}

.build-section-title-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.build-section-title-row h3 {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.build-section-title-row .inline-hint {
    margin: 0;
}

.build-subsection-title {
    margin: 1.25rem 0 0.75rem 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.engine-config-subsection {
    margin: 1.25rem 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Flight Planner: VRAM hint below engine tuning — full-width paragraph like disk form-hints */
#buildCustomYamlPage .engine-vram-summary-row {
    width: 100%;
    margin-top: 0.5rem;
}

#buildCustomYamlPage .engine-vram-summary-row .form-hint {
    display: block;
    width: 100%;
    max-width: none;
    text-align: left;
    margin-top: 0;
    margin-bottom: 0;
    line-height: 1.45;
    font-size: 0.85rem;
    padding: 0;
}

#buildCustomYamlPage .engine-vram-summary-row .form-hint.custom-provider-warning {
    color: #f59e0b;
}

body.light-mode #buildCustomYamlPage .engine-vram-summary-row .form-hint.custom-provider-warning {
    color: #b45309;
}

.build-form-section .form-group {
    margin-bottom: 1rem;
}

/* Model family + model brand on one row (build custom) */
#buildCustomYamlPage .build-custom-model-family-brand-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem 1.25rem;
    margin-bottom: 1rem;
}

#buildCustomYamlPage .build-custom-model-family-brand-row .form-group {
    flex: 1 1 11rem;
    margin-bottom: 0;
    min-width: 10rem;
}

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

.build-form-section .text-muted {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.custom-provider-warning {
    color: #f59e0b;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
}

body.light-mode .custom-provider-warning {
    color: #b45309;
}

.build-form-section .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.build-form-section .form-row-multi {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

/* Build custom: evaluations as a single horizontal/wrapping row of checkboxes */
#buildCustomYamlPage .evaluations-checkbox-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
}

#buildCustomYamlPage .evaluation-inline-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    flex: 0 0 auto;
}

#buildCustomYamlPage .evaluation-inline-item input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

#buildCustomYamlPage .evaluation-inline-item label {
    display: inline;
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    color: #f8fafc;
}

body.light-mode #buildCustomYamlPage .evaluation-inline-item label {
    color: #0f172a;
}

.build-form-actions {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 0.5rem;
    box-shadow: var(--shadow);
}

.build-form-actions .form-group {
    margin-bottom: 1rem;
}

/* Build Custom YAML page - model selection bubbles */
#buildCustomYamlPage {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.model-bubbles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.model-bubble {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    background: var(--glass);
    color: var(--text-primary-darkTheme);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.model-bubble:hover {
    background: rgba(74, 158, 255, 0.15);
    border-color: var(--accent);
}

.model-bubble.selected {
    background: rgba(74, 158, 255, 0.25);
    border-color: var(--accent);
    color: var(--accent);
}

.hardware-details {
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.hardware-details code {
    color: #ffffff;
}

/* Space after Price (or Region) before disk override controls */
#buildCustomYamlPage #customProviderSection #customVastaiDiskWrap,
#buildCustomYamlPage #customProviderSection #customRunpodDiskWrap,
#buildCustomYamlPage #customProviderSection #customAwsRootVolumeWrap {
    margin-top: 1.25rem;
}

/* Label + GB input on one row (build custom provider disk / volume) */
#buildCustomYamlPage #customProviderSection .build-custom-disk-label-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.35rem;
}

#buildCustomYamlPage #customProviderSection .build-custom-disk-label-row label {
    margin: 0;
    flex-shrink: 0;
    font-weight: 600;
}

#buildCustomYamlPage #customProviderSection .build-custom-disk-input {
    width: 5.75rem;
    min-width: 4.5rem;
    max-width: 10rem;
    flex: 0 0 auto;
}

.hardware-details .model-detail-label {
    margin-right: 0.25rem;
}

.hardware-details .model-detail-label:not(:first-child) {
    margin-left: 1rem;
}

/* Engine details: adapter dropdown matches other build-custom selects (full-width form-group) */
#buildCustomYamlPage #customEngineSection #customEngineDetails .form-group {
    margin-top: 1rem;
    margin-bottom: 0.75rem;
    width: 100%;
    max-width: 100%;
}

/* Width set in JS (fitBuildCustomSelectToOptions) from widest option; cap with max-width */
#buildCustomYamlPage .build-custom-form select.custom-select,
#buildCustomYamlPage .build-custom-form select.custom-eval-param {
    max-width: 100%;
    box-sizing: border-box;
}

#buildCustomYamlPage #customEngineSection #customEngineDetails .form-group select.custom-select {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius,8px);
    font-size: 1rem;
    line-height: 1.4;
}

#buildCustomYamlPage #customEngineSection #customEngineDetails .custom-engine-image-row {
    margin-top: 0.25rem;
}

.model-detail-label {
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.yaml-preview {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre;
    margin: 0;
}

.yaml-preview-full {
    min-height: 12rem;
    max-height: 32rem;
    overflow-y: auto;
    font-size: 0.8rem;
    color: #ffffff;
}

body.light-mode .yaml-preview-full {
    color: var(--text-primary);
}

/* Two-pane layout after Step 6: left = Save & Run, right = Full YAML */
.custom-region-mode-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.25rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.radio-label-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.build-custom-panes {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
    align-items: stretch;
}

.build-custom-left-pane {
    flex: 0 0 320px;
    min-width: 280px;
}

.build-custom-right-pane {
    flex: 1;
    min-width: 0;
}

.build-form-section-full-yaml {
    margin-top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.build-form-section-full-yaml .yaml-preview-full {
    flex: 1;
    min-height: 20rem;
}

.build-form-actions {
    margin-top: 0;
}

.build-form-actions .build-actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.build-form-actions .build-actions-buttons .btn {
    width: 100%;
    justify-content: center;
}

.build-form-actions .form-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

@media (max-width: 900px) {.build-custom-panes {
        flex-direction: column;
    }

.build-custom-left-pane {
        flex: none;
    }}

body.light-mode .model-bubble {
    background: var(--card-bg);
    color: var(--text-primary);
}

body.light-mode .model-bubble:hover,
body.light-mode .model-bubble.selected {
    background: rgba(59, 130, 246, 0.15);
}

body.light-mode .build-step-tile.bright {
    background: rgba(59, 130, 246, 0.22);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3), 0 0 12px rgba(59, 130, 246, 0.12);
}

body.light-mode .build-step-tile.completed {
    background: rgba(59, 130, 246, 0.18);
    color: var(--accent);
}

body.light-mode .build-custom-steps-panel .build-step-tile {
    color: var(--text-primary);
}

body.light-mode .hardware-details code {
    color: var(--text-primary);
}

/* Tab bar above history table: same width as table, two equal segments, trash icon on right for org admins */
#historyTableContainer .history-view-tabs-wrap {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 0;
}

#historyTableContainer .history-view-tabs {
    display: flex;
    flex: 1;
    /* background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-bottom: none; */
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

#historyTableContainer .history-view-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-right: 1px solid #1c2333;
    border-bottom: 1px solid #1c2333;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.2s, color 0.2s;
}

#historyTableContainer .history-view-tab:last-child {
    border-right: none;
}

#historyTableContainer .history-view-tab.active {
    /* background-color: rgba(74, 158, 255, 0.12); */
    color: var(--accent);
    font-weight: 600;
    border-bottom: 2px solid var(--accent);
}

.history-table {
    width: 100%;
    margin-top: 10px;
    background-color: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.history-table thead {
    border-bottom: 1px solid var(--border-color);
    color: white;
}

.history-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.history-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.history-table th.sortable::after {
    content: '';
    display: inline-block;
    margin-left: 0.5rem;
    width: 0;
    height: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.history-table th.sortable:hover::after {
    opacity: 0.5;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid rgba(255, 255, 255, 0.7);
    border-bottom: none;
}

.history-table th.sortable[data-sort-direction="asc"]::after {
    opacity: 1;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 6px solid white;
    border-top: none;
}

.history-table th.sortable[data-sort-direction="desc"]::after {
    opacity: 1;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid white;
    border-bottom: none;
}

.history-filters-row .history-filter-checkbox-wrap {
    align-self: flex-end;
}

.history-filter-checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.history-filter-checkbox-wrap input {
    cursor: pointer;
}

/* Run by column: label + sort icon */
.history-table th.sortable-with-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font-mono);
}

.config-bubbles-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.config-bubble {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    background-color: var(--glass);
    border: 1px solid #334155;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.config-bubble-tag {
    font-weight: 600;
    background-color: rgba(168, 85, 247, 0.1);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 6px;
}

.history-table tbody tr:hover {
    background-color: rgba(0, 224, 255, 0.05);
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

/* Offline icon in Duration column */
.history-duration-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.history-run-id-col {
    white-space: nowrap;
}

.history-run-id-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.history-offline-run-badge {
    margin: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: none;
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    background-color: rgba(245, 158, 11, 0.05);
    border-radius: 12px;
}

/* Match Date column: inherit .history-table td (12px, var(--font-mono)) — reset <code> defaults */
.history-table .history-short-run-id {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    background: none;
    padding: 0;
}

.history-actions-cell-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
}

.history-actions-cell-wrap .history-checkride-version {
    align-self: flex-end;
    font-size: 0.7rem;
    opacity: 0.85;
    color: var(--text-secondary, #94a3b8);
    white-space: nowrap;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.history-actions .btn {
    white-space: nowrap;
    font-size: 12px;
    padding: 0.4rem 0.8rem;
}

.btn-ghost .btn {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.history-actions .btn-danger {
    background-color: rgba(244, 63, 94, 0.1);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.2);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    height: 32px;
    font-size: 12px;
    transition:
      background-color 150ms ease,
      color 150ms ease,
      border-color 150ms ease,
      box-shadow 150ms ease,
      transform 150ms ease;
}

.history-actions .btn-danger:hover {
    background-color: rgba(244,63,94,0.2);
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    margin: 0.25rem;
    border-radius: 12px;
    font-size: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    font-family: var(--font-sans);
}

.status-running {
    background-color: rgb(52, 211, 153, 0.05);
    color: rgba(52, 211, 153);
    border: 1px solid rgba(52, 211, 153, 0.4);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
}

.status-in-progress {
    animation: pulse-in-progress 2s ease-in-out infinite;
    cursor: pointer;
}

@keyframes pulse-in-progress {0%, 100% { opacity: 1; }

50% { opacity: 0.5; }}

.btn-watch-flight {
    background-color: rgba(52, 211, 153, 0.08) !important;
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.3) !important;
    border-radius: 6px;
    font-size: 12px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 150ms ease;
    height: 32px;
    gap: 8px;
}

.btn-watch-flight:hover {
    background-color: rgba(52, 211, 153, 0.18) !important;
    border-color: rgba(52, 211, 153, 0.5);
    color: #6ee7b7;
}

.app-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0 1.5rem 1.5rem;
}

.app-modal-footer .tertiary-btn,
.app-modal-footer .secondary-btn {
    margin-left: 0;
    width: auto;
    min-width: 80px;
    justify-content: center;
}

.app-modal-ok.app-modal-danger {
    background-color: rgba(244, 63, 94, 0.15);
    color: #fb7185;
    border-color: rgba(244, 63, 94, 0.3);
}

.app-modal-ok.app-modal-danger:hover {
    background-color: rgba(244, 63, 94, 0.25);
}

.status-completed {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--secondary-green);
    background-color: rgba(16,185,129,0.05);
    border: 1px solid rgba(16,185,129,0.4);
    border-radius: 12px;
}

.status-failed {
    background-color: rgb(248, 113, 113, 0.1);
    color: rgb(248, 113, 113);
    border: 1px solid rgb(248, 113, 113, 0.4);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
}

.status-stopped {
    font-size: 10px;
    font-weight: 700;
    background-color: rgba(146, 64, 14, 0.1);
    color: rgb(146, 64, 14);
    border-radius: 12px;
    border: 1px solid rgba(146, 64, 14, 0.4);
}

.status-deleted {
    background-color: rgb(248, 113, 113, 0.1);
    color: rgb(248, 113, 113);
    border: 1px solid rgb(248, 113, 113, 0.4);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
}

.check-ride-batch {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #fbbf24;
    border: 1px solid rgba(245,158,11,0.4);
    background-color: rgba(245,158,11,0.05);
    border-radius: 12px;
}

.btn-blackbox {
    background-color: rgba(148, 163, 184, 0.08) !important;
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3) !important;
    border-radius: 6px;
    font-size: 12px;
    padding: 0.5rem;
    min-width: 32px;
    justify-content: center;
    cursor: pointer;
    transition: all 150ms ease;
    height: 32px;
    gap: 0;
}

.btn-blackbox:hover {
    background-color: rgba(148, 163, 184, 0.18) !important;
    border-color: rgba(148, 163, 184, 0.6);
    color: #e2e8f0;
}

.btn-blackbox .material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* History / trash: open flight plan in planner (same as Black Box "View") */
.btn-history-flightplan {
    background-color: rgba(56, 189, 248, 0.08) !important;
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    border-radius: 6px;
    padding: 0.5rem;
    min-width: 32px;
    justify-content: center;
    cursor: pointer;
    transition: all 150ms ease;
    height: 32px;
    gap: 0;
}

.btn-history-flightplan:hover {
    background-color: rgba(56, 189, 248, 0.18) !important;
    border-color: rgba(56, 189, 248, 0.55);
    color: #7dd3fc;
}

.btn-history-flightplan .material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.history-flightplan-action-menu {
    position: fixed;
    z-index: 100010;
    min-width: 200px;
    background-color: var(--bg-deep);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 0.25rem 0;
}

.history-flightplan-action-item {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    border: none;
    background: none;
    color: var(--text-primary-darkTheme);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s;
}

.history-flightplan-action-item:hover,
.history-flightplan-action-item:focus-visible {
    background-color: rgba(56, 189, 248, 0.12);
    outline: none;
}

.history-flightplan-yaml-filename {
    margin: 0 0 0.75rem;
}

.history-flightplan-yaml-content {
    max-height: min(70vh, 36rem);
}

body.light-mode .history-flightplan-action-menu {
    background-color: #fff;
}

body.light-mode .history-flightplan-action-item {
    color: var(--text-primary);
}

body.light-mode .history-flightplan-action-item:hover,
body.light-mode .history-flightplan-action-item:focus-visible {
    background-color: rgba(56, 189, 248, 0.1);
}

.btn-restore {
   background-color: rgba(168, 85, 247, 0.08) !important;
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.35) !important;
    border-radius: 6px;
    font-size: 12px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 150ms ease;
    height: 32px;
    gap: 8px;
}

.btn-restore:hover {
    background-color: rgba(168, 85, 247, 0.18) !important;
    border-color: rgba(168, 85, 247, 0.6);
    color: #e9d5ff;
}

.loading-message,
.empty-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.error-message {
    text-align: center;
    padding: 2rem;
    color: var(--danger-color);
}

/* Console Output */
.console-info {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
}

.info-row {
    display: flex;
    margin-bottom: 0.5rem;
    align-items: center;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-row-file .info-value {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.info-row-file #consoleViewYamlBtn {
    margin-left: 0.75rem;
    flex-shrink: 0;
}

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 100px;
}

.info-value {
    color: var(--text-primary-darkTheme)
}

.console-output {
    background-color: #1e293b;
    color: #e2e8f0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
}

@keyframes slideIn {from {
        transform: translateY(-20px);
        opacity: 0;
    }

to {
        transform: translateY(0);
        opacity: 1;
    }}

.forgotPassword-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary-darkTheme);
    text-align: center;
    font-family: var(--font-display);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary-darkTheme);
    text-align: center;
    font-family: var(--font-display);
}

.modal-trash-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary-darkTheme);
    text-align: center;
    font-family: var(--font-display);
}

/* Header (default: dark) */
header {
    background-color: rgba(6, 10, 20, 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 50;
}

header h1 {
    color: #ffffff;
    font-size: 1.75rem;
    font-weight: 600;
    font-family: var(--font-display);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Main app top bar: logo + (Plans / Flights / Admin + profile) */
.app-top-header .logo {
    flex-shrink: 0;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-left: auto;
    min-width: 0;
    flex-wrap: wrap;
}

#header-nav-menu.nav-links {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.125rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

#header-nav-menu .nav-menus {
    padding: 0.4rem 0.65rem;
    border-bottom: none;
    border-right: none;
    border-radius: 8px;
    white-space: nowrap;
}

#header-nav-menu .nav-menus li {
    font-size: 0.9rem;
}

.header-divider {
    width: 1px;
    height: 32px;
    background-color: var(--glass-border);
    margin: 0 0.5rem;
}

/* Page header dividers (default: dark) */
.history-page-header .header-divider,
.results-page-header .header-divider,
.organization-page-header .header-divider,
.build-page-header .header-divider,
.compare-page-header .header-divider,
.offline-results-page-header .header-divider {
    background-color: var(--glass-border);
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border: none;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--accent), #2563eb);
    color: #ffffff !important;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.35);
}

.profile-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.45);
    color: #ffffff !important;
}

/* Single initial letter, centered in circle */
.profile-button #usernameDisplay {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-transform: uppercase;
}

.profile-button .dropdown-arrow {
    display: none;
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.profile-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background-color: var(--bg-deep);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.profile-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary-darkTheme);
    text-decoration: none;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--border-color);
}

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

.dropdown-item-name {
    display: flex;
    justify-content: center;
    font-weight: 600;
    color: var(--accent);
    cursor: default;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.dropdown-item-name:hover {
    background-color: transparent;
}

.dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dropdown-item:first-child:hover {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child:hover {
    border-radius: 0 0 8px 8px;
}

.dropdown-item-light-mode {
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-item-light-mode .dropdown-item-label {
    flex: 1;
}

.light-mode-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.light-mode-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.light-mode-slider {
    position: absolute;
    inset: 0;
    background-color: var(--border-color);
    border-radius: 20px;
    transition: 0.2s;
}

.light-mode-slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.light-mode-switch input:checked + .light-mode-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.light-mode-switch input:checked + .light-mode-slider::before {
    transform: translateX(16px);
}

.btn-fly,
.btn-history,
.btn-build {
    background: linear-gradient(135deg, var(--accent), #2563eb);
    color: #ffffff !important;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.btn-fly:hover:not(:disabled),
.btn-history:hover:not(:disabled),
.btn-build:hover,
.btn-save:hover,
.btn-small:hover,
.secondary-btn:hover,
.tertiary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
    color: var(--text-primary-darkTheme) !important;
}

.btn-fly:disabled,
.btn-history:disabled {
    opacity: 1 !important;
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none;
    color: var(--text-secondary) !important;
}

.btn-fly:disabled *,
.btn-fly:disabled .plane-icon,
.btn-fly:disabled span,
.btn-history:disabled * {
    color: var(--text-secondary) !important;
}

.btn-save {
  width:100%;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: var(--text-primary-darkTheme) !important;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.plane-icon {
    font-size: 1.2rem;
}

/* Main Container (default: dark header/sidebar, white main) */
main {
    padding: 0;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.main-layout {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 120px);
}

/* Left Panel (default: dark) */
.left-panel {
    width: 280px;
    background: var(--bg-deep);
    padding: 1.5rem 1.5rem 1.5rem 1.5rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    min-height: 0;
    position: relative;
}

.left-panel[aria-hidden="true"] {
    /* Hidden state only applies on mobile via media query */
}

.left-panel-section {
    margin-bottom: 2rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 4.5rem;
}

.left-panel-section:last-child {
    margin-bottom: 0;
}

.left-panel-footer {
    position: absolute;
    left: 1.5rem;
    right: 1.5rem;
    bottom: 1.5rem;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    text-align: left;
}

.left-panel-powered-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.left-panel-powered-img {
    width: 110px;
    height: auto;
    display: block;
    object-fit: contain;
    margin-left: 0;
}

.left-panel-title {
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.bubble-level-label-root {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0.25rem 0 0.5rem 0;
}

/* Right Content Area (default: white) */
.right-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: radial-gradient(ellipse at 60% 40%, rgba(251, 191, 36, 0.06) 0%, transparent 50%), var(--bg-deep);
}

.container {
    margin: 0 auto;
}

/* Selection Panel (default: subtle gradient) */
.selection-panel {
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.fly-action-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

/* Folder Tabs */
.folder-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.folder-tab {
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    border-bottom: 1px solid var(--glass-border);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.folder-tab:last-child {
    border-bottom: none;
}

.folder-tab:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.folder-tab.active {
    color: #ffffff;
    border-left-color: var(--accent-light);
    background-color: rgba(59, 130, 246, 0.08);
}

.folder-tab.loading {
    opacity: 0.6;
    cursor: wait;
}

/* ========== Light mode theme (Runpod-style) ========== */
body.light-mode {
    background: var(--bg-lightTheme);
}

body.light-mode header {
    background-color: var(--card-bg);
}

body.light-mode header h1 {
    color: var(--text-primary);
}

body.light-mode .header-divider {
    background-color: var(--border-color);
}

body.light-mode .history-page-content{
    background: var(--bg-lightTheme);
    color: #000;
}

body.light-mode .header-actions .header-divider {
    background: var(--card-bg);
}

body.light-mode .history-page-header .header-divider,
body.light-mode .results-page-header .header-divider,
body.light-mode .organization-page-header .header-divider,
body.light-mode .build-page-header .header-divider,
body.light-mode .compare-page-header .header-divider,
body.light-mode .offline-results-page-header .header-divider {
    background-color: var(--border-color);
}

body.light-mode main {
    background-color: var(--main-area-bg);
}

body.light-mode .subfolder-tabs-container,
body.light-mode .left-panel,
body.light-mode .file-content {
    background-color: var(--card-bg);
}

body.light-mode .right-content {
    background-color: var(--bg-lightTheme) !important;
}

body.light-mode .left-panel-footer {
    border-top: 1px solid var(--glass-border);
    background-color: var(--card-bg);
}

body.light-mode .left-panel-powered-text {
    color: var(--text-secondary);
}

body.light-mode .left-panel-title {
    color: var(--text-primary);
}

body.light-mode .bubble-level-label-root {
    color: var(--text-secondary);
}

body.light-mode .selection-panel {
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
}

body.light-mode .btn-fly:hover:not(:disabled) {
    color: var(--accent) !important;
}

body.light-mode .folder-tab {
    color: var(--text-secondary);
}

body.light-mode .folder-tab:hover {
    color: var(--text-primary);
    background-color: var(--bg-color);
}

body.light-mode .folder-tab.active {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.1);
}

body.light-mode .subfolder-section-title,
body.light-mode .file-header h2,
body.light-mode .raw-yaml-accordion-summary {
    color: var(--text-primary);
}

body.light-mode .form-section {
    background: var(--card-bg);
}

body.light-mode .file-header,
body.light-mode .content-tabs {
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .save-section,
body.light-mode .raw-yaml-accordion {
    border : 1px solid var(--glass-border);
}

body.light-mode .raw-yaml-accordion-body {
    border-top: 1px solid var(--glass-border);
}

body.light-mode #rawContent {
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

body.light-mode .form-section h3 {
    color: var(--text-primary);
    border-bottom: 2px solid var(--glass-border);
}

body.light-mode .units-of-work-table {
    background: var(--card-bg);
}

body.light-mode .units-of-work-table th,
body.light-mode .units-of-work-table td {
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
}

body.light-mode .dropdown-menu {
    background: var(--bg-lightTheme);
    border: 1px solid var(--glass-border);
}

body.light-mode .dropdown-item-name {
    color: var(--accent) !important;
}

body.light-mode .dropdown-item {
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .dropdown-item:last-child {
    border-bottom: none;
}

body.light-mode .dropdown-item:hover {
    background-color: rgba(37, 99, 235, 0.1);
}

body.light-mode .material-symbols-outlined.filled-moon {
    color: var(--text-primary);
}

body.light-mode #flyPage {
    background-color: var(--main-area-bg);
}

body.light-mode .fly-execution-status {
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .command-display,
body.light-mode .fly-status-section,
body.light-mode .output-container .output-content-wrapper {
    background: var(--card-bg);
}

body.light-mode .fly-path-raw-output {
    background: #e2e8f0;
}

body.light-mode .command-label,
body.light-mode .fly-status-label,
body.light-mode .fly-path-progress,
body.light-mode .fly-path-raw-output summary,
body.light-mode .output-content,
body.light-mode .fly-execution-status--failed .fly-status-heading,
body.light-mode .fly-execution-status--failed .plane-icon {
    color: var(--text-primary);
}

body.light-mode .command-display code {
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

body.light-mode #historyPage {
    background-color: var(--main-area-bg);
}

body.light-mode .history-page-header {
    background-color: var(--card-bg);
}

body.light-mode .history-page-header h1,
body.light-mode .history-page-header h2 {
    color: var(--text-primary);
}

body.light-mode #offlineResultsPage {
    background-color: var(--main-area-bg);
}

body.light-mode .offline-results-page-header {
    background-color: var(--card-bg);
}

body.light-mode .offline-results-page-header h2 {
    color: var(--text-primary);
}

body.light-mode #organizationPage {
    background-color: var(--main-area-bg);
}

body.light-mode .organization-page-header {
    background-color: var(--card-bg);
}

body.light-mode .organization-page-header h2 {
    color: var(--text-primary);
}

body.light-mode #buildYourOwnPage,
body.light-mode #buildCustomYamlPage {
    background-color: var(--main-area-bg);
}

body.light-mode .build-page-header {
    background-color: var(--card-bg);
}

body.light-mode .build-page-header h2 {
    color: var(--text-primary);
}

body.light-mode #comparePage {
    background-color: var(--main-area-bg);
}

body.light-mode .compare-page-header {
    background-color: var(--card-bg);
}

body.light-mode .compare-page-header h2 {
    color: var(--text-primary);
}

body.light-mode #resultsPage {
    background-color: var(--main-area-bg);
}

body.light-mode .results-page-header {
    background-color: var(--card-bg);
}

body.light-mode .results-page-header h1,
body.light-mode .results-page-header h2 {
    color: var(--text-primary);
}

body.light-mode .results-page-header-details {
    color: var(--text-secondary);
}

body.light-mode .checkride-last-run {
    color: var(--text-secondary);
}

@media (max-width: 768px) {body.light-mode .left-panel-toggle {
        background-color: #ffffff !important;
        color: var(--text-primary) !important;
        border-bottom-color: var(--glass-border) !important;
    }

body.light-mode .left-panel-toggle:hover {
        background-color: var(--bg-color) !important;
    }

body.light-mode .left-panel {
        border-bottom: 2px solid var(--glass-border);
    }

body.light-mode .history-table tr {
        background-color: var(--card-bg);
        border-color: var(--border-color);
    }

body.light-mode .history-table td {
        color: var(--text-primary);
    }}

body.light-mode #historyFilterMenu,
body.light-mode .history-filter-panes {
    background: var(--card-bg);
}

body.light-mode .history-filter-tab,
body.light-mode .history-option-label {
    color: var(--text-primary);
}

body.light-mode .history-table td {
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .history-filter-sidebar {
    background-color: var(--card-bg);
    border-right: 1px solid var(--glass-border);
}

body.light-mode .history-table {
    background-color: var(--card-bg);
    border-radius: 12px;
}

body.light-mode .history-table thead {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-lightTheme);
    color: var(--text-primary);
}

body.light-mode .config-bubble {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

body.light-mode .config-bubble-tag {
    background-color: rgba(168, 85, 247, 0.1);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

body.light-mode .btn-blackbox {
    background-color: var(--bg-lightTheme);
    border: 1px solid #CBD5E1;
    color: var(--text-primary) !important;
}

body.light-mode .btn-blackbox:hover {
    background-color: #CBD5E1;
}

body.light-mode .btn-history-flightplan {
    background-color: rgba(14, 165, 233, 0.1) !important;
    color: #0284c7;
    border: 1px solid rgba(14, 165, 233, 0.35) !important;
}

body.light-mode .btn-history-flightplan:hover {
    background-color: rgba(14, 165, 233, 0.18) !important;
    border-color: rgba(14, 165, 233, 0.5);
    color: #0369a1;
}

body.light-mode .tech-button {
    background: var(--card-bg);
}

body.light-mode .icon-glow {
    color: var(--accent) !important;
    font-weight: 600;
}

body.light-mode .btn-history:hover {
    color: var(--text-primary) !important;
}

body.light-mode .btn-results:hover {
    background-color: rgba(16,185,129,0.2);
    color: var(--text-primary) !important;
}

body.light-mode .history-table th.sortable[data-sort-direction="desc"]::after {
    border-top: 6px solid var(--text-primary);
}

body.light-mode .history-table th.sortable[data-sort-direction="asc"]::after {
    border-bottom: 6px solid var(--text-primary);
}

body.light-mode #historyTableContainer .history-view-tab.active {
    border-bottom: 2px solid var(--accent);
}

body.light-mode #historyTableContainer .history-view-tab {
    border-right: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .secondary-btn:hover,
body.light-mode .tertiary-btn:hover,
body.light-mode .btn-history:hover:not(:disabled) {
    color: var(--accent) !important;
}

body.light-mode .btn-history:disabled {
    color: var(--text-secondary) !important;
}

body.light-mode .tertiary-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

body.light-mode .app-modal-ok.app-modal-danger:hover {
    color: #fb7185 !important;
}

body.light-mode .btn-history {
    background: var(--card-bg);
    color: var(--accent) !important;
}

body.light-mode #historyTableContainer .history-view-tab:last-child {
    border-right: none;
}

body.light-mode .modal-large {
    background: var(--bg-lightTheme);
    border: 1px solid var(--glass-border);
}

body.light-mode .modal-content h2,
body.light-mode .btn-close,
body.light-mode .info-value,
body.light-mode .output-label,
body.light-mode .form-alert,
body.light-mode .form-group label {
    color: var(--text-primary);
}

body.light-mode .btn-close:hover {
    background-color: var(--text-primary-darkTheme);
    color: var(--text-primary);
}

body.light-mode .console-info {
    background: var(--card-bg);
}

body.light-mode .info-row-actions,
body.light-mode .modal-footer {
    border-top: 1px solid var(--glass-border);
}

body.light-mode .console-output {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

body.light-mode .modal-content {
    background-color: var(--bg-lightTheme);
}

body.light-mode .form-group input[type="text"] {
    background: var(--card-bg);
    color: var(--text-primary);
}

body.light-mode .build-page-content {
    background: var(--bg-lightTheme);
}

body.light-mode .build-form-section h3 {
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .build-form-section,
body.light-mode .build-form-actions {
    background: var(--card-bg);
}

body.light-mode .form-group select,
body.light-mode .form-group textarea,
body.light-mode .form-group input[type="url"],
body.light-mode .form-group input[type="number"],
body.light-mode input[type="tel"],
body.light-mode .invite-row input[type="email"],
body.light-mode .form-group input[type="password"] {
    background: var(--card-bg);
    color: var(--text-primary);
}

body.light-mode .profile-readonly-value,
body.light-mode .organizations-section .organizations-subtitle,
body.light-mode .organizations-list .organization-item {
    color: var(--text-primary);
}

body.light-mode #profileModal .modal-footer {
    border-top: 1px solid var(--glass-border);
}

body.light-mode .organization-page-content {
    background: var(--bg-lightTheme);
}

body.light-mode .organization-details-section,
body.light-mode .organization-members-section,
body.light-mode .organization-api-tokens-section,
body.light-mode .organization-env-section {
    background: var(--card-bg);
}

body.light-mode .organization-details-section h3,
body.light-mode .organization-detail-item label,
body.light-mode .organization-name,
body.light-mode .organization-members-section h3,
body.light-mode .organization-api-tokens-section h3,
body.light-mode .organization-env-section h3,
body.light-mode .organization-main-tab.active,
body.light-mode .organization-env-tab.active,
body.light-mode .organization-env-row label {
    color: var(--text-primary);
}

body.light-mode .org-role-owner {
    background: rgba(0,0,0,0.04);
}

body.light-mode .organization-members-table td select.role-select {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

body.light-mode .organization-members-table th,
body.light-mode .organization-members-table td,
body.light-mode .organization-api-tokens-table th,
body.light-mode .organization-api-tokens-table td {
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .organization-api-token-prefix {
    background: #cbd5e1;
}

body.light-mode .organization-env-row input[type="password"],
body.light-mode .organization-env-row input[type="text"] {
    background: var(--card-bg);
    color: var(--text-primary);
}

body.light-mode .organization-env-tab.active {
    background: #e2e8f0;
}

body.light-mode .organization-main-tab {
    background: #f8fafc;
    border-color: var(--glass-border);
    color: var(--text-primary);
}

body.light-mode .organization-main-tab.active {
    background: #e2e8f0;
}

body.light-mode .database-sub-tab {
    background: #f8fafc;
    border-color: var(--glass-border);
    color: var(--text-primary);
}

body.light-mode .database-sub-tab.active {
    background: #e2e8f0;
}

body.light-mode .database-pane-header h4,
body.light-mode .database-models-table th,
body.light-mode .database-models-table td {
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .database-model-field-row label {
    color: var(--text-primary);
}

body.light-mode .database-model-edit-fields .database-pipextra-custom-row label {
    color: var(--text-primary);
}

body.light-mode .database-model-subheading {
    color: var(--text-primary);
}

body.light-mode .database-engine-tuning-table-scroll {
    background: #f1f5f9;
    border-color: var(--glass-border);
}

body.light-mode .database-engine-tuning-schema-table th,
body.light-mode .database-engine-tuning-schema-table td {
    border-bottom-color: #e2e8f0;
}

body.light-mode .database-engine-adapter-table th,
body.light-mode .database-engine-adapter-table td {
    border-color: #e2e8f0;
}

body.light-mode .database-engine-tuning-subheading {
    color: var(--text-primary);
}

body.light-mode .database-engine-tuning-block {
    border-top-color: #cbd5e1;
}

body.light-mode .database-quant-label {
    color: var(--text-primary);
}

body.light-mode .database-model-edit-fields .database-engine-arch-chip {
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.35);
    color: var(--text-primary);
}

body.light-mode .database-model-edit-fields .database-engine-arch-chip-label,
body.light-mode .database-model-edit-fields .database-engine-arch-chip-remove {
    color: var(--text-primary);
}

body.light-mode .database-models-table tr.database-units-mapping-row-duplicate td {
    background: rgba(244, 63, 94, 0.1);
}

body.light-mode .database-row-action-btn {
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 1px 3px rgba(15, 23, 42, 0.18);
}

body.light-mode .db-model-edit-btn {
    border-color: rgba(34, 197, 94, 0.45);
    background: linear-gradient(180deg, rgba(187, 247, 208, 0.9) 0%, rgba(134, 239, 172, 0.7) 100%);
}

body.light-mode .db-model-delete-btn {
    border-color: rgba(244, 63, 94, 0.45);
    background: linear-gradient(180deg, rgba(254, 205, 211, 0.95) 0%, rgba(251, 113, 133, 0.72) 100%);
}

body.light-mode .offline-upload-option {
    background: var(--card-bg);
}

body.light-mode .offline-upload-option h3 {
    color: var(--text-primary);
}

body.light-mode .offline-file-input-wrap .file-input {
    background-color: var(--card-bg);
    border: 1px solid var(--glass-border);
}

body.light-mode .compare-page-content {
    background: var(--bg-lightTheme);
}

body.light-mode .compare-params-accordion,
body.light-mode .compare-params-table {
    background: var(--card-bg);
}

body.light-mode .compare-params-accordion-summary,
body.light-mode .compare-params-table td.param-value {
    color: var(--text-primary);
}

body.light-mode .compare-params-table .param-value.compare-param-value--better {
    background-color: #e2e8f0;
    color: #15803d;
}

body.light-mode .compare-params-table .param-value.compare-param-value--worse {
    background-color: #e2e8f0;
    color: #b91c1c;
}

body.light-mode .compare-section-results h3,
body.light-mode .compare-section-telemetry h3,
body.light-mode .results-section.checkride-summary .runiq-score-caption .metric-label,
body.light-mode .results-section.checkride-summary .runiq-score-caption .runiq-rating,
body.light-mode .results-section.checkride-summary .tile-label,
body.light-mode .results-section.checkride-summary .tile-value,
body.light-mode .results-section.checkride-summary .summary-bar-label,
body.light-mode .results-section.checkride-summary .summary-bar-value,
body.light-mode .results-section.checkride-summary .instance-pricing-row,
body.light-mode .compare-section h3{
    color: var(--text-primary);
}

body.light-mode .compare-column-title {
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .results-top-tiles-wrap {
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .compare-result-column {
    background: var(--card-bg);
}

body.light-mode .results-section.checkride-summary .results-top-tile {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
}

body.light-mode .summary-footer {
    border-top: 1px solid var(--glass-border);
}

body.light-mode .compare-params-accordion .compare-params-table-wrap {
    border-top: 1px solid var(--glass-border);
}

body.light-mode .compare-params-table td.param-name {
    border-right: 2px solid var(--glass-border);
}

body.light-mode .compare-params-table th,
body.light-mode .compare-params-table td {
    border-right: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .compare-params-table th:last-child,
body.light-mode .compare-params-table td:last-child {
    border-right: none;
}

body.light-mode .compare-telemetry-wrapper,
body.light-mode .compare-telemetry-shared-controls {
    background: var(--card-bg);
}

body.light-mode .compare-telemetry-legend-wrapper{
    background: var(--card-bg);
}

body.light-mode .compare-telemetry-legend-label {
    color: var(--text-primary);
}

body.light-mode .compare-telemetry-panel {
    background: #0f172a;
}

body.light-mode .compare-telemetry-panel-header {
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .telemetry-modal-backdrop {
    background: var(--bg-lightTheme);
}

body.light-mode .telemetry-modal-content {
    background: #0f172a;
}

body.light-mode .results-page-content {
    background: var(--bg-lightTheme);
}

body.light-mode .input-params-panel.collapsed + .results-section-panel,
body.light-mode .input-params-panel:not(.collapsed),
body.light-mode .input-params-panel:not(.collapsed) + .results-section-panel,
body.light-mode .input-params-panel.collapsed {
    background: var(--card-bg);
}

body.light-mode .results-header-info {
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .results-section.checkride-summary .recommendation-block {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
}

body.light-mode .results-section.checkride-summary .recommendation-block .recommendation-list li.recommendation-text {
    border-top-color: var(--glass-border);
}

body.light-mode .results-section.checkride-summary .recommendation-block .recommendation-list li,
body.light-mode .input-params-section h4,
body.light-mode .params-table td.param-value,
body.light-mode .input-params-panel .input-params-accordion-label,
body.light-mode .input-params-accordion-toggle {
    color: var(--text-primary);
}

body.light-mode .params-table th,
body.light-mode .params-table td {
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .input-params-accordion-header {
    background-color: var(--bg-lightTheme);
}

body.light-mode .input-params-accordion-header:hover {
    background-color: rgba(0,0,0,0.04);
}

body.light-mode .detailed-results-fullwidth {
    background: var(--card-bg);
}

body.light-mode .detailed-results-inline-heading {
    color: var(--text-primary);
}

body.light-mode .detailed-results-inline-tabs,
body.light-mode .telemetry-chart-controls {
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .graph-btn.active {
    color: var(--text-primary);
}

body.light-mode .graph-btn:hover {
    color: var(--text-primary) !important;
}

body.light-mode .detail-section-box,
body.light-mode .detail-show-all-card,
body.light-mode .detail-nested-section {
    background: var(--card-bg);
}

body.light-mode .detail-param-val,
body.light-mode .detail-nested-section h5 {
    color: var(--text-primary);
}

body.light-mode .detail-show-all-card-heading {
    color: var(--text-primary);
    border-bottom: 2px solid var(--glass-border);
}

body.light-mode .modal-trash-large {
    background-color: var(--bg-lightTheme);
    border: 1px solid var(--glass-border);
}

body.light-mode .modal-trash-content h2 {
    color: var(--text-primary);
}

body.light-mode .alert-content {
    background: var(--card-bg);
    border: var(--glass-border);
}

body.light-mode .alert-content h2,
body.light-mode .alert-btn-close{
    color: var(--text-primary);
}

body.light-mode .alert-btn-close:hover {
    background-color: var(--text-primary-darkTheme);
    color: var(--text-primary);
}

body.light-mode .btn-restore {
    color: var(--text-primary) !important;
}

body.light-mode .main-tab-btn {
    background: var(--card-bg);
}

body.light-mode .main-tab-btn.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

body.light-mode .nav-links {
    background: var(--card-bg);
}

body.light-mode #header-nav-menu.nav-links {
    background: transparent;
}

body.light-mode .clear-filter {
    color: var(--text-primary) !important;
}

body.light-mode .main-view-pane {
    background: var(--bg-lightTheme);
}

body.light-mode .organization-custom-env-row .custom-env-name,
body.light-mode .organization-env-remove-custom {
    color: var(--text-primary);
}

body.light-mode .organization-env-remove-custom:hover {
    background: rgb(248, 250, 252);
}

body.light-mode .yaml-preview {
    background: var(--card-bg);
}

body.light-mode .history-bulk-action-bar {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
}

body.light-mode .metric-item {
    background: var(--bg-lightTheme);
    border: 1px solid var(--glass-border);
}

body.light-mode .metric-value {
    color: var(--text-primary);
}

body.light-mode .organizations-list .organization-item {
    border-bottom: 1px solid var(--glass-border);
}

body.light-mode .stop-execution:hover:not(:disabled) {
    color: var(--accent) !important;
}

/* Subfolder Tabs Container (Right Panel) */
.subfolder-tabs-container {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow); 
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.subfolder-section-title {
    margin: 0 0 1rem 0;
    color: var(--text-primary-darkTheme);
    font-size: 1.1rem;
    font-weight: 600;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

/* Nested subfolder-tabs-container inside rows (for next-level folders) */
.subfolder-tabs-row .subfolder-tabs-container {
    margin-bottom: 0;
    padding: 0;
    background-color: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Subfolder Tabs - Inside the container in right panel */
.subfolder-tabs-container .subfolder-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: -1rem 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.subfolder-tabs-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
}

.bubble-level-label {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.subfolder-tabs-row.collapsed {
    justify-content: center;
    position: relative;
}

.subfolder-tabs-row.collapsed .subfolder-tab:not(.active) {
    display: none;
}

.subfolder-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    width: 100%;
}

.subfolder-breadcrumb-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
}

.subfolder-crumb {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-style: italic;
}

.subfolder-crumb.active {
    color: var(--primary-color);
    cursor: default;
}

.subfolder-crumb-separator {
    color: var(--text-secondary);
    opacity: 0.6;
    font-style: italic;
}

.subfolder-back-container {
    margin-left: auto;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.subfolder-back-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subfolder-back-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.subfolder-back-btn:active {
    transform: scale(0.95);
}

.subfolder-tabs-row.next-level {
    opacity: 0.85;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
}

.subfolder-tabs-row.next-level .subfolder-tab {
    border-style: dashed;
}

/* Nested subfolder-tabs-container inside rows (for next-level folders) - keep existing flex layout */
.subfolder-tabs-row .subfolder-tabs-container {
    margin-bottom: 0;
    padding: 0;
    background-color: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.subfolder-tab {
    padding: 0.5rem 1rem;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 999px;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: all 0.2s;
}

.subfolder-tab:hover {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.35);
}

.subfolder-tab.active {
    background: rgba(37, 99, 235, 0.2);
    border-color: rgba(37, 99, 235, 0.45);
    color: var(--primary-color);
    cursor: default;
}

/* Last bubble (file tab) when selected: green and centered row */
.subfolder-tab.file-tab.active {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.6);
    color: #16a34a;
    border-style: solid;
}

.subfolder-tabs-row.file-tabs-row:has(.file-tab.active) {
    justify-content: center;
}

.subfolder-tabs-row.file-tabs-row:has(.file-tab.active) .subfolder-tabs-container {
    justify-content: center;
}

/* File Selection Container */
.file-selection-container {
    margin-top: 1.5rem;
}

.fly-action-column,
.fly-action-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    flex-shrink: 0;
}

.fly-button-text {
    display: inline;
}

.fly-disabled-text {
    color: #ffffff !important;
    font-size: 0.875rem;
    font-style: italic;
    margin-left: 0.5rem;
    display: none;
}

.btn-fly:disabled .fly-button-text {
    display: none;
}

.btn-fly:disabled .fly-disabled-text {
    display: inline;
}

.btn-fly:not(:disabled) .fly-disabled-text {
    display: none;
}

.fly-run-status-wrapper {
    margin-bottom: 0.75rem;
}

.fly-run-status-wrapper:has(.fly-run-status.hidden) {
    display: none;
}

.fly-run-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--primary-color);
    font-weight: 500;
}

.fly-run-view-execution {
    margin-left: 0.25rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    background: transparent;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
}

.fly-run-view-execution:hover {
    background: rgba(59, 130, 246, 0.1);
}

.fly-run-status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: fly-run-status-pulse 1.2s ease-in-out infinite;
}

@keyframes fly-run-status-pulse {0%, 100% { opacity: 1; transform: scale(1); }

50% { opacity: 0.5; transform: scale(1.2); }}

.selected-plan-message {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: bold;
    font-style: italic;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
}

.selected-plan-message.hidden {
    display: none;
}

.selected-plan-message #selectedPlanName {
    color: var(--accent-light);
    font-weight: 600;
}

.fly-debug-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fly-debug-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.fly-debug-checkbox-label input {
    margin: 0;
}

.folder-tabs-container .btn-fly {
    flex-shrink: 0;
}

.forgotPassword-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary-darkTheme);
    font-weight: 500;
    font-size: 0.95rem;
}

.form-alert {
    margin-bottom: 1.5rem;
    color: var(--text-primary-darkTheme);
    display: block;
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

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

.form-group textarea {
    background: var(--bg-light);
    color: var(--text-primary-darkTheme);
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
}

.form-group select {
    background: var(--bg-light);
    color: var(--text-primary-darkTheme);
    border: 1px solid var(--glass-border);
    background: rgba(15, 25, 50, 0.5);
    transition: all 0.2s;
}

.form-group input {
    background: var(--bg-light);
}

.form-group input[type="url"] {
    border: 1px solid var(--glass-border);
    background: rgba(15, 25, 50, 0.5);
    padding: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    color: var(--text-primary-darkTheme);
}

.form-group input[type="url"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--border-focus-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.file-select-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.file-select-header label {
    margin-bottom: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary-darkTheme);
}

.select-large {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--glass-border);
    background: rgba(15, 25, 50, 0.5);
    border-radius: 8px;
    font-size: 1rem;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
}

.select-large:hover {
    border-color: var(--primary-color);
}

.select-large:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* File Content */
.file-content {
    box-shadow: var(--shadow);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.file-header h2 {
    color: var(--text-primary-darkTheme);
    font-size: 1.25rem;
    font-weight: 600;
}

.file-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.content-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    gap: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.content-display {
    padding: 2rem;
    max-height: 600px;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

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

/* Raw YAML tab content wrapper */
#rawContentWrapper {
    display: none;
    flex-direction: column;
    padding: 0;
    background: none;
    border: none;
}

#rawContentWrapper.active {
    display: flex;
}

/* Edit Form tab content */
#editForm {
    display: none;
    white-space: normal;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#editForm.active {
    display: block;
    padding: 0;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

#yamlForm {
    padding: 0;
}

#formFields {
    margin-bottom: 2rem;
}

.form-section {
    background-color: var(--glass);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-section h3 {
    color: var(--text-primary-darkTheme);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    text-transform: capitalize;
}

/* Units of work table (Flight Controls: Select | Config Name | batch_size | input_tokens | output_tokens | num_batches) */
.units-of-work-table-wrap {
    overflow-x: auto;
    margin-top: 0.5rem;
}

.units-of-work-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
}

.units-of-work-table th,
.units-of-work-table td {
    padding: 0.5rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary-darkTheme);
}

.units-of-work-table th {
    font-weight: 700;
    color: var(--text-primary-darkTheme);
}

.units-of-work-table th:first-child {
    width: 2.5rem;
}

.units-of-work-table td.config-value-cell.config-value-diff {
    /* color: #1e3a8a; */
    font-weight: 600;
}

/* Config Name column: uppercase, bold, centered */
.units-of-work-table td:first-child + td {
    text-align: center;
    text-transform: uppercase;
    font-weight: 700;
    font-family: var(--font-mono);
}

/* Alternate row backgrounds */
.units-of-work-table tbody tr {
    /* background: #fff; */
}

.units-of-work-table tbody tr:nth-child(even) {
    /* background: #f5f5f5; */
}

.units-of-work-table tbody tr:hover {
    /* background: rgba(0, 0, 0, 0.06); */
}

.units-of-work-table tbody tr:nth-child(even):hover {
    /* background: rgba(0, 0, 0, 0.08); */
}

/* Selected row (radio checked) */
.units-of-work-table tbody tr:has(input[type="radio"]:checked) {
    background: var(--glass) !important;
}

.units-of-work-table tbody tr:has(input[type="radio"]:checked):hover {
    background: var(--glass-border) !important;
}

.units-of-work-table tbody tr:last-child td {
    border-bottom: none;
}

.units-of-work-table label {
    cursor: pointer;
}

.save-section {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.upload-section {
    margin-top: 0.5rem;
}

.file-input {
    width: 100%;
}

.file-input::file-selector-button {
    background-color: #e2e8f0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
    margin-right: 0.75rem;
    transition: all 0.2s;
}

.file-input::file-selector-button:hover {
    background-color: #cbd5f5;
    border-color: var(--primary-color);
}

#rawSaveSection {
    margin-top: 1.5rem;
    display: none;
}

.save-section .form-group {
    margin-bottom: 1rem;
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.success-message {
    color: var(--success-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    min-height: 1.25rem;
    font-weight: 500;
}

.btn-remove {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove:hover {
    background-color: #dc2626;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-primary-darkTheme);
    width: 100%;
    /* background: linear-gradient(135deg, var(--accent), #2563eb);
    border-color: rgba(96, 165, 250, 0.3);
    color: #fff;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15); */
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
    color: #ffffff !important;
}

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

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.btn:disabled,
.btn-secondary:disabled {
    background-color: #ccc !important;
    color: var(--text-secondary) !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    pointer-events: none;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background-color: var(--secondary-green);
    color: var(--text-primary-darkTheme);
}

.btn-tiny {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    background-color: rgba(244, 63, 94, 0.1);
    color: #cbd5e1;
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: 6px;
    transition:
      background-color 150ms ease,
      color 150ms ease,
      border-color 150ms ease,
      box-shadow 150ms ease,
      transform 150ms ease;
}

.btn-tiny:hover {
  background-color: rgba(244,63,94,0.2);
}

/* Database models: keep update action green (override generic .btn-tiny red). */
.database-row-action-btn.db-model-edit-btn {
    background-color: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.25);
    color: #4ade80;
}

.database-row-action-btn.db-model-edit-btn:hover {
    background-color: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.35);
}

.btn-tag-history {
    color: #fff;
    background-color: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);;
}

.btn-tag-history:hover {
    background-color: rgb(168, 85, 247, 0.2);
}

.btn-tag-history .material-symbols-outlined {
    color: #c084fc;
    font-size: 1.1rem;
}

.btn-star-history {
    color: #fff;
    background-color: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.btn-star-history:hover {
    background-color: rgba(245, 158, 11, 0.2);
}

.btn-star-history .material-symbols-outlined {
    color: #d1a030;
    font-size: 1.1rem;
}

.btn-star-history--starred {
    background-color: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
}

.btn-star-history--starred .material-symbols-outlined {
    color: #f59e0b;
}

#historyBulkSelectBtn {
    border: 1px solid rgba(100, 116, 139, 0.25);
}

/* Idle: no runs chosen for bulk delete yet — muted like disabled, still clickable to enter mode */
#historyBulkSelectBtn:not(.active) {
    color: rgba(148, 163, 184, 0.8);
    border-color: rgba(100, 116, 139, 0.35);
    opacity: 0.55;
    cursor: pointer;
}

/* Compare column has bulk-deletable row(s) checked — trash is ready to enter delete-selected mode */
#historyBulkSelectBtn.history-bulk-preflight:not(.active) {
    color: rgba(251, 113, 133, 0.92);
    border-color: rgba(251, 113, 133, 0.45);
    opacity: 0.92;
}

#historyBulkSelectBtn.history-bulk-preflight:not(.active):hover {
    box-shadow: 0 0 14px rgba(251, 113, 133, 0.35);
    opacity: 1;
    color: #fb7185;
}

#historyBulkSelectBtn:not(.active):hover {
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
    opacity: 0.85;
    color: rgba(203, 213, 225, 0.95);
}

#historyBulkSelectBtn.active:not(:disabled) {
    color: #fb7185;
    border-color: rgba(251, 113, 133, 0.45);
    opacity: 1;
}

#historyBulkSelectBtn.active:not(:disabled):hover {
    box-shadow: 0 0 15px rgba(251, 113, 133, 0.35);
    transform: translateY(-1px);
}

#historyBulkSelectBtn.active:disabled {
    color: rgba(148, 163, 184, 0.75);
    border-color: rgba(100, 116, 139, 0.35);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
    opacity: 0.55;
}

#historyBulkSelectBtn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    pointer-events: none;
}

#historyBulkSelectBtn:disabled:hover {
    box-shadow: none;
    transform: none;
}

#historyBulkSelectBtn .material-symbols-outlined {
    font-size: 1.1rem;
}

.history-bulk-delete-toolbar-btn .material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

body.light-mode #historyBulkSelectBtn:not(.active) {
    color: rgba(71, 85, 105, 0.85);
    border-color: rgba(100, 116, 139, 0.45);
}

body.light-mode #historyBulkSelectBtn:not(.active):hover {
    color: rgba(51, 65, 85, 0.95);
}

body.light-mode #historyBulkSelectBtn.history-bulk-preflight:not(.active) {
    color: rgba(225, 29, 72, 0.88);
    border-color: rgba(225, 29, 72, 0.4);
}

.history-bulk-select-all {
    cursor: pointer;
    width: 15px;
    height: 15px;
    vertical-align: middle;
    margin-top: 2px;
}

.tag-icon-label {
    color: #7c3aed;
    font-size: 1.1rem;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Form Styles */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--glass-border);
    background: rgba(15, 25, 50, 0.5);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    color: var(--text-primary-darkTheme);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus {
    outline: none;
    /* border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); */
    border-color: var(--border-focus-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.error-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

.forgot-password-link {
    color: var(--text-accent);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
    display: inline-block;
}

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

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Results Page */
#resultsPage {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Compare Results full page */
#comparePage {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.compare-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: rgba(6, 10, 20, 0.8);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.compare-page-header h2 {
    margin: 0;
    color: #ffffff;
}

.compare-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.compare-page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
    background: radial-gradient(ellipse at 60% 40%, rgba(251, 191, 36, 0.06) 0%, transparent 50%), var(--bg-deep);
}

.compare-section {
    margin-bottom: 1.5rem;
}

.compare-section h3 {
    color: var(--text-primary-darkTheme);
}

/* Input Parameters accordion (collapsed by default) */
.compare-params-accordion {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.compare-params-accordion-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    font-size: 1rem;
    user-select: none;
}

.compare-params-accordion-summary::-webkit-details-marker,
.compare-params-accordion-summary::marker {
    display: none;
}

.compare-params-accordion-icon {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: 0.5rem;
    transition: transform 0.2s ease;
}

.compare-params-accordion[open] .compare-params-accordion-icon {
    transform: rotate(-135deg);
}

.compare-params-accordion-summary:hover {
    background: rgba(0, 0, 0, 0.03);
}

.compare-params-accordion .compare-params-table-wrap {
    border-top: 1px solid var(--border-color);
}

/* Match View Results input-params-section heading */
.compare-section.compare-section-params h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.compare-params-table-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
}

/* Common (same-value) rows hidden by default; shown when "Show all" is active */
.compare-params-table-wrap .compare-params-row-common {
    display: none;
}

.compare-params-table-wrap.showing-all .compare-params-row-common {
    display: table-row;
}

/* Common param rows: keep green/red background by RunIQ, but use black text */
.compare-params-table .compare-params-row-common td.param-value {
    color: var(--text-primary-darkTheme);
}

.compare-params-show-all-wrap {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
}

.compare-params-show-all-wrap.hidden {
    display: none;
}

/* Compare Input Parameters: tabular grid with dividers; param name left, Run 1 / Run 2 grouped right */
.compare-params-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.compare-params-table th,
.compare-params-table td {
    padding: 0.5rem 0.75rem;
    text-align: center;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.compare-params-table th:last-child,
.compare-params-table td:last-child {
    border-right: none;
}

/* Strong divider after param-name column so Run 1 / Run 2 read as a pair */
.compare-params-table td.param-name {
    border-right: 2px solid var(--border-color);
}

.compare-params-table tbody tr:last-child td {
    border-bottom: none;
}

.compare-params-table td.param-name,
.compare-params-table td.param-value {
    font-family: inherit;
    font-size: inherit;
}

.compare-params-table .param-name {
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    width: 1%;
    min-width: 8rem;
}

.compare-params-table .param-value {
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
}

/* All params: color by RunIQ — green = higher RunIQ, red = lower RunIQ */
.compare-params-table .param-value.compare-param-value--better {
    background-color: var(--bg-deep);
    color: #15803d;
}

.compare-params-table .param-value.compare-param-value--worse {
    background-color: var(--bg-deep);
    color: #b91c1c;
}

/* Run 1 and Run 2 value columns */
.compare-params-table td.param-value {
    min-width: 6rem;
    color: var(--text-primary-darkTheme);
    font-family: var(--font-mono);
}

.compare-params-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

.compare-params-table .no-params {
    color: var(--text-secondary);
    font-style: italic;
    padding: 1rem;
}

.compare-results-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.compare-results-columns.compare-results-columns--three {
    grid-template-columns: 1fr 1fr 1fr;
}

.compare-result-column {
    min-width: 0;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.compare-column-title {
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1rem;
    color: var(--text-primary-darkTheme);
}

.compare-result-column-content {
    min-height: 120px;
}

/* Compare page: never show Recommendations section */
#comparePage .recommendation-wrap,
#comparePage .recommendation-heading,
#comparePage .recommendation-block {
    display: none !important;
}

/* Compare page: RunIQ score on top, then performance/efficiency/tiles/bars below (no recommendations) */
.compare-summary-stacked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.compare-summary-stacked .runiq-pie-center {
    flex-shrink: 0;
}

.compare-summary-top {
    width: 100%;
}

.compare-summary-and-pie {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.compare-summary-left {
    width: 100%;
    display: flex;
    flex:1;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

.compare-summary-left .results-top-tiles-wrap {
    margin-bottom: 0;
}

.summary-bars.summary-bars-below {
    width: 100%;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.summary-bars-below .summary-bar-row {
    max-width: 100%;
}

@media (max-width: 900px) {.compare-results-columns {
        grid-template-columns: 1fr;
    }

.compare-results-columns.compare-results-columns--three {
        grid-template-columns: 1fr;
    }}

.results-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: rgba(6, 10, 20, 0.8);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.results-page-header-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.results-page-header h1,
.results-page-header h2 {
    margin: 0;
    color: #ffffff;
}

.results-page-header-details {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.35;
}

.results-header-actions {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

.results-header-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkride-action-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.checkride-actions-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.checkride-last-run {
    font-size: 0.50rem;
    opacity: 0.85;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.results-page-content {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    padding: 2rem 2rem 1rem;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
    overflow-x: visible;
    background: radial-gradient(ellipse at 60% 40%, rgba(251, 191, 36, 0.06) 0%, transparent 50%), var(--bg-deep);
}

.results-layout {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    align-items: stretch;
    min-height: 0;
    flex: 1;
}

/* Results page: tablet and below – stack layout earlier */
@media (max-width: 992px) {
    #resultsPage .results-page-content {
        padding: 1.5rem;
    }

    #resultsPage .results-layout {
        flex-direction: column;
    }

    #resultsPage .results-section-panel {
        flex: none;
        max-height: none;
        min-height: 0;
    }

    #resultsPage .input-params-panel.collapsed {
        flex: 0 0 auto;
        min-width: 100%;
        max-width: none;
    }

    #resultsPage .input-params-panel:not(.collapsed) {
        flex: none;
        min-width: 0;
    }

    #resultsPage .input-params-panel .input-params-accordion-header {
        flex-direction: row;
        min-width: auto;
        padding: 0.75rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    #resultsPage .input-params-panel .input-params-accordion-label {
        writing-mode: horizontal-tb;
        transform: none;
    }

    #resultsPage .detailed-results-fullwidth {
        width: 100%;
        left: 0;
        right: 0;
        margin-left: 0;
        margin-right: 0;
        padding: 1rem;
    }

    .detail-show-all-row {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    body.light-mode #resultsPage .input-params-panel .input-params-accordion-header {
        border-bottom: 1px solid var(--glass-border);
    }
}

/* Full-width Detailed Results section below Input | Results (spans whole screen) */
.detailed-results-fullwidth {
    display: flex;
    flex-direction: column;
    flex: 2;
    width: 50%;
    padding: 1.5rem 2rem;
    max-height: calc(100vh - 180px);
    box-sizing: border-box;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.detailed-results-fullwidth:empty {
    display: none;
}

.results-section-panel {
    flex: 1 1 0;
    min-width: 0;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.results-section-panel:first-child {
    flex: 0 1 42%;
}

.input-params-panel {
    display: flex;
    flex-direction: row;
    padding: 0;
    overflow: visible;
}

.input-params-panel.collapsed {
    flex: 0 0 48px;
    min-width: 48px;
    max-width: 48px;
    background: var(--glass);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.input-params-panel:not(.collapsed) {
    flex: 0 1 42%;
    min-width: 200px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.input-params-panel.collapsed .input-params-accordion-body {
    display: none;
}

.input-params-accordion-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    min-width: 48px;
    background: var(--glass);
    border-radius: var(--radius-lg);
    border-right: 1px solid var(--glass-border);
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.input-params-accordion-header:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.input-params-panel .input-params-accordion-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    white-space: nowrap;
    line-height: 1.2;
}

.input-params-accordion-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem;
}

.input-params-accordion-toggle:hover {
    color: var(--primary-color);
}

.input-params-panel.collapsed .input-params-accordion-toggle {
    transform: rotate(0deg);
}

.input-params-accordion-body {
    flex: 1;
    min-width: 0;
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
}

.input-params-accordion-body .results-header-info {
    margin-top: 0;
}

.results-section-panel:last-child {
    flex: 0 1 58%;
}

.input-params-panel:not(.collapsed) + .results-section-panel {
    flex: 0 1 58%;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.input-params-panel.collapsed + .results-section-panel {
    flex: 1 1 0;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.results-section-panel h3 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

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

.input-params-section {
    margin-top: 1rem;
}

.input-params-section h4 {
    margin-bottom: 1rem;
    color: var(--text-primary-darkTheme);
    font-size: 1rem;
    font-weight: 600;
}

/* Left Panel Accordion Toggle Button */
.left-panel-toggle {
    display: none; /* Hidden on desktop */
}

/* Ensure toggle is never hidden by any rule */
.left-panel-toggle.hidden {
    display: flex !important;
}

@media (max-width: 768px) {.left-panel-toggle.hidden {
        display: flex !important;
    }

main { 
        height: calc(100vh - 152px) !important;
    }}

@media (min-width: 769px) and (max-width: 859px) {main { 
        height: calc(100vh - 82px) !important;
    }}

@media (min-width: 860px) {main { 
        height: calc(100vh - 127px) !important;
    }}

/* Desktop: Left panel always visible */
@media (min-width: 769px) {
    .left-panel {
        display: block !important;
        max-height: none !important;
        opacity: 1 !important;
    }
    
    .left-panel[aria-hidden] {
        display: block !important;
        max-height: none !important;
        opacity: 1 !important;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Main Layout - Stack vertically on mobile */
    .main-layout {
        flex-direction: column;
        min-height: auto;
        position: relative;
    }

    .left-panel-footer {
        position: static;
        margin-top: 1rem;
    }

    .left-panel-section {
        padding-bottom: 0;
    }

    .left-panel-powered-img {
        width: 100px;
    }
    
    /* Force toggle button to always be visible on mobile - highest priority */
    #leftPanelToggle.left-panel-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    /* Accordion Toggle Button - Show on mobile (default: dark) */
    .left-panel-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        align-items: center;
        justify-content: space-between;
        width: 100% !important;
        padding: 1rem !important;
        background-color: #000000 !important;
        color: #ffffff !important;
        border: none !important;
        border-bottom: 2px solid rgba(255, 255, 255, 0.2) !important;
        cursor: pointer !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        text-transform: uppercase;
        letter-spacing: 1px;
        transition: all 0.2s;
        z-index: 1000 !important;
        position: relative !important;
        margin: 0 !important;
        flex-shrink: 0;
        order: -1; /* Ensure it appears before the panel */
        min-height: 50px !important;
        height: auto !important;
    }
    
    /* Override any hidden class or any other rule that might hide it */
    .left-panel-toggle.hidden,
    .left-panel-toggle[hidden],
    .hidden .left-panel-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Ensure toggle is never covered by panel */
    .main-layout {
        position: relative;
    }
    
    .left-panel {
        position: relative;
        z-index: 1;
    }
    
    .left-panel-toggle:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .left-panel-toggle span:first-child {
        font-size: 1.5rem;
        margin-right: 0.5rem;
        transition: transform 0.2s;
    }
    
    .left-panel-toggle[aria-expanded="true"] span:first-child {
        transform: rotate(90deg);
    }
    
    .left-panel-toggle[aria-expanded="false"] span:first-child {
        transform: rotate(0deg);
    }
    
    /* Left Panel - Expanded by default, collapsed when accordion is closed */
    .left-panel {
        width: 100%;
        max-height: 400px;
        overflow-y: auto;
        padding: 1rem;
        border-bottom: 2px solid rgba(255, 255, 255, 0.2);
        transition: max-height 0.3s ease-out, padding 0.3s ease-out, border 0.3s ease-out;
        display: block;
        flex-shrink: 0;
    }
    
    .left-panel[aria-hidden="true"] {
        max-height: 0 !important;
        min-height: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        border-bottom: none !important;
        overflow: hidden;
        display: block;
        flex-shrink: 0;
        position: relative;
        z-index: 1;
    }
    
    /* Ensure toggle button is never hidden, even when panel is collapsed */
    .left-panel[aria-hidden="true"] ~ .right-content,
    .left-panel[aria-hidden="true"] + .right-content {
        margin-top: 0;
    }
    
    .left-panel[aria-hidden="true"] .left-panel-section,
    .left-panel[aria-hidden="true"] .left-panel-footer {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Right Content - Full width on mobile, remove top padding and add gradient */
    .right-content {
        padding: 0 1rem 1rem 1rem !important;
        width: 100%;
        padding-top: 0 !important;
        margin-top: 0 !important;
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%) !important;
    }
    
    /* Selection Panel - Remove top margin to eliminate white space */
    .selection-panel {
        padding: 1.5rem;
        margin-bottom: 1rem;
        margin-top: 0 !important;
    }
    
    /* File Selection Container */
    .file-selection-container {
        margin-top: 0;
    }
    
    /* File Select Header - Stack on mobile */
    .file-select-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .file-select-header label {
        font-size: 1.1rem;
    }
    
    /* Fly Action Container - Full width button */
    .fly-action-container {
        margin-top: 1rem;
    }
    
    .btn-fly {
        width: 100%;
    }
    
    /* Header - Stack on mobile */
    header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    header h1 {
        font-size: 1.25rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .header-divider {
        height: 24px;
    }

    .register-modal-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
        max-height: 90vh;
    }

    /* History Page - Mobile adjustments */
    .history-page-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .history-header-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .history-header-actions .btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }
    
    .history-page-content {
        padding: 1rem;
        background: var(--bg-deep);
        color: var(--text-primary-darkTheme);
    }
    
    .history-table {
        font-size: 0.875rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 1rem;
    }
    
    .history-table thead {
        display: none;
    }
    
    .history-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 1rem;
        background-color: var(--glass);
        box-shadow: var(--shadow);
    }
    
    .history-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.6rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        color: var(--text-primary-darkTheme);
    }
    
    .history-table tbody td:last-child {
        border-bottom: none;
    }
    
    .history-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 0.5rem;
        flex-shrink: 0;
        color: var(--text-secondary);
    }
    
    .history-table .config-bubbles-wrap {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    
    .history-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .history-actions .btn {
        min-height: 40px;
        padding: 0.5rem 0.75rem;
    }
    
    /* Actions cell - allow buttons to wrap on narrow screens */
    .history-table tbody td[data-label="Actions"] {
        flex-wrap: wrap;
    }
    
    .history-table tbody td[data-label="Actions"]::before {
        width: 100%;
        margin-bottom: 0.25rem;
    }
    
    .history-table tbody td[data-label="Actions"] .history-actions-cell-wrap {
        width: 100%;
    }
    
    /* History tabs - stack on mobile */
    #historyTableContainer .history-view-tabs-wrap {
        flex-direction: column;
        margin-bottom: 0.75rem;
    }
    
    #historyTableContainer .history-view-tabs {
        width: 100%;
    }

    #historyTableContainer .history-view-tab {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    /* History filter row - full width */
    .history-filters-row,
    .filterMenu .autocomplete-div {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .history-filter-wrapper {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* Light mode - mobile history */
    body.light-mode .history-page-content {
        background: var(--bg-lightTheme);
        color: var(--text-primary);
    }
    
    body.light-mode .history-table tbody tr {
        background-color: var(--card-bg);
        border-color: var(--glass-border);
    }
    
    body.light-mode .history-table tbody td {
        color: var(--text-primary);
        border-bottom-color: var(--glass-border);
    }
    
    body.light-mode .history-table tbody td::before {
        color: var(--text-secondary);
    }
    
    /* Results Page - Mobile adjustments */
    #resultsPage .results-page-header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    #resultsPage .results-page-header h1,
    #resultsPage .results-page-header h2 {
        font-size: 1.15rem;
    }

    #resultsPage .results-page-header-details {
        font-size: 0.78rem;
    }
    
    #resultsPage .results-header-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
    }

    #resultsPage .results-header-actions .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    #resultsPage .checkride-action-wrap {
        order: 1;
        width: 100%;
    }

    #resultsPage .header-divider {
        display: none;
    }
    
    #resultsPage .results-page-content {
        padding: 0.75rem 1rem;
    }
    
    #resultsPage .results-layout {
        flex-direction: column;
        gap: 1rem;
    }
    
    #resultsPage .results-section-panel {
        flex: none;
        max-height: none;
        padding: 1rem;
        min-height: 0;
    }
    
    #resultsPage .results-section-panel:first-child,
    #resultsPage .results-section-panel:last-child {
        flex: none;
    }

    #resultsPage .input-params-accordion-body {
        max-height: 50vh;
    }

    #resultsPage .detailed-results-fullwidth {
        padding: 0.75rem 1rem;
    }

    #resultsPage .params-container.params-table-wrap,
    #resultsPage .params-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #resultsPage .params-table td.param-name {
        white-space: nowrap;
    }

    #resultsPage .detailed-results-inline-tabs {
        gap: 0.35rem;
    }

    #resultsPage .detailed-results-inline-tab {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    #resultsPage .runiq-score-heading {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
    
    /* Buttons - Adjust sizes for mobile */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-history,
    .btn-fly,
    .btn-build {
        width: 100%;
        justify-content: center;
    }

    .forgotPassword-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
        max-height: 90vh;
    }

    /* Modal - Full screen on mobile */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
        max-height: 90vh;
    }

    .modal-trash-content {
        width: 100%;
        margin: 1rem auto;
        height: 100%;
    }

    .alert-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
        max-height: 90vh;
    }

    .modal-large {
        width: 95%;
        max-width: 95%;
    }

    .modal-trash-large {
        width: 100%;
        max-width: 100%;
    }

    /* Params Container - Stack chips on mobile */
    .params-container {
        flex-direction: column;
    }
    
    .param-chip {
        width: 100%;
        max-width: 100%;
    }
    
    .param-chip-value {
        max-width: none;
    }
    
    /* Metrics Grid - Single column on mobile */
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    /* File Content - Mobile adjustments */
    .file-content {
        padding: 1rem;
    }
    
    .file-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .file-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* Subfolder tabs - Mobile adjustments */
    .subfolder-tabs {
        gap: 0.25rem;
    }
    
    .subfolder-tab {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }
    
    /* Console Modal - Mobile adjustments */
    .console-output {
        font-size: 0.8rem;
        max-height: 60vh;
    }
    
    /* Results Page - Mobile adjustments */
    .results-header-info {
        margin-bottom: 1rem;
    }
    
    .result-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Compare Modal - Mobile adjustments */
    .compare-results-list {
        max-height: 50vh;
    }
}

@media (max-width: 480px) {/* Extra small screens */
    header h1 {
        font-size: 1.1rem;
    }

.left-panel-toggle {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

.toggle-text {
        font-size: 0.9rem;
    }

.left-panel {
        max-height: 300px;
    }

.left-panel[aria-hidden="true"] {
        max-height: 0;
        padding: 0;
        margin: 0;
    }

.left-panel-title {
        font-size: 0.75rem;
    }

.folder-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

.selection-panel {
        padding: 1rem;
    }

.file-select-header label {
        font-size: 1rem;
    }

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

.history-page-header h2,
    .history-page-header h1,
    .results-page-header h2 {
        font-size: 1.1rem;
    }

/* History page – extra small screens */
    .history-page-content {
        padding: 0.75rem;
    }

.history-table tbody tr {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

.history-table tbody td {
        padding: 0.5rem 0;
        font-size: 0.8rem;
    }

.history-actions .btn {
        min-height: 36px;
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

/* Results page – extra small */
    #resultsPage .results-page-header {
        padding: 0.5rem 0.75rem;
    }

#resultsPage .results-page-content {
        padding: 0.5rem 0.75rem;
    }

#resultsPage .results-section-panel {
        padding: 0.75rem;
    }

#resultsPage .detailed-results-fullwidth {
        padding: 0.5rem 0.75rem;
    }

#resultsPage .result-meta {
        font-size: 0.8rem;
    }

#resultsPage .params-table th,
    #resultsPage .params-table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }

.detail-show-all-row {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }}

/* Results View Styles */
.results-controls {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
}

.results-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.results-header h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.result-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Results summary – blue theme (dark blue background, lighter panels) */
.results-section.checkride-summary {
    border-color: rgba(255, 255, 255, 0.12);
    color: #e8eef5;
}

.results-section.checkride-summary .metric-label,
.results-section.checkride-summary .metric-value,
.results-section.checkride-summary .summary-bar-label,
.results-section.checkride-summary .tile-label,
.results-section.checkride-summary .instance-pricing-row {
    color: inherit;
}

.results-section.checkride-summary .tile-value,
.results-section.checkride-summary .runiq-pie-value,
.results-section.checkride-summary .runiq-value,
.results-section.checkride-summary .summary-bar-value {
    color: #fff;
    font-family: var(--font-mono);
}

.results-section.checkride-summary .results-top-tile {
    background: var(--glass);
    border-color: rgba(255, 255, 255, 0.15);
}

.results-section.checkride-summary .summary-footer {
    color: #c5d4e8;
}

.results-section.checkride-summary .runiq-score-caption .metric-label {
    color: rgba(255, 255, 255, 0.85);
}

.results-section.checkride-summary .runiq-score-caption .runiq-rating {
    color: #fff;
}

.results-section.checkride-summary .runiq-pie::before {
    background: var(--border-color);
}

.results-section.checkride-summary .summary-bar-track {
    background: var(--bg-deep);
    border-color: rgba(255, 255, 255, 0.15);
}

.results-section.checkride-summary .summary-bars {
    border: none;
}

.results-section h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.metrics-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--glass);
    border-radius: 6px;
}

.metric-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.metric-value {
    font-weight: 600;
    color: var(--text-primary-darkTheme);
}

.params-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Configuration Parameters table (replaces chips) */
.params-container.params-table-wrap {
    display: block;
    overflow-x: auto;
}

.params-table {
    width: 100%;
    font-size: 0.875rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

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

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

.params-table tbody tr:last-child td {
    border-bottom: none;
}

.params-table td.param-name,
.params-table td.param-value {
    font-family: inherit;
    font-size: inherit;
}

.params-table td.param-name {
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    width: 1%;
}

.params-table td.param-value {
    font-weight: 700;
    color: var(--text-primary-darkTheme);
    word-break: break-word;
    font-family: var(--font-mono);
}

.params-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

.params-table .no-params {
    color: var(--text-secondary);
    font-style: italic;
    padding: 1rem;
}

.param-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    white-space: nowrap;
    max-width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.param-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    background: var(--primary-hover);
}

.param-chip-key {
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.param-chip-value {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.param-key {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 150px;
}

.param-value {
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.no-params {
    color: var(--text-secondary);
    font-style: italic;
    padding: 1rem;
    text-align: center;
}

/* Detailed Results modal and Checkride summary */
.detailed-results-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.detailed-results-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
}

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

.detailed-results-tab.active {
    background: var(--primary-color);
    color: white;
}

.detailed-results-content {
    min-height: 200px;
}

.detailed-results-pane.hidden {
    display: none;
}

.detailed-results-pane {
    padding: 0.5rem 0;
}

.runiq-score-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-size: 1.1rem;
}

.runiq-score-heading .metric-label {
    color: rgba(255, 255, 255, 0.95);
}

.runiq-value {
    font-size: 1.25rem;
}

.workload-preview-wrap {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: var(--text-primary-darkTheme);
}

.workload-preview-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary-darkTheme);
}

.workload-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.workload-preview-card {
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 0.9rem;
    background: rgba(255,255,255,0.07);
}

.workload-preview-label {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.workload-preview-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary-darkTheme);
}

.workload-preview-section h3 {
    margin: 0 0 0.65rem 0;
    font-size: 0.95rem;
    color: var(--text-primary-darkTheme);
}

.workload-timing-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.workload-timing-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.workload-top-classes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.workload-class-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

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

.workload-class-count {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.artifact-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem;
}

.artifact-gallery-item {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    text-decoration: none;
    color: var(--text-primary);
}

.artifact-gallery-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
}

.artifact-gallery-item span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    word-break: break-word;
}

/* ── Detection gallery: side-by-side original + annotated pairs ── */
.detection-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.2rem;
}

.detection-pair {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
}

.detection-pair-image {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.detection-pair-image a {
    display: block;
    width: 100%;
}

.detection-pair-image img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.detection-pair-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.workload-preview-empty {
    padding: 1rem;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    background: var(--bg-color);
}

.workload-preview-warning {
    padding: 0.9rem 1rem;
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 10px;
    color: var(--text-primary);
    background: rgba(245, 158, 11, 0.12);
    margin-bottom: 1rem;
}

/* Whisper/ASR preview: audio clip + transcript cards */
.audio-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.9rem;
}

.audio-preview-card {
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    padding: 0.75rem;
}

.audio-preview-head {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: baseline;
    margin-bottom: 0.45rem;
}

.audio-preview-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    word-break: break-word;
}

.audio-preview-duration {
    font-size: 0.74rem;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
}

.audio-preview-card audio {
    width: 100%;
    margin: 0.25rem 0 0.55rem;
}

.audio-preview-text {
    font-size: 0.84rem;
    line-height: 1.4;
    color: var(--text-primary-darkTheme);
    word-break: break-word;
}

/* OCR Gallery: input image + extracted text pairs */
.ocr-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.ocr-pair {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    align-items: stretch;
}
.ocr-pair-image {
    flex: 0 0 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ocr-pair-image a { display: block; }
.ocr-pair-image img {
    max-width: 140px;
    max-height: 140px;
    border-radius: 6px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--border-color);
}
.ocr-pair-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

/* OCR Samples Table */
.ocr-samples-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.ocr-samples-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    border-bottom: 2px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.55);
}

.ocr-samples-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    vertical-align: middle;
    color: var(--text-primary-darkTheme);
    background: transparent;
}

.ocr-samples-table .ocr-sample-gt,
.ocr-samples-table .ocr-sample-pred {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.84rem;
    color: var(--text-primary-darkTheme);
}

.ocr-samples-table .ocr-sample-gt {
    color: var(--text-primary-darkTheme);
}

.ocr-samples-table .ocr-sample-pred {
    color: rgba(255,255,255,0.75);
}

.ocr-samples-table tr.ocr-match .ocr-sample-match { color: #34c759; font-weight: 700; font-size: 1.1rem; }

.ocr-samples-table tr.ocr-mismatch .ocr-sample-match { color: #ff453a; font-weight: 700; font-size: 1.1rem; }

.ocr-samples-table tr.ocr-mismatch .ocr-sample-pred { color: #ff8a80; }

.ocr-sample-img-cell { width: 80px; }

.ocr-sample-thumb {
    width: 72px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: #fff;
}

.ocr-no-image { color: #666; }

body.light-mode .workload-preview-wrap,
body.light-mode .workload-preview-header h2,
body.light-mode .workload-preview-section h3 {
    color: var(--text-primary);
}

body.light-mode .workload-preview-card {
    background: var(--card-bg);
    border-color: var(--glass-border);
}

body.light-mode .workload-preview-label {
    color: var(--text-secondary);
}

body.light-mode .workload-preview-value {
    color: var(--text-primary);
}

body.light-mode .audio-preview-card {
    background: var(--card-bg);
    border-color: var(--glass-border);
}

body.light-mode .audio-preview-name {
    color: var(--text-primary);
}

body.light-mode .audio-preview-duration {
    color: var(--text-secondary);
}

body.light-mode .audio-preview-text {
    color: var(--text-primary);
}

body.light-mode .ocr-samples-table th {
    color: var(--text-secondary);
    border-bottom-color: var(--border-color);
}

body.light-mode .ocr-samples-table td {
    color: var(--text-primary);
    border-bottom-color: var(--border-color);
}

body.light-mode .ocr-samples-table .ocr-sample-gt,
body.light-mode .ocr-samples-table .ocr-sample-pred {
    color: var(--text-primary);
}

.results-section.checkride-summary .runiq-score-heading {
    margin-top: 0;
}

/* Top area above RunIQ score – headings + 3 tiles: POWER | PERFORMANCE | COST */
.results-top-tiles-wrap {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.results-top-tiles-wrap-margin {
    margin-bottom: 0rem !important;
}

.results-top-tiles-headings {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.results-top-tiles-headings .tile-heading {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.tile-heading-left, .tile-heading-right {
    flex: 1;
}

.tile-heading-center {
    flex: 2;
}

.results-top-tiles {
    display: flex;
    gap: 1rem;
}

.results-top-tile {
    min-height: 80px;
    padding: 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Standard size and font for all 3 tiles above RunIQ Score */
.results-top-tile .tile-label {
    display: block;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    text-transform: none;
}

.results-top-tile .tile-value {
    display: block;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.9rem;
}

.results-top-tile-left, .results-top-tile-right {
    flex: 1;
}

.results-top-tile-center {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    flex: 2;
}

.tile-center-part {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 0.75rem;
}

.tile-center-part .tile-label {
    margin-bottom: 0.35rem;
}

.tile-center-divider {
    width: 1px;
    background-color: var(--text-secondary);
    opacity: 0.5;
    align-self: stretch;
    flex-shrink: 0;
}

/* When comparing 3 results: reduce Power/Performance/Cost header and labels so they fit */
.compare-results-columns--three .compare-result-column .results-top-tiles-wrap {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
}

.compare-results-columns--three .compare-result-column .results-top-tiles-headings {
    margin-bottom: 0.35rem;
    gap: 0.5rem;
}

.compare-results-columns--three .compare-result-column .results-top-tiles-headings .tile-heading {
    font-size: 0.7rem;
    letter-spacing: 0.2px;
}

.compare-results-columns--three .compare-result-column .results-top-tiles {
    gap: 0.5rem;
}

.compare-results-columns--three .compare-result-column .results-top-tile {
    min-height: 64px;
    padding: 0.5rem 0.4rem;
}

.compare-results-columns--three .compare-result-column .results-top-tile .tile-label {
    font-size: 0.72rem;
    margin-bottom: 0.2rem;
    line-height: 1.2;
    word-break: break-word;
    max-width: 100%;
}

.compare-results-columns--three .compare-result-column .results-top-tile .tile-value {
    font-size: 0.95rem;
}

.compare-results-columns--three .compare-result-column .tile-center-part {
    padding: 0 0.35rem;
}

.compare-results-columns--three .compare-result-column .tile-center-part .tile-label {
    font-size: 0.72rem;
    margin-bottom: 0.2rem;
}

/* RunIQ and Recommendation row: 3 columns to align with POWER | PERFORMANCE | COST; recommendation below COST */
.runiq-and-reco-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.runiq-and-reco-col {
    flex: 1;
    flex-direction: column;
}

.runiq-and-reco-col-left {
    display: flex;
    justify-content: space-between;
}

/* Performance, Efficiency, Value, Stability, Quality – centered in left column, below POWER (Tokens per watt) */
.summary-bars.summary-bars-left {
    margin-bottom: 45px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 280px;
}

.summary-bars-left .summary-bar-row {
    max-width: 100%;
}

.runiq-and-reco-col-center {
    display: flex;
    justify-content: center;
}

.runiq-and-reco-col-right {
    align-items: flex-start;
}

/* Recommendation block: shown only when Input Parameters accordion is collapsed; aligned below COST tile */
.recommendation-block {
    display: none;
    width: 100%;
    min-width: 0;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Recommendations block in checkride summary: blue/white like Tokens per dollar tile */
.results-section.checkride-summary .recommendation-block {
    background: var(--glass);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.results-section.checkride-summary .recommendation-block .recommendation-list,
.results-section.checkride-summary .recommendation-block .recommendation-list li {
    color: #fff;
}

.results-section.checkride-summary .recommendation-block .recommendation-list li.recommendation-text {
    border-top-color: rgba(255, 255, 255, 0.25);
}

/* Recommendations heading: outside the box, same font/color as POWER, PERFORMANCE, COST */
.recommendation-heading {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.results-section.checkride-summary .recommendation-heading {
    color: var(--text-secondary);
}

#resultsPage .input-params-panel.collapsed + .results-section-panel .recommendation-wrap {
    display: block;
}

#resultsPage .input-params-panel:not(.collapsed) + .results-section-panel .recommendation-wrap {
    display: none;
}

#resultsPage .input-params-panel.collapsed + .results-section-panel .recommendation-block {
    display: block;
}

#resultsPage .input-params-panel:not(.collapsed) + .results-section-panel .recommendation-block {
    display: none;
}

.recommendation-list {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.recommendation-list li {
    margin-bottom: 0.35rem;
}

.recommendation-list li.recommendation-text {
    list-style: none;
    margin-left: -1.25rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.recommendation-list li.recommendation-text strong {
    font-weight: 700;
}

/* RunIQ pie chart (out of 100) – centered */
.runiq-pie-center {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 0;
}

.run-pie-row {
    flex-direction: row !important;
}

.runiq-pie {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(
        var(--pie-color, #2e7d32) 0deg,
        var(--pie-color, #2e7d32) calc(var(--pct, 0) * 3.6deg),
        var(--bg-deep) calc(var(--pct, 0) * 3.6deg),
        var(--bg-deep) 360deg
    );
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.runiq-pie::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: var(--card-bg);
    box-shadow: inset 0 0 0 2px var(--border-color);
}

.runiq-score-caption .metric-label {
    display: block;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.runiq-score-caption .runiq-value {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.runiq-score-caption .runiq-rating {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.35rem;
}

/* Summary bars (0–100) – reduced height, value outside bar to the right */
.summary-bars {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.summary-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 420px;
    justify-content: center;
}

/* When summary bars are in the left column, constrain to column width */
.results-section.checkride-summary .summary-bars-left .summary-bar-row {
    max-width: 100%;
}

.summary-bar-label {
    flex: 0 0 120px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: right;
}

.summary-bar-track-wrap {
    flex: 1 1 auto;
    min-width: 80px;
    max-width: 200px;
}

.summary-bar-track {
    width: 100%;
    height: 2px;
    min-width: 60px;
    background: var(--bg-color);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.summary-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

.summary-bar-value-wrap {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-width: 2.5rem;
}

.summary-bar-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

/* Compare view: step-up (green) / step-down (red) icons next to summary values */
.summary-compare-icon {
    display: inline-block;
    margin-left: 0.2rem;
    font-size: 0.85em;
    vertical-align: middle;
    line-height: 1;
}

.summary-compare-icon.summary-compare-up {
    color: #22c55e;
}

.summary-compare-icon.summary-compare-down {
    color: #ef4444;
}

.summary-footer {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.summary-footer-instance-pricing {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.compare-summary-footer-instance-pricing {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    gap: 0.25rem;
}

.summary-footer .instance-pricing-row {
    font-weight: 500;
    line-height: 1.5;
}

.summary-footer .metric-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.summary-footer .metric-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Detailed Results inline (below summary, same screen) */
.detailed-results-inline {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
    outline: none;
}

.detailed-results-inline:empty {
    display: none;
}

.detailed-results-inline-heading {
    font-size: 1.1rem;
    color: var(--text-primary-darkTheme);
    padding-bottom: 0.5rem;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    flex: 0 0 auto;
}

.detailed-results-inline-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    flex: 0 0 auto;
}

.detailed-results-inline-tab {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

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

.detailed-results-inline-tab.active {
    background: var(--text-primary-darkTheme);
    color: var(--text-primary);
}

.detailed-results-inline-panes {
    display: flex;
    flex: 1;
    overflow: auto;
}

.detailed-results-inline-pane.hidden {
    display: none;
}

.detailed-results-inline-pane {
    height: 100%;
}

.detail-pane-center {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
    height: 100%;
    overflow: auto;
    gap:1rem;
    flex-wrap: wrap;
    padding-top: 10px;
}

.detail-section-box {
    margin-top: 0;
    padding: 1rem 1.25rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: fit-content;
    max-width: 100%;
}

.detail-pane-center .detail-params-nested,
.detail-pane-center .detail-nested-section {
    width: fit-content;
    max-width: 100%;
}

/* Show All tab: horizontal scroll of all section boxes; extend to screen edges */
.detail-show-all-row {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    /* overflow-x: auto;
    overflow-y: hidden; */
    padding: 0.5rem 0rem 1rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    height: 100%;
}

.detail-show-all-card {
    flex: 0 0 auto;
    min-width: 320px;
    max-width: 380px;
    padding: 1rem 1.25rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background: var(--glass);
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

.detail-show-all-card-heading {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    flex-shrink: 0;
}

.detail-show-all-card-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.detail-params-grid,
.detail-params-nested {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.detail-params-grid-CE {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.detail-params-grid-REM {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.detail-params-nested {
    flex-direction: row;
    gap: 1rem;
    flex-wrap: wrap;
}

.detail-param-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.35rem;
    width: fit-content;
    max-width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 1rem;
}

.detail-param-key {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detail-param-val {
    font-weight: 600;
    color: var(--text-primary-darkTheme);
    font-size: 0.9rem;
    font-family: var(--font-mono);
}

.detail-nested-section {
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background: var(--glass);
}

/* .detail-nested-section:first-child {
    margin-top: 0;
}

*/

.detail-nested-section h5 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary-darkTheme);
}

.raw-json {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 60vh;
    overflow-y: auto;
}

/* Comparison Styles */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

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

.comparison-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    left: 0;
}

.comparison-table tr:hover {
    background: var(--bg-color);
}

.comparison-table td:first-child {
    font-weight: 500;
    background: var(--bg-color);
    position: sticky;
    left: 0;
    z-index: 1;
}

/* Compare Results Modal */
.compare-results-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.compare-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.compare-result-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-color);
}

.compare-result-item.selected {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.compare-result-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.compare-result-info {
    flex: 1;
}

.compare-result-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

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

.btn-results {
    background-color: rgba(16,185,129,0.1);
    color: var(--secondary-green);
    border: 1px solid rgba(16,185,129,0.3);
    border-radius: 6px;
    transition: all 150ms ease;
    height: 32px;
    gap: 8px;
}

.btn-results:hover {
    background-color: rgba(16,185,129,0.2);
}

.iconstyle{
    display: flex;
    justify-content: center;
    align-items: center;
}

.material-symbols-outlined.filled-moon {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  color: var(--text-primary-darkTheme);
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-family: sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  margin-right: 10px;
}

.user-cell {
  display: flex;
  align-items: center;
}

.aligniconsCenter {
    position: relative;
    top: 5px;
}

/* ─── Telemetry Explorer ─────────────────────────────────────────────────── */

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

.telemetry-page-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.telemetry-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.telemetry-run-select {
    min-width: 420px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
    cursor: pointer;
}

.telemetry-run-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.telemetry-page-content {
    padding: 1.5rem 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Info bar */
.telemetry-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.telemetry-info-chip {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Dark chart panel */
.telemetry-chart-panel {
    background: #0f172a;
    border-radius: 10px;
    border: 1px solid #1e293b;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.telemetry-chart-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #1e293b;
}

.telemetry-metric-groups {
    display: flex;
    gap: 0.4rem;
}

.telemetry-group-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #334155;
    border-radius: 5px;
    background: transparent;
    color: #94a3b8;
    font-size: 0.65rem;
    font-weight: 600;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.15s;
}

.telemetry-group-btn:hover {
    background: var(--text-primary-darkTheme);
    color: var(--text-primary);
}

.telemetry-group-btn.active {
    background: var(--text-primary-darkTheme);
    color: var(--text-primary);
}

.telemetry-controls-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.telemetry-reset-btn {
    padding: 0.3rem 0.7rem;
    border: 1px solid #334155;
    border-radius: 5px;
    background: transparent;
    color: #94a3b8;
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.telemetry-reset-btn:hover {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #475569;
}

.telemetry-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
}

.telemetry-checkbox-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--primary-color);
}

.telemetry-chart-wrap {
    flex: 1;
    padding: 1rem 1.25rem 1.25rem;
    height: 100%;
    position: relative;
}

.telemetry-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Empty state */
.telemetry-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 300px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
    .telemetry-page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .telemetry-header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .telemetry-run-select {
        min-width: 0;
        flex: 1;
    }

    .telemetry-chart-controls {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

/* ─── Inline Telemetry (within Detailed Results tab) ─────────────────────── */

.telemetry-inline-container {
    padding-top: 0.5rem;
    height: 100%;
}

.telemetry-inline-container .telemetry-chart-wrap {
    min-height: 420px;
}

.compare-telemetry-wrapper {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.compare-telemetry-controls-wrapper {
    margin-bottom: 1rem;
}

.compare-telemetry-shared-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

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

.compare-telemetry-columns--three {
    grid-template-columns: 1fr 1fr 1fr;
}

.compare-telemetry-column {
    min-width: 0;
}

.compare-telemetry-column-third.hidden {
    display: none;
}

.compare-telemetry-container {
    height: 100%;
}

.compare-telemetry-panel {
    background: var(--glass);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.compare-telemetry-panel-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.compare-telemetry-maximize-btn,
.telemetry-fullscreen-btn {
    padding: 0.2rem 0.5rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.compare-telemetry-maximize-btn:hover,
.telemetry-fullscreen-btn:hover {
    background: var(--border-color);
    color: var(--text-color);
}

.telemetry-chart-controls .telemetry-fullscreen-btn {
    border-color: #334155;
    color: #94a3b8;
    padding: 0.3rem 0.55rem;
}

.telemetry-chart-controls .telemetry-fullscreen-btn:hover {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #475569;
}

.telemetry-chart-wrap--fullscreen,
.compare-telemetry-chart-wrap.telemetry-chart-wrap--fullscreen {
    cursor: pointer;
}

.compare-telemetry-chart-wrap {
    flex: 1;
    min-height: 280px;
    padding: 0.5rem;
}

.compare-telemetry-chart-wrap canvas {
    width: 100% !important;
    height: 260px !important;
}

.compare-telemetry-loading,
.compare-telemetry-empty,
.compare-telemetry-error {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.compare-telemetry-error {
    color: #ef4444;
}

/* Shared Legend for Compare Telemetry */
.compare-telemetry-legend-wrapper {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--glass);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.compare-telemetry-legend-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.compare-telemetry-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.15s ease;
    user-select: none;
}

.compare-telemetry-legend-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.compare-telemetry-legend-item.legend-item-hidden {
    opacity: 0.5;
}

.compare-telemetry-legend-item.legend-item-hidden .compare-telemetry-legend-label {
    text-decoration: line-through;
}

.compare-telemetry-legend-item.legend-item-hidden .compare-telemetry-legend-color {
    opacity: 0.4;
}

.compare-telemetry-legend-color {
    width: 24px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

.compare-telemetry-legend-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary-darkTheme);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Telemetry Fullscreen Modal */
.telemetry-fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.telemetry-fullscreen-modal.hidden {
    display: none;
}

.telemetry-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-deep);
}

.telemetry-modal-content {
    position: relative;
    width: 95vw;
    height: 90vh;
    max-width: 1800px;
    background: var(--glass);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

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

.telemetry-modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #e2e8f0;
}

.telemetry-modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.telemetry-modal-close:hover {
    background: #1a1a1a;
    color: #fff;
}

.telemetry-modal-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.telemetry-modal-controls .telemetry-controls-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.telemetry-zoom-hint {
    color: #64748b;
    font-size: 0.75rem;
    font-style: italic;
}

.telemetry-modal-chart-wrap {
    flex: 1;
    padding: 1rem 1.5rem;
    min-height: 0;
}

.telemetry-modal-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

body.modal-open {
    overflow: hidden;
}

/* Responsive adjustments for compare telemetry */
@media (max-width: 1200px) {
    .compare-telemetry-shared-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .compare-telemetry-columns {
        grid-template-columns: 1fr;
    }
    
    .compare-telemetry-columns--three {
        grid-template-columns: 1fr;
    }
    
    .telemetry-modal-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .telemetry-modal-controls .telemetry-controls-right {
        flex-wrap: wrap;
        justify-content: center;
    }
}

.filterMenu {
    width: 100%;
    display: flex;
    margin-bottom: 4px;
}

body.light-mode .filterlist {
    color: #000;
}

.show {
  display: block;
}

hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 0;
}

#checkboxContainer {
    max-height: 150px;
    overflow-y: auto;
    padding: 5px 0;
}

#filterMenu {
    min-width: 200px;
}

#filterSearch {
    width: 100%;
    padding: 4px;
    margin-top: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

#checkboxContainer {
    max-height: 50px; /* As requested */
    overflow-y: auto;
    border-bottom: 1px solid #eee;
}

.filter-item.hidden {
    display: none; /* Used for the autocomplete filtering */
}

/* Changed from #id to .class so it works for all 6 lists */
[id^="suggestions-list-"] {
  position: absolute;
  border: 1px solid #ddd;
  border-top: none;
  z-index: 1000;     /* Higher z-index to stay on top of other UI */
  top: 100%;
  left: 5px;         /* Match the padding of the container */
  right: 5px;
  background-color: white;
  color: #000;
  max-height: 250px;
  overflow-y: auto;
  box-shadow: 0px 4px 6px rgba(0,0,0,0.1); /* Adds depth */
  display: none;     /* Hidden by default */
}

/* Ensure the main wrapper allows wrapping on mobile */
.autocomplete-div {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

input[type="text"] {
    width: 100%;    /* Makes input fill the container */
    box-sizing: border-box;
}

/* When the JS adds 'visible', it shows regardless of hover */
.clear-icon.visible {
    display: block;
}

.filter-icon-align {
    position: relative;
    margin-right: 12px;
    cursor: pointer;
}

.history-filter-wrapper {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

#historyFilterMenu {
    position: absolute;
    top: 40px; /* Adjust based on icon height */
    left: 0;
    width: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 9999;
    background: var(--bg-deep);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.history-filter-menu {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;    /* Places it directly below the icon */
    right: 0;      /* Aligns the right edge of menu with icon */
    margin-top: 8px; /* Small gap from the icon */
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    z-index: 2000;
    border-radius: 6px;
}

.history-filter-menu.show {
    display: block; /* Shown when icon is clicked */
}

.history-filter-panes {
    display: flex;
    width: 500px;
    height: 350px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

/* Left Pane Styles */
.history-filter-sidebar {
    width: 180px;
    background: var(--glass);
    border-right: 1px solid var(--glass-border);
}

.history-filter-tab {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary-darkTheme);
    transition: background 0.2s;
}

.history-filter-tab:hover { background-color: rgba(255, 255, 255, 0.1); }

.history-filter-tab.active {
    color: var(--text-primary-darkTheme);
    font-weight: 600;
    border-right: 3px solid var(--accent-light);
    background-color: rgba(59, 130, 246, 0.08);
}

/* Right Pane Styles */
.history-filter-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    color: #000;
    position: relative;
}

.history-filter-content-wrapper{
    flex:1;
    overflow: hidden;
}

.new-history-filter-content{
    height: 84%;
}

.history-pane-item { display: none; }

.history-pane-item.active { display: block; }

.history-option-label {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-primary-darkTheme);
}

.history-option-label input { margin-right: 12px; }

@media screen and (max-width: 600px) {#historyFilterMenu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

.console-modal-div {
        height: auto;
        max-height: min(calc(2 * (100vh - 500px)), calc(100vh - 100px));
    }

.header-right {
        width: 100%;
        justify-content: flex-end;
        gap: 0.35rem;
    }

#header-nav-menu.nav-links {
        justify-content: flex-end;
        gap: 0;
    }

#header-nav-menu .nav-menus {
        padding: 0.35rem 0.5rem;
    }

#header-nav-menu .nav-menus li {
        font-size: 0.8rem;
    }

.modal-1 {
        top: 240px;
    }

.history-filter-menu {
        position: fixed;    /* Stay in place on mobile */
        top: 0 !important;  /* Cover from the top */
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;       /* Full width */
        height: 100vh;      /* Full height */
        margin-top: 0;
        border-radius: 0;
        z-index: 3000;
        background: var(--bg-deep) !important;
        border: none !important;
    }

.history-filter-panes {
        flex-direction: column; /* Stack sidebar on top of content */
        width: 100%;
        height: calc(100% - 60px); /* Leave room for footer */
    }

.history-filter-sidebar {
        width: 100%;
        height: auto;
        display: flex;
        flex-direction: row;    /* Sidebar becomes a horizontal scroll bar */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        white-space: nowrap;    /* Keep tabs on one line */
    }

.history-filter-tab {
        flex: 0 0 auto;         /* Don't squash the tabs */
        padding: 12px 16px;
        border-right: none;
        border-bottom: 3px solid transparent;
        font-size: 0.9rem;
    }

.history-filter-tab.active {
        border-right: none;
        border-bottom: 3px solid var(--accent);
    }

.history-filter-content {
        flex: 1;
        padding: 20px;
        color: var(--text-primary-darkTheme);
        overflow-y: auto;
    }

body.light-mode .history-filter-menu {
        background: #fff !important;
        border: 1px solid var(--border-color) !important;
    }

body.light-mode .history-filter-sidebar {
        border-bottom-color: var(--border-color);
    }

body.light-mode .history-filter-content {
        color: var(--text-primary);
    }

body.light-mode .history-filter-footer {
        background: #fff !important;
        border-top-color: var(--border-color);
    }}

/* The badge next to the main "Filter" text */
#total-filter-count {
    background-color: #fff;
    color: #000;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 0px;
    display: none; /* Default state: Hidden */
    vertical-align: middle;
}

body.light-mode #total-filter-count {
    color: #fff;
    background-color: #000;
}

#total-filter-count.active {
    display: inline-block;
    position: relative;
    left: -2px;
}

/* Sidebar tab badges */
.filter-count-badge {
    background-color: #fff;
    color: #000;
    font-size: 10px;
    padding: 1px 5px;
    margin-left: 5px;
    border-radius: 6px;
    display: none; /* Default state: Hidden */
}

body.light-mode .filter-count-badge{
    background-color: #000;
    color: #fff ;
}

.filter-count-badge.active {
    display: inline-block;
}

.clear-filter {
    position: absolute;
    right: 10px;
    bottom: 8px;
    color: var(--text-primary-darkTheme);
}

body.light-mode .clear-filter {
    color: var(--accent) !important;
    font-weight: 600;
}

.clear-filter-text {
    display: none;
    font-size: 16px;
}

.score-dial-placeholder {
    position: relative;
    width: 230px;
    aspect-ratio: 1 / 1;
  }

.compare-score-dial-placeholder {
    position: relative;
    width: 200px;
    aspect-ratio: 1 / 1;
}

.dial-housing {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.dial-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.glow {
  filter: drop-shadow(0 0 25px rgba(56, 189, 248, 0.4));
}

#dial-needle {
  transform-origin: 100px 100px;
  transition: transform 0.8s ease;
}

.secondary-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary-darkTheme);
  background-color: rgba(59, 130, 246, 0.2);
  border: 1px solid var(--border-focus-color);
  border-radius: var(--radius-sm);
  transition: all 150ms ease;
  box-shadow: 0 0 10px rgba(59,130,246,0.15);
  cursor: pointer;
  height: 40px;
}

.secondary-btn:hover {
    background-color: rgba(59, 130, 246, 0.3);
}

.tertiary-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  margin-left: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #cbd5e1;
  background-color: var(--glass);
  border: 1px solid #1f2937;
  border-radius: var(--radius-sm);
  transition: all 150ms ease;
  cursor: pointer;
  height: 40px;
}

.tertiary-btn:hover {
  background-color: #1e293b;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: white;
  background-color: var(--accent);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  transition: background-color 150ms ease;
}

.filter-btn:hover {
  background-color: #2563eb;
}

.glow-btn {
 transition: all 0.3s ease;
}

.glow-btn:hover {
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.fontSizeClass {
  font-size: 20px !important;
}

.tech-button {
  border-radius: 12px; /* Match the subtle curve of your image */
  border: 1px solid rgba(0, 242, 255, 0.3); /* Dimmed border */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden; /* Keeps the gloss inside */

  /* 2. The Deep Base */
  background: radial-gradient(circle at center, #0a1b2e 0%, #020508 100%);

  /* 3. SHINY EDGES (The "White" Highlights) */
  /* We use multiple inset shadows to create the bright corners */
  box-shadow:
    0 0 0 rgba(0, 0, 0, 0.7),           /* Deep outer shadow */
    inset 0 0 15px rgba(0, 242, 255, 0.1),    /* Faint internal blue glow */
    inset 2px 2px 1px rgba(255, 255, 255, 0.5), /* BRIGHT WHITE top-left edge */
    inset -1px -1px 1px rgba(255, 255, 255, 0.2); /* Soft white bottom-right edge */

  transition: all 0.3s ease;
  height: 40px;
  gap: 8px;
}

/* 4. GLOW BEHIND TEXT/ICON */
/* We use a pseudo-element to create a soft 'cloud' of light behind the icon */
.tech-button::before {
  content: "";
  position: absolute;
  width: 60px;
  height: 60px;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );
  filter: blur(20px);
  border-radius: 50%;
  z-index: 1;
}

/* 5. THE TOP GLASS GLOSS */
.tech-button::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 45%;
  /* Creates that sharp 'cut' highlight at the top */
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.02) 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* 6. ICON/TEXT STYLING */
.icon-glow {
  position: relative;
  z-index: 3; /* Sit above the background glow */
  color: #ffffff;
  /* The "Bloom" effect */
  filter: drop-shadow(0 0 3px rgba(0, 242, 255, 0.9));
}

.folder-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    color: #64748b;
    transition: color 0.15s ease;
}

/* Folder icon colors on hover and active states */
.group:hover .group-hover\:text-aws-400, 
.folder-tab.active .group-hover\:text-aws-400{
    color: #ff9900;
}

.group:hover .group-hover\:text-favflights-400,
.folder-tab.active .group-hover\:text-favflights-400 {
    color: var(--accent);
}

.group:hover .group-hover\:text-digitalocean-400,
.folder-tab.active .group-hover\:text-digitalocean-400 {
    color: #1A7FDC;
}

.group:hover .group-hover\:text-hotaisle-400,
.folder-tab.active .group-hover\:text-hotaisle-400 {
    color: #f97316;;
}

.folder-tab:hover .hotaisle-icon .hot-circle,
.folder-tab.active .hotaisle-icon .hot-circle{
    stroke: #facc15;
}

.group:hover .group-hover\:text-lambda-400,
.folder-tab.active .group-hover\:text-lambda-400 {
    color: #ffffff;
}

.group:hover .group-hover\:text-runpod-400,
.folder-tab.active .group-hover\:text-runpod-400 {
    color: #5d29f0;
}

.folder-tab:hover .self-hosted-icon .green-circle,
.folder-tab.active .self-hosted-icon .green-circle{
    fill: #34d399;
}

.folder-tab:hover .self-hosted-icon .red-circle,
.folder-tab.active .self-hosted-icon .red-circle{
    fill: #ef4444;
}

.folder-tab:hover .vultr-icon .bottomLayer,
.folder-tab.active .vultr-icon .bottomLayer{
    fill: #caf4ff;
}

.folder-tab:hover .vultr-icon .middleLayer,
.folder-tab.active .vultr-icon .middleLayer{
    fill: #50baff;
}

.folder-tab:hover .vultr-icon .topLayer,
.folder-tab.active .vultr-icon .topLayer{
    fill: #007cfc;
}

.group:hover .group-hover\:text-slate-200,
.folder-tab.active .group-hover\:text-slate-200 {
    color: #e2e8f0;
}

.fav-flights-view {
    margin-top: 0.5rem;
}

.fav-flights-view .history-table-container {
    margin-top: 0.75rem;
}

/* Starred runs list: larger, readable text than main history table (12px mono) */
.fav-flights-view .history-table th {
    font-size: 1.05rem;
}

.fav-flights-view .history-table td {
    font-size: 0.85rem;
    line-height: 1.25;
}

body.light-mode .fav-flights-view .history-table td {
    font-size: 0.85rem;
}

.alert-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary-darkTheme);
    text-align: start;
    font-family: var(--font-display);
}

.alert-message {
    display: block;
    padding: 15px 0px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.4;
    text-align: start;
}

.alert-btn-close {
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    position: relative;
    color: var(--text-primary-darkTheme);
}

.alert-btn-close:hover {
    background-color: var(--border-color);
    color: var(--text-primary-darkTheme);
}

.alert-footer {
    display: flex;
    justify-content: flex-end;
}

.alert-action-btns {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.modal-trash-large {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    background-color: var(--bg-deep);
    border: 1px solid var(--border-color);
    padding: 5px 5px 10px 4px;
    border-radius: 8px;
}

.no-scroll {
    overflow: hidden !important;
}

.graph-btn {
  background: rgba(124, 58, 237, 0.04);
  color: #8b93b0;
  border: 1px solid rgba(124, 58, 237, 0.18);
}

.graph-btn:hover {
  color: #e0d9ff;
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.08);
}

.graph-btn.active {
  color: #ede9fe;
  background: rgba(124, 58, 237, 0.16);
  border-color: rgba(124, 58, 237, 0.4);
  transform: scale(0.98);
}

.telemetry-btn {
  background: rgba(59, 130, 246, 0.05);
  color: #8aa0b6;
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 10px;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
}

.telemetry-btn:hover {
  color: #dbeafe;
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.08);
}

.telemetry-btn.active {
  color: #eff6ff;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.35);
  transform: scale(0.98);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  margin: 5px 0px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(139, 92, 246, 0.6),
    rgba(0, 255, 200, 0.4)
  );
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(139, 92, 246, 0.9),
    rgba(0, 255, 200, 0.7)
  );
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.6);
}

.detailed-results-inline-panes::-webkit-scrollbar-thumb {
  background: linear-gradient(
    90deg,
    rgba(139, 92, 246, 0.7),
    rgba(0, 255, 200, 0.6)
  );
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.detailed-results-inline-panes::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    90deg,
    rgba(139, 92, 246, 0.9),
    rgba(0, 255, 200, 0.8)
  );
  box-shadow: 0 0 6px rgba(139, 92, 246, 0.7);
}

.nav-links {
  background: #060a14cc;
  display: flex;
  list-style: none;
  align-items: center;
  justify-content: flex-end;
  padding: 4px;
}

.nav-links a {
  text-decoration: none;
  color: #fff;
  font-weight: 500;
  transition: color 0.3s ease;
  justify-content: center;
  display: flex;
  align-items: center;
}

.nav-links a:hover {
  color: #fff; /* Changes color on hover */
}

#header-nav-menu {
    display: none;    
}

#header-user-menu {
    display: none;
}

.curvy-tab {
    position: relative;
    padding: 10px 25px;
    background: #060a14cc;
    backdrop-filter: blur(16px);
    color: white;
    font-weight: 600;
    border: none;
    cursor: pointer;
    border-radius: 10px 25px 10px 0px;
    border-top: 1px solid transparent;
    border-left: 1px solid transparent;
    border-right: 1px solid transparent;
}

/* Main Layout Containers */
.main-layout {
    /* max-width: 1400px; */
}

/* 50/50 Main Tabs */
.main-toggle-tabs {
    display: flex;
    width: 100%;
    margin-bottom: -1px; /* Overlap with content border */
}

.main-tab-btn {
    flex: 1;
    padding: 10px;
    background: #1a1f2e;
    color: #94a3b8;
    border: 1px solid #3b82f64d;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.main-tab-btn.active {
    background: #0b1224;
    color: #1d4ed8;
    border-bottom: 2px solid #1d4ed8; /* Seamless look */
    z-index: 2;
}

/* View Pane */
.main-view-pane {
    display: none;
    background: #0b1224;
    border: 1px solid #3b82f64d;
    border-radius: 0 0 15px 15px;
}

.main-view-pane.active {
    display: block;
}

.left-panel {
    width: 250px;
    height: calc(100vh - 166px);
    flex-shrink: 0;
    border-right: 1px solid #3b82f626;
    padding-right: 15px;
}

.right-content {
    flex-grow: 1;
}

.hidden { display: none; }

.nav-menus {
    padding: 2px 60px 10px 60px;
    border-bottom: 1px solid #fff;
    border-right: 1px solid #fff;
    cursor: pointer;
}

.nav-menus li {
    display: flex;
    align-items: center;
    justify-content: center;
}

.config-bubble-offline {
    font-weight: 600;
    color: #CBD5F5;
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(148, 163, 184, 0.12);
}

body.light-mode .config-bubble-offline {
    background: #e2e8f0;
}

/* Full-screen overlay: #consoleModal is a sibling of #app in the DOM; without fixed
   positioning it stacks below the Flight Selector in normal document flow. */
#consoleModal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    overflow-y: auto;
    background: rgba(6, 10, 20, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#consoleModal:not(.hidden) {
    display: flex;
    flex-direction: column;
}

body.light-mode #consoleModal {
    background: rgba(248, 250, 252, 0.96);
}

.console-modal-header {
    display: flex;
    padding: 1rem 2rem;
    flex-direction: row;
    justify-content: space-between;
    color: #fff;
}

.console-modal-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

body.light-mode .console-modal-header {
    color: var(--text-primary);
}

.console-modal-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.console-modal-content {
    padding: 1rem 2rem;    
}

.console-info-status .info-row-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.console-status-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    min-width: 0;
    flex: 1 1 auto;
}

.console-status-badge-wrap {
    min-width: 0;
}

.console-copy-output-btn {
    flex: 0 0 auto;
}

.console-modal-div {
    display: flex;
    flex-direction: column; /* Stacks the label and the logs vertically */
    max-height: min(calc(2 * (100vh - 480px)), calc(100vh - 140px));
    min-height: 160px;
    height: auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.output-label {
    padding: 8px 17px 0; 
    font-size: 16px;
    flex-shrink: 0;
}

#consoleOutput {
    flex-grow: 1;
    overflow: auto;     
    margin: 4px !important;
    padding-bottom: 10px;
    border-radius: var(--radius-xl);    
    word-break: break-all;
    white-space: pre-wrap; 
}

.in-app-notification-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(420px, calc(100vw - 2rem));
    pointer-events: none;
}

.in-app-notification {
    pointer-events: auto;
    background: var(--surface-elevated, #1e293b);
    border: 1px solid var(--border-subtle, #334155);
    border-radius: var(--radius-lg, 10px);
    padding: 0.85rem 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    text-align: left;
}

.in-app-notification h4 {
    margin: 0 0 0.35rem 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.in-app-notification p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.9;
    line-height: 1.35;
}

.run-request-fulfill-banner {
    margin: 0 1.5rem 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md, 8px);
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.35);
    font-size: 0.9rem;
    color: #f1f5f9;
    line-height: 1.45;
}

.run-request-fulfill-banner strong {
    color: #ffffff;
    font-weight: 600;
}

.run-request-fulfill-banner .run-request-plan-ref {
    margin: 0.5rem 0 0 0;
    color: #e2e8f0;
    font-size: 0.88rem;
}

body.light-mode .run-request-fulfill-banner {
    color: #0f172a;
}

body.light-mode .run-request-fulfill-banner strong {
    color: #0c1222;
}

body.light-mode .run-request-fulfill-banner .run-request-plan-ref {
    color: #334155;
}

body.light-mode .in-app-notification {
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.header-notifications-li {
    list-style: none;
    position: relative;
    display: flex;
    align-items: center;
}

/* Bridge the gap below the bell so hover stays active while moving into the panel */
.header-notifications-li::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 0;
    width: min(400px, calc(100vw - 2rem));
    height: 8px;
}

.header-notifications-btn {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.header-notifications-badge {
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 4px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
}

.header-notifications-badge.hidden {
    display: none !important;
}

.header-notifications-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(400px, calc(100vw - 2rem));
    max-height: min(70vh, 520px);
    display: flex;
    flex-direction: column;
    background: var(--surface-elevated, #1e293b);
    border: 1px solid var(--border-subtle, #334155);
    border-radius: var(--radius-lg, 10px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    z-index: 10060;
    /* body uses --text-primary (dark); panel is dark — force light copy */
    color: #f1f5f9;
}

.header-notifications-panel.hidden {
    display: none !important;
}

.header-notifications-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-subtle, #334155);
    font-weight: 600;
    color: #f8fafc;
}

.header-notifications-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.header-notifications-expand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 6px;
    opacity: 0.85;
}

.header-notifications-expand:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

.header-notifications-title {
    color: inherit;
}

.header-notifications-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    padding: 0 0.25rem;
}

.header-notifications-list {
    overflow-y: auto;
    padding: 0.5rem;
 flex: 1;
}

.header-notif-item {
    position: relative;
    border-radius: var(--radius-md, 8px);
    padding: 0.65rem 2.25rem 0.65rem 0.65rem;
    margin-bottom: 0.5rem;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    text-align: left;
    cursor: pointer;
}

.header-notif-item.notif-unread {
    border-color: #dc2626;
}

.header-notif-item.notif-read-resolved {
    border-color: #16a34a;
}

.header-notif-item.notif-read-neutral {
    border-color: rgba(148, 163, 184, 0.45);
}

.header-notif-item h4 {
    margin: 0 0 0.35rem 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #f8fafc;
}

.header-notif-item p {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.35;
    opacity: 0.95;
    color: #e2e8f0;
}

.header-notif-status {
    font-size: 0.72rem;
    margin-top: 0.35rem;
    opacity: 0.95;
    font-weight: 500;
    color: #cbd5e1;
}

.header-notif-details {
    margin: 0.45rem 0 0 0;
    padding: 0;
    font-size: 0.72rem;
    line-height: 1.35;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.header-notif-detail-row {
    display: grid;
    grid-template-columns: 6.75rem minmax(0, 1fr);
    gap: 0.35rem 0.5rem;
    align-items: baseline;
}

.header-notif-detail-row dt {
    margin: 0;
    padding: 0;
    font-weight: 600;
    opacity: 0.88;
    color: #94a3b8;
}

.header-notif-detail-row dd {
    margin: 0;
    padding: 0;
    word-break: break-word;
    color: #e2e8f0;
}

.header-notif-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.header-notif-actions button {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border-subtle, #475569);
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
}

.header-notif-actions button.header-notif-accept {
    border-color: #16a34a;
    color: #86efac;
}

.header-notif-actions button.header-notif-reject {
    border-color: #dc2626;
    color: #fca5a5;
}

.header-notif-delete {
    position: absolute;
    top: 0.4rem;
    right: 0.35rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem;
    opacity: 0.75;
    color: #e2e8f0;
    line-height: 1;
}

.header-notif-delete:hover {
    opacity: 1;
}

body.light-mode .header-notifications-panel {
    background: #fff;
    border-color: #e2e8f0;
    color: #0f172a;
}

body.light-mode .header-notifications-panel-header {
    color: #0f172a;
}

body.light-mode .header-notif-item h4 {
    color: #0f172a;
}

body.light-mode .header-notif-item p {
    color: #334155;
}

body.light-mode .header-notif-status {
    color: #475569;
}

body.light-mode .header-notif-detail-row dt {
    color: #64748b;
}

body.light-mode .header-notif-detail-row dd {
    color: #334155;
}

body.light-mode .header-notif-delete {
    color: #475569;
}

body.light-mode .header-notif-item {
    background: #f8fafc;
}

body.light-mode .header-notif-actions button.header-notif-accept {
    color: #166534;
}

body.light-mode .header-notif-actions button.header-notif-reject {
    color: #991b1b;
}

/* Full-page notifications */
#notificationsPage {
    min-height: calc(100vh - 4rem);
    padding: 0 1rem 2rem;
    background: var(--bg-root, #0f172a);
    color: var(--text-primary, #f1f5f9);
    /* Set from JS (syncHistoryPageStickyOffset) to match `.app-top-header` height — same as history page. */
    --notifications-sticky-offset: 5.75rem;
}

.notifications-full-header {
    position: sticky;
    top: var(--notifications-sticky-offset);
    z-index: 60;
    background: var(--bg-root, #0f172a);
    padding: 0.75rem 0 1rem;
    border-bottom: 1px solid var(--border-subtle, #334155);
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.notifications-full-header-row {
    width: 100%;
    max-width: 56rem;
    display: grid;
    grid-template-columns: minmax(4.5rem, 1fr) auto minmax(4.5rem, 1fr);
    align-items: center;
    min-height: 2.75rem;
    margin-bottom: 0.85rem;
    padding: 0 0.5rem;
    box-sizing: border-box;
}

.notifications-full-header h1 {
    grid-column: 2;
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    justify-self: center;
}

.notifications-full-back {
    grid-column: 1;
    justify-self: start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0.35rem;
    gap: 0;
}

.notifications-full-back .material-symbols-outlined {
    font-size: 1.35rem;
    line-height: 1;
}

.notifications-full-toolbar {
    width: 100%;
    max-width: 56rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.85rem 1.25rem;
    padding: 0 0.5rem;
    box-sizing: border-box;
}

.notifications-full-search-wrap {
    flex: 1 1 auto;
    min-width: min(100%, 18rem);
    max-width: 36rem;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-md, 8px);
    border: 1px solid var(--border-subtle, #475569);
    background: rgba(255, 255, 255, 0.04);
}

.notifications-full-search-icon {
    font-size: 1.35rem;
    color: #ffffff;
    opacity: 0.95;
}

.notifications-full-search {
    flex: 1;
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 1.05rem;
    min-width: 0;
    outline: none;
}

.notifications-full-search::placeholder {
    color: rgba(241, 245, 249, 0.55);
}

.notifications-full-sort-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #f8fafc;
    white-space: nowrap;
}

.notifications-full-sort {
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--border-subtle, #475569);
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    font-size: 0.95rem;
    color-scheme: dark;
    cursor: pointer;
}

.notifications-full-sort option {
    background: #1e293b;
    color: #f8fafc;
}

.notifications-full-clear {
    white-space: nowrap;
}

.notifications-full-clear:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.notifications-full-content {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.notifications-full-meta {
    font-size: 0.8rem;
    color: #ffffff;
    opacity: 1;
    margin: 0 0 0.75rem 0;
}

.notifications-full-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notifications-full-list .header-notif-item {
    margin-bottom: 0;
}

.notif-item-full-page {
    padding-top: 0.85rem;
}

.header-notif-date {
    font-size: 0.72rem;
    opacity: 0.8;
    margin-bottom: 0.35rem;
    color: #94a3b8;
}

.notifications-full-empty {
    padding: 1.5rem 0;
    opacity: 0.85;
    font-size: 0.9rem;
}

.notifications-full-load-more-wrap {
    margin-top: 1.25rem;
    display: flex;
    justify-content: center;
}

body.light-mode #notificationsPage {
    background: #f8fafc;
    color: #0f172a;
}

body.light-mode .notifications-full-header {
    background: #f8fafc;
    border-bottom-color: #e2e8f0;
}

body.light-mode .notifications-full-search-wrap {
    background: #fff;
    border-color: #e2e8f0;
}

body.light-mode .notifications-full-sort {
    background: #fff;
    border-color: #cbd5e1;
    color: #0f172a;
    color-scheme: light;
}

body.light-mode .notifications-full-sort-label {
    color: #0f172a;
}

body.light-mode .notifications-full-sort option {
    background: #fff;
    color: #0f172a;
}

body.light-mode .notifications-full-search-icon {
    color: #0f172a;
    opacity: 0.7;
}

body.light-mode .notifications-full-search {
    color: #0f172a;
}

body.light-mode .notifications-full-search::placeholder {
    color: rgba(15, 23, 42, 0.45);
}

body.light-mode .notifications-full-meta {
    color: #0f172a;
}

body.light-mode .header-notif-date {
    color: #64748b;
}

/* In-app toast (e.g. new notifications while polling) */
.ff-app-toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%) translateY(120%);
    z-index: 100050;
    max-width: min(28rem, calc(100vw - 2rem));
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    color: #f1f5f9;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    border: 1px solid rgba(59, 130, 246, 0.45);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    cursor: pointer;
    opacity: 0;
    transition: transform 0.28s ease, opacity 0.28s ease;
}

.ff-app-toast.ff-app-toast-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

body.light-mode .ff-app-toast {
    color: #0f172a;
    background: #fff;
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.12);
}

/* Run-request configuration diff (developer save vs requester’s original YAML) */
.modal-content.modal-large.config-diff-modal-inner {
    max-width: min(960px, 96vw);
    width: 100%;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.config-diff-modal-hint {
    margin: 0 1rem 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.45;
}

.config-diff-panels-wrap {
    flex: 1;
    overflow: auto;
    min-height: 200px;
    max-height: min(70vh, 720px);
    margin: 0 0.75rem 1rem;
    border: 1px solid var(--border-color, #334155);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.35);
}

.config-diff-sidebyside {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.config-diff-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

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

.config-diff-pane {
    margin: 0;
    padding: 0.2rem 0.5rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 1.35em;
}

/* Unchanged lines: bright white on dark UI so YAML is easy to read */
body:not(.light-mode) .config-diff-pane.config-diff-same {
    color: #ffffff;
    background: transparent;
}

.config-diff-pane.config-diff-del {
    background: rgba(239, 68, 68, 0.18);
    color: #fecaca;
}

.config-diff-pane.config-diff-add {
    background: rgba(34, 197, 94, 0.2);
    color: #bbf7d0;
}

.config-diff-pane.config-diff-empty {
    background: rgba(15, 23, 42, 0.25);
}

body.light-mode .config-diff-panels-wrap {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.light-mode .config-diff-pane.config-diff-same {
    color: #0f172a;
}

body.light-mode .config-diff-pane.config-diff-del {
    background: rgba(239, 68, 68, 0.12);
    color: #991b1b;
}

body.light-mode .config-diff-pane.config-diff-add {
    background: rgba(34, 197, 94, 0.15);
    color: #166534;
}

body.light-mode .config-diff-pane.config-diff-empty {
    background: #f1f5f9;
}

body.light-mode .config-diff-row {
    border-bottom-color: #e2e8f0;
}

#headerNotificationsBtn.active {
    color: rgb(29, 78, 216) !important;
}

.line-indicator {
    width: 100%;
    border-top: 3px dotted rgba(255, 255, 255, 0.2);
    position: relative;
}

body.light-mode .line-indicator {
    border-top: 3px dotted #cbd5e1;
}

/* plane */
.plane {
    position: absolute;
    top: 50%;
    transform: translateY(-56%);
    animation: flyLine 1.5s linear infinite;
    font-size: 18px;
}

/* animation */
@keyframes flyLine {
    0%   { left: -10px; opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

.yaml-content-div {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin: 2rem;
    box-shadow: var(--shadow);
}

/* driver-popover styles related to guided help tour */
.driver-popover.driverjs-theme {
    --driver-popover-bg-color: #1a2d4d;
    --driver-popover-text-color: #cbd5e1;
    --driver-popover-description-color: var(--text-primary-darkTheme);
    --driver-popover-border-radius: 12px;
    background: linear-gradient(
            180deg,
            #5FADE8 0%,
            #4A92D2 50%,
            #357ABC 100%
    );
    border: 1px solid rgba(59, 130, 246, 0.35);
    box-shadow: 0 12px 32px rgba(2, 8, 23, 0.45), 0 0 0 1px rgba(96, 165, 250, 0.08);
    padding: 20px 20px 15px 15px;
    color: var(--driver-popover-text-color);
}

body.light-mode .driver-popover.driverjs-theme {
    --driver-popover-bg-color: #eff6ff;
    --driver-popover-text-color: #334155;
    --driver-popover-description-color: #475569;
    background: linear-gradient(145deg, #f8fbff 0%, #e8f2ff 100%);
    border: 1px solid rgba(37, 99, 235, 0.22);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.driver-popover.driverjs-theme .driver-popover-description {
    font-family: "Inter", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--driver-popover-description-color);
}

.driver-popover.driverjs-theme .driver-popover-progress-text {
    color: var(--driver-popover-description-color);
}

.driver-popover.driverjs-theme .driver-popover-arrow {
    border-width: 8px;
}

.driver-popover.driverjs-theme .driver-popover-arrow-side-left.driver-popover-arrow {
    border-left-color: #5FADE8;
}

.driver-popover.driverjs-theme .driver-popover-arrow-side-right.driver-popover-arrow {
    border-right-color: #5FADE8;
}

.driver-popover.driverjs-theme .driver-popover-arrow-side-top.driver-popover-arrow {
    border-top-color: #5FADE8;
}

.driver-popover.driverjs-theme .driver-popover-arrow-side-bottom.driver-popover-arrow {
    border-bottom-color: #5FADE8;
}

body.light-mode .driver-popover.driverjs-theme .driver-popover-arrow-side-left.driver-popover-arrow {
    border-left-color: #eff6ff;
}

body.light-mode .driver-popover.driverjs-theme .driver-popover-arrow-side-right.driver-popover-arrow {
    border-right-color: #eff6ff;
}

body.light-mode .driver-popover.driverjs-theme .driver-popover-arrow-side-top.driver-popover-arrow {
    border-top-color: #eff6ff;
}

body.light-mode .driver-popover.driverjs-theme .driver-popover-arrow-side-bottom.driver-popover-arrow {
    border-bottom-color: #eff6ff;
}

.driver-popover.driverjs-theme button {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: var(--text-primary-darkTheme);
    border: 1px solid rgba(96, 165, 250, 0.45);
    text-shadow: none;
    font-size: 16px;
    padding: 4px 10px;
    font-family: "Inter", sans-serif;
    border-radius: 5px;
}

.driver-popover.driverjs-theme .driver-popover-prev-btn {
    background: rgba(15, 25, 50, 0.6);
    color: #e2e8f0;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

body.light-mode .driver-popover.driverjs-theme button {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: var(--text-primary-darkTheme);
    border-color: rgba(37, 99, 235, 0.35);
}

body.light-mode .driver-popover.driverjs-theme .driver-popover-prev-btn {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid rgba(37, 99, 235, 0.25);
}

.driver-popover.driverjs-theme .driver-popover-close-btn {
    background: transparent !important;
    color: var(--text-primary-darkTheme) !important;
    padding: 0px;
    border: none;
    border-radius: 0px;
    font-size: 18px;
}

body.light-mode .driver-popover.driverjs-theme .driver-popover-close-btn {
    color: var(--text-primary) !important;
}