/* --- CSS Custom Design Variables --- */
:root {
    --bg-dark: #070913;
    --card-glass: rgba(13, 17, 34, 0.7);
    --border-glass: rgba(99, 102, 241, 0.12);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    --input-bg: rgba(255, 255, 255, 0.03);
    --input-color: #ffffff;
    --navbar-bg: rgba(7, 9, 19, 0.7);
    --shadow-color: rgba(0, 0, 0, 0.4);
    --mesh-glow-1: rgba(99, 102, 241, 0.15);
    --mesh-glow-2: rgba(16, 185, 129, 0.1);
    --mesh-bg-color: rgba(7, 9, 19, 1);
    --stat-card-hover-shadow: rgba(0, 0, 0, 0.4);
    --modal-content-bg: rgba(18, 18, 30, 0.85);
    --code-bg: rgba(0, 0, 0, 0.25);
    --code-color: #fca5a5;
    --tag-input-bg: rgba(0, 0, 0, 0.2);
    --table-header-bg: rgba(255, 255, 255, 0.02);

    /* Modular Typographic Scale (1.2x Minor Third) */
    --text-xs: 0.75rem;     /* 12px */
    --text-sm: 0.875rem;    /* 14px */
    --text-base: 1rem;      /* 16px */
    --text-lg: 1.125rem;    /* 18px */
    --text-xl: 1.25rem;     /* 20px */
    --text-2xl: 1.5rem;     /* 24px */
    --text-3xl: 1.875rem;   /* 30px */
    --text-4xl: 2.25rem;    /* 36px */
    --text-5xl: 3rem;       /* 48px */

    /* Spacing Rhythm (4px Geometric Scale) */
    --space-xs: 0.25rem;    /* 4px */
    --space-sm: 0.5rem;     /* 8px */
    --space-md: 1rem;       /* 16px */
    --space-lg: 1.5rem;     /* 24px */
    --space-xl: 2rem;       /* 32px */
    --space-xxl: 3rem;      /* 48px */

    /* Cohesive Contrast Color Scales */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --indigo-glow: #6366f1;
    --teal-glow: #10b981;
    --amber-warning: #f59e0b;
    --red-alert: #f43f5e;
}

/* Light Theme Overrides */
html[data-theme="light"] {
    --bg-dark: #f8fafc;
    --card-glass: rgba(255, 255, 255, 0.8);
    --border-glass: rgba(99, 102, 241, 0.15);
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-color: #0f172a;
    --navbar-bg: rgba(244, 246, 252, 0.7);
    --shadow-color: rgba(99, 102, 241, 0.06);
    --mesh-glow-1: rgba(99, 102, 241, 0.12);
    --mesh-glow-2: rgba(16, 185, 129, 0.08);
    --mesh-bg-color: #f8fafc;
    --stat-card-hover-shadow: rgba(99, 102, 241, 0.12);
    --modal-content-bg: rgba(255, 255, 255, 0.9);
    --code-bg: rgba(241, 245, 249, 0.9);
    --code-color: #991b1b;
    --tag-input-bg: rgba(241, 245, 249, 0.8);
    --table-header-bg: rgba(99, 102, 241, 0.04);

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --indigo-glow: #4f46e5;
    --teal-glow: #059669;
    --amber-warning: #d97706;
    --red-alert: #e11d48;
}

/* Ensure smooth theme transitions (Explicit, high-performance transitions) */
html, body, .glass-card, .navbar, .btn, input, table, th, td {
    transition: background-color 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                color 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Keyboard Focus Ring Accessibility --- */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--indigo-glow) !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15) !important;
}

/* --- Motion Accessibility Controls --- */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-delay: -1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
        transition-delay: -1ms !important;
        transform: none !important;
    }
    .glass-card-interactive:hover {
        transform: none !important;
        box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.15) !important;
    }
}

/* --- Global Premium Scrollbar Styles (Standardized across all scrollable regions) --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.22);
}

/* Standardized scrollbars for Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

html[data-theme="light"] * {
    scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}

/* --- Base Body & Layout --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Form controls do NOT inherit font-family from their parent by default, so a bare
   <input>/<select>/<textarea>/<button> renders in the browser's default UI font and looks out of
   place next to the rest of the app. Force them onto the app font; anything that genuinely needs a
   different face (e.g. a monospace field) still wins via its own class/inline rule. */
input,
select,
textarea,
button {
    font-family: inherit;
}

/* --- Animated Gradient Mesh Background --- */
.mesh-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: radial-gradient(circle at 15% 15%, var(--mesh-glow-1) 0%, transparent 40%),
                radial-gradient(circle at 85% 85%, var(--mesh-glow-2) 0%, transparent 45%),
                radial-gradient(circle at 50% 50%, var(--mesh-bg-color) 0%, var(--mesh-bg-color) 100%);
    pointer-events: none;
}

.mesh-background::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    filter: url(#drafts-grain-filter);
    opacity: 0.85;
}

/* --- Global Utilities --- */
.hidden {
    display: none !important;
}

.margin-top {
    margin-top: 1.5rem;
}

/* --- Flex Truncation Overflow Protectors & Typographic Balance --- */
#activeWorkspaceBadge, .workspace-stats-card, .formula-mapping-cell {
    min-width: 0; /* Enforces parent bounds clamp, triggering clean ellipsis text-overflow */
}

h1, h2, h3, h4, .hero-title {
    text-wrap: balance; /* Prevents awkward single-word orphans on wrapping lines */
}

/* --- Header / Navigation Bar --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid var(--border-glass);
    background-color: var(--navbar-bg);
    width: 100%;
}

.navbar-container {
    width: 90%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.25rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.company-logo-frame {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    padding: 6px 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.company-logo-frame:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-color), 0 0 15px rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.company-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-divider {
    width: 1px;
    height: 22px;
    background-color: rgba(255, 255, 255, 0.15);
    margin: 0 0.75rem;
}

.logo-text {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: 0.08rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Button Styling --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--indigo-glow) 0%, #4f46e5 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-glowing {
    position: relative;
    overflow: hidden;
}

.btn-glowing::after {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
    transition: 0.75s;
}

.btn-glowing:hover::after {
    left: 125%;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.5rem 1.1rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* --- Table Actions Button --- */
.btn-table-remove {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background-color: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    outline: none;
}

.btn-table-remove:hover {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.45);
    color: #ffffff;
    transform: translateY(-1px);
}

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


.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- Container Section System --- */
.container {
    flex: 1;
    width: 90%;
    max-width: 1440px;
    margin: 2.5rem auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.4s ease-out forwards;
}

/* --- Glassmorphic Card --- */
.glass-card {
    background: var(--card-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.15), 0 16px 40px 0 rgba(0, 0, 0, 0.3);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* --- STEP 1: Hero Banner & Drag-and-Drop Area --- */
.hero-title-container {
    text-align: center;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.hero-title span {
    background: linear-gradient(135deg, var(--indigo-glow) 0%, var(--teal-glow) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 750px;
    margin: 0 auto;
    line-height: 1.6;
}

.drop-zone {
    position: relative;
    overflow: hidden;
    background: rgba(13, 17, 34, 0.4);
    border: 2px dashed rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    padding: 3.5rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.drop-zone:hover {
    border-color: var(--indigo-glow);
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.25), inset 0 0 15px rgba(99, 102, 241, 0.1);
    background: rgba(13, 17, 34, 0.55);
}

/* Session Lock Overlay */
.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 10, 24, 0.92);
    backdrop-filter: blur(18px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
}

.lock-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.lock-overlay-content {
    max-width: 420px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
}

.lock-overlay-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lock-overlay-content p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.lock-icon {
    font-size: 3.5rem;
    animation: pulse-glow 2.5s ease-in-out infinite;
    color: var(--amber-glow);
}

@keyframes pulse-glow {
    0%, 100% {
        transform: scale(1);
        text-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
    }
    50% {
        transform: scale(1.08);
        text-shadow: 0 0 25px rgba(245, 158, 11, 0.6);
    }
}

.drop-zone.dragover {
    border-color: var(--teal-glow);
    background: rgba(16, 185, 129, 0.08);
    box-shadow: 0 0 35px rgba(16, 185, 129, 0.3), inset 0 0 20px rgba(16, 185, 129, 0.15);
    transform: scale(1.015);
}

.drop-zone-icon {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
}

.drop-zone h3 {
    font-size: 1.35rem;
    font-weight: 600;
}

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

/* --- STEP 2: Live Progressive Loader State --- */
.processing-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    padding: 3rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.loader-spinner {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-spinner::before,
.loader-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
}

/* Outer ring rotating clockwise */
.loader-spinner::before {
    width: 100%;
    height: 100%;
    border-top-color: var(--indigo-glow);
    border-bottom-color: var(--indigo-glow);
    animation: spinClockwise 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

/* Inner ring rotating counter-clockwise */
.loader-spinner::after {
    width: 70%;
    height: 70%;
    border-left-color: var(--teal-glow);
    border-right-color: var(--teal-glow);
    animation: spinCounterClockwise 1.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.3));
}

.loader-spinner-sm {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.loader-spinner-sm::before,
.loader-spinner-sm::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid transparent;
}

.loader-spinner-sm::before {
    width: 100%;
    height: 100%;
    border-top-color: var(--indigo-glow);
    border-bottom-color: var(--indigo-glow);
    animation: spinClockwise 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

.loader-spinner-sm::after {
    width: 65%;
    height: 65%;
    border-left-color: var(--teal-glow);
    border-right-color: var(--teal-glow);
    animation: spinCounterClockwise 1.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

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

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

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--indigo-glow), var(--teal-glow));
    border-radius: 50px;
    transition: width 0.4s ease;
}

.step-indicators {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 450px;
    margin-top: 0.5rem;
}

.step-dot {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    position: relative;
    padding-bottom: 0.5rem;
}

.step-dot.active {
    color: var(--teal-glow);
}

/* --- STEP 3: Dependency Resolution Block Panel --- */
.dependency-warning-card {
    border: 1px solid rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.05);
    box-shadow: 0 8px 32px 0 rgba(245, 158, 11, 0.1);
}

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

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

.warning-header h3 {
    color: var(--amber-warning);
    font-weight: 700;
}

.warning-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.dependency-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.dependency-item {
    background-color: rgba(255, 255, 255, 0.03);
    border-left: 3px solid var(--amber-warning);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.dependency-item > span:first-child {
    word-break: break-word;
    min-width: 0;
}

.dependency-badge {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--amber-warning);
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.dependency-badge.warning {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--red-alert);
}

.dependency-badge.success {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--teal-glow);
}

/* Custom Checkbox Design */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 2rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 1.2rem;
    width: 1.2rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: rgba(255, 255, 255, 0.1);
}

/* The input is 0px wide, so its own focus ring never shows: draw it on the box (review of e3269cb). */
.checkbox-container input:focus-visible ~ .checkmark {
    outline: 2px solid var(--accent-color, #60a5fa);
    outline-offset: 2px;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--amber-warning);
    border-color: var(--amber-warning);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 3px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* --- Tabular Report Tables --- */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 1rem;
    gap: 1.5rem;
}

.report-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    word-break: break-word;
    min-width: 0;
}

/* --- Complexity Badge Tooltip --- */
.report-badge-container {
    position: relative;
    display: inline-block;
}

.report-badge {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--indigo-glow);
    padding: 0.35rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: help;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

/* Tone follows the verdict in workbookRiskBadge: records lost, something broken, or clean. */
.report-badge.tone-warn {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--amber-warning);
}

.report-badge.tone-warn:hover {
    background-color: rgba(245, 158, 11, 0.25);
}

.report-badge.tone-alert {
    background-color: rgba(244, 63, 94, 0.15);
    color: var(--red-alert);
}

.report-badge.tone-alert:hover {
    background-color: rgba(244, 63, 94, 0.25);
}

.report-badge:hover {
    background-color: rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
}

.report-badge-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: rgba(13, 17, 34, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(99, 102, 241, 0.15);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme overrides */
html[data-theme="light"] .report-badge-tooltip {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 0 15px rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.2);
}

.report-badge-container:hover .report-badge-tooltip {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.report-badge-tooltip h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.report-badge-tooltip p {
    margin: 0 0 0.8rem 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.complexity-guide-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
    line-height: 1.3;
    color: var(--text-secondary);
    text-align: left;
}

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

.complexity-guide-row strong {
    color: var(--text-primary);
}

.complexity-guide-bullet {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 0.3rem;
    flex-shrink: 0;
}

.complexity-guide-bullet.simple {
    background-color: #10b981; /* Emerald/Green */
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.complexity-guide-bullet.low {
    background-color: #3b82f6; /* Blue */
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

.complexity-guide-bullet.medium {
    background-color: #f59e0b; /* Amber */
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

.complexity-guide-bullet.high {
    background-color: #ef4444; /* Red */
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

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

/* --- Report Split Screen / Sidebar Layout --- */
#reportDetailsContainer {
    width: 100%;
    min-width: 0; /* Prevents flex-child blowout on medium/small viewports */
    overflow-x: auto;
    padding-bottom: 1rem;
}

@media (max-width: 1250px) {
    #reportDetailsContainer {
        padding-right: 5vw; /* Matches the left-side margin (5vw) to provide symmetric breathing room when overflowing/scrolling */
    }
}

#reportDetailsContainer::-webkit-scrollbar {
    height: 8px;
}
#reportDetailsContainer::-webkit-scrollbar-track {
    background: transparent;
}
#reportDetailsContainer::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
#reportDetailsContainer::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

html[data-theme="light"] #reportDetailsContainer::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}
html[data-theme="light"] #reportDetailsContainer::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

.report-dashboard-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
    width: 100%;
}

.report-nav-sidebar {
    position: sticky;
    top: 5.5rem;
    max-height: calc(100vh - 16rem);
    overflow-y: auto;
}

/* Custom scrollbar for sidebar */
.report-nav-sidebar::-webkit-scrollbar {
    width: 6px;
}
.report-nav-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.report-nav-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.report-nav-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

html[data-theme="light"] .report-nav-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}
html[data-theme="light"] .report-nav-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.report-nav-sticky {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 0.75rem;
}

.report-nav-title {
    font-family: var(--font-sans);
    font-size: 0.725rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    margin-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-glass);
    opacity: 0.85;
}

html[data-theme="light"] .report-nav-title {
    color: var(--text-muted);
}

.report-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.report-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.report-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background-color: var(--indigo-glow);
    border-radius: 0 4px 4px 0;
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.report-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.report-nav-item.active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--text-primary);
    box-shadow: inset 0 0 10px rgba(99, 102, 241, 0.05);
}

.report-nav-item.active::before {
    transform: scaleY(1);
}

html[data-theme="light"] .report-nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .report-nav-item.active {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

.nav-item-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
}

.nav-item-text {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: auto;
    position: relative;
    transition: all 0.3s ease;
}

.nav-item-status-dot.green {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.nav-item-status-dot.alert {
    background: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
    animation: nav-dot-pulse-amber 1.8s infinite;
}

.nav-item-status-dot.grey {
    background: #6b7280;
    box-shadow: none;
}

@keyframes nav-dot-pulse-amber {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

.report-content-workspace {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-height: calc(100vh - 16rem);
    overflow-y: auto;
    padding-right: 0.75rem; /* Prevent scrollbar overlapping card glow */
}

/* Custom scrollbar for right column */
.report-content-workspace::-webkit-scrollbar {
    width: 8px;
}
.report-content-workspace::-webkit-scrollbar-track {
    background: transparent;
}
.report-content-workspace::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}
.report-content-workspace::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

html[data-theme="light"] .report-content-workspace::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}
html[data-theme="light"] .report-content-workspace::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.22);
}

.report-content-workspace .report-card-section {
    scroll-margin-top: 1rem; /* Much cleaner when scrolling inside the workspace container directly */
}

/* §19.3: the blueprint is its own view. Hidden from the report; the report hidden while it shows. */
.report-content-workspace:not(.blueprint-view) #section-blueprint,
.report-content-workspace.blueprint-view > :not(#section-blueprint) {
    display: none !important;
}

.report-nav-optional {
    margin-top: 0.75rem;
    border-top: 1px solid var(--border-glass);
    padding-top: 0.75rem;
}

/* The only way to the blueprint view: let its label wrap rather than cut 'optional' off. */
.report-nav-optional .nav-item-text {
    white-space: normal;
}

.report-nav-optional:focus-visible {
    outline: 2px solid var(--accent-color, #60a5fa);
    outline-offset: 2px;
}

.nav-item-optional {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.report-card-section {
    margin-bottom: 2rem;
    scroll-margin-top: 6.5rem; /* Ensures scrolling aligns perfectly under sticky headers */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.report-card-section.active-focus {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.08);
}

.summary-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.conversion-gate-feedback {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    transition: all 0.3s ease;
}

.conversion-gate-feedback.success-ready {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.formula-override-card {
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
.formula-override-card.reviewed {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.02);
}

@media (max-width: 950px) {
    .report-dashboard-layout {
        grid-template-columns: 1fr;
    }
    .report-nav-sidebar {
        position: static;
        max-height: none;
        overflow-y: visible;
        margin-bottom: 1.5rem;
    }
    .report-content-workspace {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }
}

.table-container {
    overflow-x: auto;
    margin-top: 1rem;
    contain: content;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-glass);
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.badge-risk {
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-low { background-color: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-medium { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-high { background-color: rgba(239, 68, 68, 0.15); color: #f87171; }

/* --- Security Grid --- */
.security-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.security-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.security-severity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 0.4rem;
    flex-shrink: 0;
}

.security-severity-dot.HIGH { background-color: var(--red-alert); box-shadow: 0 0 8px var(--red-alert); }
.security-severity-dot.MEDIUM { background-color: var(--amber-warning); box-shadow: 0 0 8px var(--amber-warning); }
.security-severity-dot.LOW { background-color: var(--teal-glow); }

.security-details h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.security-details h4 span {
    font-family: var(--font-mono);
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.security-details p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- Conversion Action Bar --- */
.conversion-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(13, 17, 34, 0.8);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 1.25rem 1.75rem;
}

.action-info p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* --- STEP 4: Success Result screen --- */
.success-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    padding: 3.5rem 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.success-icon-badge {
    width: 70px;
    height: 70px;
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--emerald-success);
    font-size: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--emerald-success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    animation: pulse 2s infinite;
}

.result-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    width: 100%;
    margin-top: 1rem;
}

.result-card-link {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    text-decoration: none;
    text-align: left;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.result-card-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--indigo-glow);
    transform: translateY(-2px);
}

.link-icon {
    font-size: 2rem;
}

.link-details h4 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.link-details p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* --- Fidelity Audit Card Styling --- */
.fidelity-audit-card {
    width: 100%;
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    text-align: left;
    backdrop-filter: blur(16px);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.fidelity-audit-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.fidelity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.fidelity-badge {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
}

.fidelity-badge.badge-clean {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.fidelity-badge.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.fidelity-badge.badge-failed {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.fidelity-state-container {
    animation: fadeIn 0.4s ease-out;
}

.fidelity-alert {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    align-items: flex-start;
}

.fidelity-alert .alert-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.fidelity-alert p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.clean-alert {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.clean-alert p {
    color: #a7f3d0;
}

.warning-alert {
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.15);
}

.warning-alert p {
    color: #fde68a;
}

.failed-alert {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.failed-alert p {
    color: #fca5a5;
}

/* Custom Table overrides inside audit card */
.fidelity-audit-card .data-table th, 
.fidelity-audit-card .data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.fidelity-audit-card .data-table tbody tr:last-child td {
    border-bottom: none;
}

.fidelity-audit-card .data-table tbody tr {
    transition: background-color 0.2s ease;
}

.fidelity-audit-card .data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

/* --- Footer --- */
.footer {
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--border-glass);
    font-size: 0.8rem;
    color: var(--text-secondary);
    background-color: rgba(7, 9, 19, 0.5);
}

/* --- Keyframe Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* --- User Profile Badge in Navbar --- */
.user-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    padding: 0.25rem 0.5rem 0.25rem 0.35rem;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.user-avatar-img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 0.25rem;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .grid-two-cols, .result-links {
        grid-template-columns: 1fr;
    }
    .hero-title {
        font-size: 2.25rem;
    }
    .conversion-action-bar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* --- Step Navigation Bar Styles --- */
.step-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--card-glass);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin-bottom: 0.5rem;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: not-allowed;
    user-select: none;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.step-nav-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-nav-label {
    transition: color 0.3s ease;
}

/* Step State: Available (unlocked, can click to visit) */
.step-nav-item.available {
    cursor: pointer;
    color: var(--text-primary);
}

.step-nav-item.available:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.step-nav-item.available .step-nav-num {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--indigo-glow);
}

/* Step State: Active (currently selected view) */
.step-nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
    transform: scale(1.02);
}

.step-nav-item.active .step-nav-num {
    background: var(--indigo-glow);
    border-color: var(--indigo-glow);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.6);
}

/* Step Connector Lines */
.step-nav-connector {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0 1rem;
    transition: background 0.5s ease;
}

.step-nav-connector.active {
    background: linear-gradient(90deg, var(--indigo-glow) 0%, rgba(16, 185, 129, 0.5) 100%);
}

/* Responsive navigation tweaks */
@media (max-width: 950px) {
    .step-nav-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1rem;
    }
    .step-nav-connector {
        display: none;
    }
    .step-nav-item {
        justify-content: flex-start;
        padding: 0.5rem 1rem;
    }
}

/* --- Workspace History Dashboard Styles --- */
.workspace-history-header {
    display: flex;
    align-items: center;
    padding: 1.2rem 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-glass);
    background: var(--table-header-bg);
}

/* --- Theme-Aware User Badges in Workspace --- */
/* --- Workspace Teammate Roster Toggle --- */
.teammate-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.6rem;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.teammate-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.teammate-toggle:focus-visible {
    outline: 2px solid var(--indigo-glow);
    outline-offset: 2px;
}

.teammate-toggle[disabled] {
    opacity: 0.6;
    cursor: progress;
}

.teammate-toggle-caret {
    font-size: 0.6rem;
    line-height: 1;
    transition: transform 0.18s ease;
}

.teammate-toggle[aria-expanded="true"] .teammate-toggle-caret {
    transform: rotate(180deg);
}

html[data-theme="light"] .teammate-toggle {
    background: rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .teammate-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.18);
}

@media (prefers-reduced-motion: reduce) {
    .teammate-toggle,
    .teammate-toggle-caret {
        transition: none;
    }
}

.user-submitter-badge {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    background: hsla(var(--badge-hue), 70%, 50%, 0.08);
    border: 1px solid hsla(var(--badge-hue), 70%, 50%, 0.25);
    color: hsla(var(--badge-hue), 70%, 85%, 1);
}

html[data-theme="light"] .user-submitter-badge {
    background: hsla(var(--badge-hue), 65%, 40%, 0.08);
    border: 1px solid hsla(var(--badge-hue), 65%, 40%, 0.22);
    color: hsla(var(--badge-hue), 70%, 32%, 1);
}


.workspace-jobs-list {
    display: flex;
    flex-direction: column;
    background: transparent;
}

.job-folder-card {
    border-bottom: 1px solid var(--border-glass);
    transition: background-color 0.3s ease;
}

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

.job-folder-card.stalled-card {
    background: rgba(245, 158, 11, 0.02) !important;
    border-left: 3px solid var(--amber-warning);
    transition: background-color 0.3s ease, border-left-color 0.3s ease;
}

.job-folder-card.stalled-card:hover {
    background: rgba(245, 158, 11, 0.04) !important;
}

html[data-theme="light"] .job-folder-card.stalled-card {
    background: rgba(245, 158, 11, 0.035) !important;
}

html[data-theme="light"] .job-folder-card.stalled-card:hover {
    background: rgba(245, 158, 11, 0.06) !important;
}


.job-folder-header {
    display: flex;
    align-items: center;
    padding: 1.1rem 1.5rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.25s ease;
}

.job-folder-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

html[data-theme="light"] .job-folder-header:hover {
    background: rgba(99, 102, 241, 0.03);
}

/* Expansion transition */
.job-folder-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.02);
}

html[data-theme="light"] .job-folder-content {
    background: rgba(99, 102, 241, 0.015);
}

.job-folder-card.expanded .job-folder-content {
    max-height: 500px; /* arbitrary large value that covers any files list size */
}

/* Rotate Chevron */
.job-folder-header .chevron {
    display: inline-block;
    font-size: 0.75rem;
    margin-right: 0.6rem;
    color: var(--text-muted);
    transition: transform 0.25s ease, color 0.25s ease;
}

.job-folder-card.expanded .job-folder-header .chevron {
    transform: rotate(90deg);
    color: var(--text-primary);
}

/* Folder icon animation/glow */
.job-folder-header .folder-icon {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    transition: transform 0.3s ease;
}

.job-folder-header:hover .folder-icon {
    transform: scale(1.1) rotate(-5deg);
}

/* Tree Structure lines for nested files */
.nested-files-list {
    position: relative;
    padding: 0.75rem 1.5rem 0.75rem 3.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Vertical dotted connector line */
.nested-files-list::before {
    content: '';
    position: absolute;
    left: 2.25rem;
    top: 0;
    bottom: 0;
    width: 1px;
    border-left: 1px dashed var(--border-glass);
}

.nested-file-row {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.88rem;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.nested-file-row:hover {
    transform: translateX(3px);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

/* Horizontal elbow connector line for each row */
.nested-file-row::before {
    content: '';
    position: absolute;
    left: -1.25rem;
    top: 50%;
    width: 1.25rem;
    height: 1px;
    border-top: 1px dashed var(--border-glass);
}

.nested-file-row .file-icon {
    font-size: 1.05rem;
    margin-right: 0.6rem;
}

.nested-file-row .file-name {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 1rem;
    flex: 1;
}

.nested-file-row .file-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.nested-file-row .file-size {
    font-family: var(--font-mono);
}

.file-ext-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.file-ext-xlsm {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.file-ext-xlsx {
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.file-ext-xlsb {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.file-ext-xls {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.file-ext-csv {
    background: rgba(20, 184, 166, 0.1);
    color: #2dd4bf;
    border: 1px solid rgba(20, 184, 166, 0.2);
}

.file-ext-docx {
    background: rgba(14, 165, 233, 0.1);
    color: #38bdf8;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.stat-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px var(--stat-card-hover-shadow);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}

.status-badge.pending, .status-badge.analyzing {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.status-badge.analyzed {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.status-badge.size_warning {
    background: rgba(245, 108, 11, 0.12);
    color: #f97316;
    border-color: rgba(245, 108, 11, 0.4);
    box-shadow: 0 0 10px rgba(245, 108, 11, 0.25);
    font-weight: 700;
}


.status-badge.translating, .status-badge.converting {
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.status-badge.completed {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.status-badge.failed {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.status-badge.draft {
    background: rgba(156, 163, 175, 0.12);
    color: #9ca3af;
    border-color: rgba(156, 163, 175, 0.3);
    box-shadow: 0 0 10px rgba(156, 163, 175, 0.1);
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    animation: floatAnimation 3s infinite ease-in-out;
}

@keyframes floatAnimation {
    0% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0); }
}

/* --- Security Modal Overlay & Content --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 18, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

.modal-content {
    background: var(--modal-content-bg) !important;
    border: 1px solid var(--border-glass) !important;
    box-shadow: 0 20px 50px var(--shadow-color) !important;
    animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalScaleUp {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.security-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.security-tag .remove-tag {
    cursor: pointer;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.15s;
}

.security-tag .remove-tag:hover {
    color: #f87171;
}

.modal-close-btn:hover {
    color: #ffffff !important;
}

/* --- Login Screen & Tab Navigation Additions --- */
.login-screen-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2rem;
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.login-card {
    width: 100%;
    max-width: 480px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.15) !important;
    animation: modalScaleUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.nav-tabs {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-tab {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 0.25rem;
    transition: color 0.3s ease, border-color 0.3s ease, text-shadow 0.3s ease;
    border-bottom: 2px solid transparent;
    position: relative;
    user-select: none;
}

.nav-tab:hover {
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.nav-tab.active {
    color: var(--text-primary);
    border-bottom: 2px solid var(--indigo-glow);
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.tags-wrapper {
    min-height: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-content: flex-start;
    flex-grow: 1;
}

/* Tabular numbers for premium aligned formatting */
.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* Seamless Page Initialization: Hides login card & exhibits global load state instantly for pre-authenticated clients */
.has-cached-session #loginSection {
    display: none !important;
}

.has-cached-session #globalLoadingOverlay.hidden {
    display: flex !important;
}

/* Premium micro-animations for interactive loading triggers */
.spin-animation {
    display: inline-block;
    animation: spin 1s linear infinite;
}

.btn:disabled, .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- Premium Theme Toggle Buttons --- */
.theme-toggle-btn {
    background: var(--input-bg);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.3s ease, 
                background-color 0.4s ease, 
                border-color 0.4s ease, 
                color 0.4s ease;
    user-select: none;
    outline: none;
}

.theme-toggle-btn:hover {
    transform: scale(1.08) rotate(15deg);
    box-shadow: 0 6px 16px var(--shadow-color);
    border-color: var(--indigo-glow);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

.login-theme-toggle {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
}

/* Navbar Actions Wrapper */
.navbar-right-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Tag input container CSS class */
.tag-input-container {
    padding: 1.15rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--border-glass);
    background: var(--tag-input-bg);
    min-height: 150px;
    height: auto;
    box-sizing: border-box;
}

/* --- Text & Email Inputs --- */
.text-input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.5rem;
    background: var(--input-bg);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--input-color);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    box-shadow: inset 0 2px 4px var(--shadow-color);
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

.text-input:focus {
    border-color: var(--indigo-glow);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2), inset 0 2px 4px var(--shadow-color);
}

.text-input-small {
    flex: 1;
    min-width: 0;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    background: var(--input-bg);
    color: var(--input-color);
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

.text-input-small:focus {
    border-color: var(--indigo-glow);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

/* Tag input row flex layout */
.tag-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.tag-input-row .btn {
    flex-shrink: 0;
}

.login-card h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--indigo-glow) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-or-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.login-or-divider::before,
.login-or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-glass);
}

.login-footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-glass);
    padding-top: 1.25rem;
}

.workspace-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    border-radius: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.4s ease, border-color 0.4s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px var(--stat-card-hover-shadow);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.centered-loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 4rem 2rem;
    border-radius: 16px;
}

.centered-loading-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* --- Blueprint & Refinement Console Styles --- */
.report-right-panel .summary-sidebar-card {
    max-height: none;
}

.custom-instruction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background-color 0.3s ease;
}

html[data-theme="light"] .custom-instruction-item {
    background: rgba(0, 0, 0, 0.02);
}

.custom-instruction-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

html[data-theme="light"] .custom-instruction-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.custom-instruction-item span {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 0.5rem;
}

.blueprint-scroll-box {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    max-height: 450px; /* Increased from 250px to 450px for better vertical space and diagram visibility */
    overflow-y: auto;
    padding-right: 0.5rem;
}

.blueprint-scroll-box::-webkit-scrollbar,
.custom-instructions-list::-webkit-scrollbar {
    width: 6px;
}
.blueprint-scroll-box::-webkit-scrollbar-track,
.custom-instructions-list::-webkit-scrollbar-track {
    background: transparent;
}
.blueprint-scroll-box::-webkit-scrollbar-thumb,
.custom-instructions-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
html[data-theme="light"] .blueprint-scroll-box::-webkit-scrollbar-thumb,
html[data-theme="light"] .custom-instructions-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

/* --- Admin Trend Graph Styles --- */
.admin-graph-banner {
    background: linear-gradient(135deg, rgba(20, 20, 35, 0.45) 0%, rgba(10, 10, 20, 0.55) 100%);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.admin-graph-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
    border-color: rgba(99, 102, 241, 0.25);
}

html[data-theme="light"] .admin-graph-banner {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0%, rgba(243, 244, 246, 0.8) 100%);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

html[data-theme="light"] .admin-graph-banner:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.08);
    border-color: rgba(99, 102, 241, 0.4);
}

/* SVG Chart Typography & Paths */
.chart-axis-text {
    font-size: 0.75rem;
    font-family: var(--font-sans);
    fill: rgba(255, 255, 255, 0.4);
    font-weight: 500;
}

html[data-theme="light"] .chart-axis-text {
    fill: rgba(0, 0, 0, 0.5);
}

.chart-grid-line {
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 1;
}

html[data-theme="light"] .chart-grid-line {
    stroke: rgba(0, 0, 0, 0.05);
}

.chart-trend-line {
    stroke: url(#indigoGradient);
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0px 4px 12px rgba(99, 102, 241, 0.4));
}

html[data-theme="light"] .chart-trend-line {
    filter: drop-shadow(0px 4px 10px rgba(99, 102, 241, 0.25));
}

.chart-area-fill {
    fill: url(#areaGradient);
    pointer-events: none;
}

/* Hover tracker and points */
.chart-tracker-line {
    stroke: rgba(99, 102, 241, 0.25);
    stroke-width: 1.5;
    stroke-dasharray: 4 4;
}

html[data-theme="light"] .chart-tracker-line {
    stroke: rgba(99, 102, 241, 0.4);
}

.chart-data-point {
    fill: #ffffff;
    stroke: #6366f1;
    stroke-width: 3;
    cursor: pointer;
    filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.8));
    transition: r 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), stroke-width 0.2s ease;
}

html[data-theme="light"] .chart-data-point {
    fill: #ffffff;
    stroke: #4f46e5;
    filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.5));
}

/* Floating Tooltip */
.chart-tooltip {
    background: rgba(15, 15, 27, 0.8);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(99, 102, 241, 0.15);
    color: #ffffff;
    font-family: var(--font-sans);
    transform: translate(-50%, -100%) scale(0.95);
    opacity: 0;
    transition: opacity 0.15s cubic-bezier(0.16, 1, 0.3, 1), transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), left 0.1s ease, top 0.1s ease;
}

.chart-tooltip.visible {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
}

html[data-theme="light"] .chart-tooltip {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 10px 25px -5px rgba(31, 38, 135, 0.1), 0 0 10px rgba(99, 102, 241, 0.08);
    color: #1f2937;
}

.chart-tooltip .tooltip-date {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

html[data-theme="light"] .chart-tooltip .tooltip-date {
    color: #6b7280;
}

.chart-tooltip .tooltip-value-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-tooltip .tooltip-value {
    font-size: 1rem;
    font-weight: 800;
    color: #ffffff;
}

html[data-theme="light"] .chart-tooltip .tooltip-value {
    color: #111827;
}

.chart-tooltip .tooltip-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Admin Sub-Tabs Navigation Styles */
.admin-tabs {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 2rem;
    padding-bottom: 0.25rem;
    margin-top: 1rem;
}

.admin-tab {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 0.25rem;
    transition: color 0.3s ease, border-color 0.3s ease, text-shadow 0.3s ease;
    border-bottom: 2px solid transparent;
    position: relative;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.admin-tab:hover {
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.admin-tab.active {
    color: var(--text-primary);
    border-bottom: 2px solid var(--indigo-glow);
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Expand cards on large screens to fill the remaining horizontal blank space (Request 8 Fix) */
@media (min-width: 1100px) {
    .admin-grid {
        display: grid;
        grid-template-columns: 1.2fr 1.8fr !important; /* Eliminates the gap, expands metrics (right) and usage (left) */
        gap: 2rem;
        width: 100%;
    }
    
    #adminCardMetrics {
        grid-column: auto !important; /* Reset columns, handled perfectly by explicit template */
    }
    
    #adminCardUserUsage {
        grid-column: auto !important;
    }
}


/* --- Premium ASCII Blueprint Card & Code Block Styles --- */
.blueprint-card {
    background: rgba(13, 17, 34, 0.75);
    border: 1px dashed rgba(99, 102, 241, 0.4);
    border-radius: 12px;
    margin: 1.5rem 0;
    overflow: hidden;
    box-shadow: 0 8px 32px var(--shadow-color), inset 0 0 20px rgba(99, 102, 241, 0.05);
    transition: all 0.3s ease;
}

html[data-theme="light"] .blueprint-card {
    background: rgba(241, 245, 249, 0.9);
    border: 1px dashed rgba(99, 102, 241, 0.3);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.05);
}

.blueprint-card:hover {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.15), inset 0 0 30px rgba(99, 102, 241, 0.08);
}

.blueprint-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    background: rgba(99, 102, 241, 0.12);
    border-bottom: 1px solid var(--border-glass);
}

html[data-theme="light"] .blueprint-header {
    background: rgba(99, 102, 241, 0.06);
}

.blueprint-icon {
    font-size: 1rem;
}

.blueprint-title {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-grow: 1;
}

.blueprint-badge {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--indigo-glow);
    background: rgba(99, 102, 241, 0.15);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

html[data-theme="light"] .blueprint-badge {
    background: rgba(99, 102, 241, 0.08);
}

.blueprint-body {
    padding: 1.25rem;
    overflow-x: auto;
}

.ascii-diagram {
    margin: 0;
    padding: 0;
    font-family: 'Fira Code', 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #a5f3fc; /* Cyan-200 for a beautiful blueprint glow on dark */
    white-space: pre;
    overflow-x: auto;
}

html[data-theme="light"] .ascii-diagram {
    color: #0f172a; /* Slate-900 for high-contrast on light background */
}

/* --- CAD Plotter Blueprint Millimeter Grid --- */
.blueprint-card, .ascii-diagram, #formulaMappingGrid {
    background-color: var(--code-bg) !important;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px),
        linear-gradient(rgba(99, 102, 241, 0.01) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.01) 1px, transparent 1px) !important;
    background-size: 20px 20px, 20px 20px, 4px 4px, 4px 4px !important;
    border: 1px dashed rgba(99, 102, 241, 0.35) !important;
}

/* Normal Code Block Styles */
.code-block-card {
    background: rgba(7, 9, 19, 0.55);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    margin: 1.25rem 0;
    overflow: hidden;
    box-shadow: 0 4px 20px var(--shadow-color);
}

html[data-theme="light"] .code-block-card {
    background: rgba(248, 250, 252, 0.95);
}

.code-block-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-glass);
}

html[data-theme="light"] .code-block-header {
    background: rgba(0, 0, 0, 0.02);
}

.code-block-icon {
    font-size: 0.9rem;
}

.code-block-lang {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.code-block-body {
    padding: 1rem;
    overflow-x: auto;
}

.code-pre {
    margin: 0;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    color: #e2e8f0;
    white-space: pre;
}

html[data-theme="light"] .code-pre {
    color: #1e293b;
}

/* Inline Code Tag Styling */
.inline-code {
    background: rgba(99, 102, 241, 0.1);
    color: #fecaca;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

html[data-theme="light"] .inline-code {
    background: rgba(99, 102, 241, 0.05);
    color: #b91c1c;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

/* Ensure Admin Console Metrics List Rows Stretch Perfectly */
#jobsStatusList {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
}

#jobsStatusList > .jobs-status-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* --- Step 2 Interactive Formula Mapping & Refinement Styling --- */
.formula-mapping-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.formula-override-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.formula-override-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(99, 102, 241, 0.25);
    transform: translateY(-2px);
}

html[data-theme="light"] .formula-override-card {
    background: rgba(15, 23, 42, 0.02);
}

html[data-theme="light"] .formula-override-card:hover {
    background: rgba(99, 102, 241, 0.03);
    border-color: rgba(99, 102, 241, 0.2);
}

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

.override-cell-key {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--indigo-glow);
    background: rgba(99, 102, 241, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.override-formula-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    word-break: break-all;
}

.override-formula-info strong {
    color: var(--text-primary);
}

.override-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

/* Glassmorphic Select Dropdown */
.override-select-dropdown {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    background: var(--input-bg);
    color: var(--input-color);
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 0.9rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.override-select-dropdown:focus {
    border-color: var(--indigo-glow);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.15);
}

html[data-theme="light"] .override-select-dropdown {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

/* Ensure dropdown options are readable on all OS platforms (including non-macOS dark mode) */
.override-select-dropdown option {
    background-color: #121526; /* Premium solid dark color to avoid native OS overrides */
    color: #ffffff;
}

html[data-theme="light"] .override-select-dropdown option {
    background-color: #ffffff;
    color: #0f172a; /* Slate 900 primary text */
}

.override-value-input {
    flex: 1;
    min-width: 140px;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    background: var(--input-bg);
    color: var(--input-color);
    font-size: 0.85rem;
    outline: none;
    font-family: var(--font-mono);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.override-value-input:focus {
    border-color: var(--indigo-glow);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.15);
}

/* Badge extensions for Refinement States */
.badge-configured {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.badge-active-override {
    background-color: rgba(99, 102, 241, 0.15) !important;
    color: #a5b4fc !important;
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
}

.badge-ai-proposed {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.override-badges {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.fallback-accordion-btn {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    transition: all 0.2s ease;
}

.fallback-accordion-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.fallback-code-drawer {
    background: rgba(13, 17, 34, 0.8);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    overflow-x: auto;
    max-height: 250px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
    animation: slideDown 0.25s ease-out;
}

.fallback-code-drawer pre {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.45;
    color: #cbd5e1;
}

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


/* --- AI Translation Engine Segmented Controls --- */
.model-segmented-control {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    gap: 0.25rem;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

html[data-theme="light"] .model-segmented-control {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.1);
    box-shadow: inset 0 2px 6px rgba(99, 102, 241, 0.04);
}

.model-control-btn {
    flex: 1;
    padding: 0.55rem;
    border-radius: 6px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    color: var(--text-muted);
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.model-control-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

html[data-theme="light"] .model-control-btn:hover {
    background: rgba(99, 102, 241, 0.03);
}

.model-control-btn.active {
    background: linear-gradient(135deg, var(--indigo-glow) 0%, #4f46e5 100%);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

html[data-theme="light"] .model-control-btn.active {
    background: linear-gradient(135deg, var(--indigo-glow) 0%, #4338ca 100%);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}


/* --- Desktop Viewport Height Locking & Independent Dual Column Scrolling ---
 *
 * The condition names BOTH the visible section and the container inside it, and it has to.
 * Keying only on #reportDetailsContainer made the whole page's scrollability depend on one inner
 * flag that three separate code paths toggle for their own reasons -- and one of them leaves it
 * set. renderJobStatusUpdate un-hides it on COMPLETED (ui.js), while the only thing that puts it
 * back is navigateToStep(4), which runs solely `if (isNewState)`. So the poll that crosses into
 * COMPLETED tidied up, and every later poll -- and any reload of an already-finished job -- left
 * `height: 100vh; overflow: hidden` clamped on a Conversion Complete screen taller than the
 * viewport, with no way to scroll to the buttons underneath.
 *
 * #reportDetailsContainer is a child of #reportSection, so requiring the section to be visible
 * makes the lock follow the screen the user is actually on. A stale inner flag is then harmless,
 * which is the point: page-level scrolling should not be something three call sites have to
 * remember to clean up after.
 */
@media (min-width: 951px) {
    body:has(#reportSection:not(.hidden) #reportDetailsContainer:not(.hidden)) {
        height: 100vh;
        overflow: hidden;
    }

    body:has(#reportSection:not(.hidden) #reportDetailsContainer:not(.hidden)) .container {
        flex: 1;
        min-height: 0;
        margin: 1.5rem auto 1rem auto;
        overflow: hidden;
        gap: 1.25rem; /* Reduced gap to maximize vertical workspace */
    }

    body:has(#reportSection:not(.hidden) #reportDetailsContainer:not(.hidden)) #reportSection {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        gap: 1rem;
    }

    body:has(#reportSection:not(.hidden) #reportDetailsContainer:not(.hidden)) #reportDetailsContainer {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding-bottom: 0;
    }

    body:has(#reportSection:not(.hidden) #reportDetailsContainer:not(.hidden)) .report-dashboard-layout {
        flex: 1;
        min-height: 0;
        display: grid;
        grid-template-columns: 280px 1fr;
        gap: 2rem;
        height: 100%;
        overflow: hidden;
        align-items: stretch;
    }

    body:has(#reportSection:not(.hidden) #reportDetailsContainer:not(.hidden)) .report-nav-sidebar {
        position: static; /* Let parent grid flex/grid bounds handle the positioning */
        max-height: 100% !important;
        height: 100%;
        overflow-y: auto;
    }

    body:has(#reportSection:not(.hidden) #reportDetailsContainer:not(.hidden)) .report-content-workspace {
        max-height: 100% !important;
        height: 100%;
        overflow-y: auto;
    }
}

/* --- Granular Progress Checkpoints & Loading Lists --- */
.progress-details-container {
    width: 100%;
    max-width: 600px;
    margin: 1.5rem auto 0 auto;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-align: left;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05), 0 4px 20px rgba(0,0,0,0.2);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

html[data-theme="light"] .progress-details-container {
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.02), 0 4px 20px rgba(0,0,0,0.05);
}

.progress-details-title {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: var(--text-primary);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    opacity: 0.85;
}

.progress-details-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 0.35rem;
}

/* Custom Scrollbar for progress details list */
.progress-details-list::-webkit-scrollbar {
    width: 4px;
}
.progress-details-list::-webkit-scrollbar-track {
    background: transparent;
}
.progress-details-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.progress-details-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

html[data-theme="light"] .progress-details-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

.progress-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.progress-detail-item .item-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    min-width: 0;
}

.progress-detail-item .item-left span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-detail-item .item-icon {
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    flex-shrink: 0;
}

.progress-detail-item .item-meta {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    opacity: 0.65;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

/* Item States */
.progress-detail-item.state-complete {
    background: rgba(16, 185, 129, 0.04);
    border-color: rgba(16, 185, 129, 0.1);
    color: var(--teal-glow);
}

html[data-theme="light"] .progress-detail-item.state-complete {
    background: rgba(16, 185, 129, 0.05);
}

.progress-detail-item.state-complete .item-icon {
    color: #10b981;
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.progress-detail-item.state-active {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
    animation: pulse-border 2s infinite ease-in-out;
}

html[data-theme="light"] .progress-detail-item.state-active {
    background: rgba(99, 102, 241, 0.04);
}

.progress-detail-item.state-active .item-icon {
    animation: spin 1.2s linear infinite;
    color: var(--indigo-glow);
}

.progress-detail-item.state-pending {
    color: var(--text-secondary);
    opacity: 0.5;
}

.progress-detail-item.state-failed {
    background: rgba(239, 68, 68, 0.04);
    border-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

html[data-theme="light"] .progress-detail-item.state-failed {
    background: rgba(239, 68, 68, 0.05);
}

.progress-detail-item.state-failed .item-icon {
    color: #ef4444;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

@keyframes pulse-border {
    0%, 100% {
        border-color: rgba(99, 102, 241, 0.15);
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.05);
    }
    50% {
        border-color: rgba(99, 102, 241, 0.45);
        box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
    }
}


/* ==========================================================================
   Spreadsheet & UI Graph Support - Worksheet Topology Styles
   ========================================================================== */

/* Theme Variables Safeguards */
:root {
    --card-bg: rgba(13, 17, 34, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="light"] {
    --card-bg: rgba(255, 255, 255, 0.65);
    --border-color: rgba(99, 102, 241, 0.12);
}

/* Header Flex Styling */
.topology-header-flex {
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.75rem;
}

/* Tab buttons and control wrapper */
.topology-tabs {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 0.25rem;
    display: flex;
    gap: 0.35rem;
    border: 1px solid var(--border-glass);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .topology-tabs {
    background: rgba(0, 0, 0, 0.02);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.tab-btn {
    border: none !important;
    padding: 0.55rem 1.1rem !important;
    border-radius: 8px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    font-family: var(--font-sans) !important;
    cursor: pointer !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
}

.tab-btn:hover:not(.active) {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

html[data-theme="light"] .tab-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.03) !important;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--indigo-glow) 0%, #4f46e5 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25) !important;
}

html[data-theme="light"] .tab-btn.active {
    background: linear-gradient(135deg, var(--indigo-glow) 0%, #4338ca 100%) !important;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2) !important;
}

/* Topology view container and view toggling */
.topology-container-view {
    transition: opacity 0.3s ease, transform 0.3s ease;
    contain: content;
}

.topology-container-view.hidden {
    display: none !important;
}

#topologyMapContainer {
    position: relative;
    width: calc(100% - 80px);
    max-width: 1100px;
    margin: 0 auto 0.5rem auto;
    height: 500px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

@media (max-width: 768px) {
    #topologyMapContainer {
        width: calc(100% - 40px); /* 20px gutter on each side for mobile touch scrolling */
        height: 450px;
    }
}

@media (max-width: 480px) {
    #topologyMapContainer {
        width: calc(100% - 30px); /* 15px gutter on each side for compact screens */
        height: 400px;
    }
}

/* Dynamic Tooltip inside Canvas Container */
.topology-tooltip {
    position: absolute;
    pointer-events: none;
    z-index: 120;
    background: rgba(13, 17, 34, 0.85) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px;
    padding: 0.85rem 1.1rem;
    font-size: 0.825rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1) !important;
    color: #f3f4f6;
    max-width: 300px;
    line-height: 1.5;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

html[data-theme="light"] .topology-tooltip {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(99, 102, 241, 0.15) !important;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.08), 0 0 1px rgba(99, 102, 241, 0.1) !important;
    color: #0f172a;
}

.topology-tooltip h4 {
    margin: 0 0 0.4rem 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

html[data-theme="light"] .topology-tooltip h4 {
    color: #0f172a;
}

.topology-tooltip p {
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.775rem;
}

.topology-tooltip .tooltip-meta {
    font-family: var(--font-mono);
    font-size: 0.725rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    display: inline-block;
    color: #e2e8f0;
}

html[data-theme="light"] .topology-tooltip .tooltip-meta {
    background: rgba(0, 0, 0, 0.04);
    color: #334155;
}

/* Toolbar Control System */
.topology-toolbar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 110;
}

.topology-toolbar button {
    width: 38px;
    height: 38px;
    border-radius: 50% !important; /* Premium circular design */
    border: 1px solid var(--border-glass) !important;
    background: rgba(13, 17, 34, 0.6) !important;
    color: var(--text-primary) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25), 0 0 1px rgba(255, 255, 255, 0.1);
    outline: none;
}

html[data-theme="light"] .topology-toolbar button {
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid rgba(99, 102, 241, 0.15) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08), 0 0 1px rgba(99, 102, 241, 0.1);
}

.topology-toolbar button:hover {
    transform: scale(1.1);
    background: var(--indigo-glow) !important;
    border-color: var(--indigo-glow) !important;
    color: white !important;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.topology-toolbar button:active {
    transform: scale(0.95);
}

/* Color Legend */
.topology-legend {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(13, 17, 34, 0.65) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass) !important;
    border-radius: 12px !important;
    padding: 0.85rem !important;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    z-index: 110;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.1);
    pointer-events: none;
    font-size: 0.75rem;
    min-width: 160px;
}

html[data-theme="light"] .topology-legend {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(99, 102, 241, 0.15) !important;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.05), 0 0 1px rgba(99, 102, 241, 0.1);
}

.topology-legend-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.25rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.7rem;
    opacity: 0.85;
}

/* Custom styles inside Canvas view Section to blend it nicely */
#section-topology {
    border-color: var(--border-glass);
    transition: all 0.3s ease;
}

#section-topology.active-focus {
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.15), 0 0 1px rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Hover and Focus animations for cards */
.report-card-section {
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.report-card-section.active-focus {
    transform: scale(1.002);
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 0 15px rgba(99, 102, 241, 0.08);
}

html[data-theme="light"] .report-card-section.active-focus {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.06), 0 0 15px rgba(99, 102, 241, 0.03);
}

/* --- BUTTON MICRO-INTERACTIONS --- */
.btn {
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease !important;
}

.btn:active {
    transform: scale(0.97) !important;
}

/* --- GLASS CARD INTERACTIVE HOVER LIFTS --- */
.glass-card-interactive {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease !important;
    cursor: pointer;
}

.glass-card-interactive:hover {
    transform: translateY(-5px) translateZ(0) !important;
    border-color: rgba(99, 102, 241, 0.35) !important;
    box-shadow: 0 8px 18px 0 rgba(0, 0, 0, 0.12), 
                0 28px 56px 0 rgba(0, 0, 0, 0.4), 
                0 0 25px rgba(99, 102, 241, 0.08) !important;
}

html[data-theme="light"] .glass-card-interactive:hover {
    transform: translateY(-5px) translateZ(0) !important;
    border-color: rgba(99, 102, 241, 0.45) !important;
    box-shadow: 0 8px 18px 0 rgba(99, 102, 241, 0.03), 
                0 28px 56px 0 rgba(99, 102, 241, 0.08), 
                0 0 25px rgba(99, 102, 241, 0.05) !important;
}

/* --- TOAST NOTIFICATION SYSTEM --- */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 10001; /* Must sit above global overlays */
    max-width: 420px;
    width: calc(100% - 3rem);
    pointer-events: none;
}

.toast-notification {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.1rem 1.25rem 1.25rem 1.25rem;
    background: rgba(13, 17, 34, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.toast-notification::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

/* Success Toast */
.toast-success::before {
    background: var(--emerald-success, #10b981);
}
.toast-success {
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), inset 0 0 10px rgba(16, 185, 129, 0.05);
}
.toast-success .toast-icon {
    color: var(--emerald-success, #10b981);
    filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.4));
}

/* Error Toast */
.toast-error::before {
    background: var(--red-alert, #ef4444);
}
.toast-error {
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), inset 0 0 10px rgba(239, 68, 68, 0.05);
}
.toast-error .toast-icon {
    color: var(--red-alert, #ef4444);
    filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.4));
}

/* Warning Toast */
.toast-warning::before {
    background: var(--amber-warning, #f59e0b);
}
.toast-warning {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), inset 0 0 10px rgba(245, 158, 11, 0.05);
}
.toast-warning .toast-icon {
    color: var(--amber-warning, #f59e0b);
    filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.4));
}

/* Info Toast */
.toast-info::before {
    background: var(--indigo-glow, #6366f1);
}
.toast-info {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), inset 0 0 10px rgba(99, 102, 241, 0.05);
}
.toast-info .toast-icon {
    color: var(--indigo-glow, #6366f1);
    filter: drop-shadow(0 0 5px rgba(99, 102, 241, 0.4));
}

/* Light Theme overrides for Toasts */
html[data-theme="light"] .toast-notification {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.06);
    color: #1f2937;
}

html[data-theme="light"] .toast-message {
    color: #1f2937;
}

html[data-theme="light"] .toast-close-btn {
    color: #4b5563;
}

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

.toast-message {
    font-size: 0.9rem;
    line-height: 1.45;
    font-weight: 500;
    padding-right: 1.5rem;
    color: var(--text-primary);
}

.toast-close-btn {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.toast-close-btn:hover {
    opacity: 1;
    color: var(--text-primary);
}

.toast-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    animation: toastProgress linear forwards;
}

.toast-success .toast-progress-bar {
    background: var(--emerald-success, #10b981);
}

.toast-error .toast-progress-bar {
    background: var(--red-alert, #ef4444);
}

.toast-warning .toast-progress-bar {
    background: var(--amber-warning, #f59e0b);
}

.toast-info .toast-progress-bar {
    background: var(--indigo-glow, #6366f1);
}

.toast-dismiss {
    animation: toastSlideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(50px) scale(0.95);
    }
}

@keyframes toastProgress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Custom Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    transition: .3s ease;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s ease;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background-color: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
}

.switch input:checked + .slider:before {
    transform: translateX(22px);
    background-color: var(--indigo-glow);
}

.row-disabled {
    background-color: rgba(0, 0, 0, 0.15) !important;
}

/* ==========================================================================
   PREMIUM FRONTEND UX FEATURE SUITE STYLES (PLAYGROUND, HEATMAP & TOUR)
   ========================================================================== */

/* --- Component 2: Live Translation Playground --- */
.playground-modal {
    max-width: 1200px !important;
    width: 95% !important;
    padding: 2rem !important;
    border-radius: 24px !important;
    position: relative;
    margin: 1.5vh auto !important;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-glass);
    background: rgba(10, 12, 24, 0.92) !important;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: 94vh;
    box-sizing: border-box;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.playground-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}
.playground-close:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    transform: rotate(90deg);
}

.playground-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 1.25rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.playground-title-block h2 {
    font-size: 1.35rem;
    color: var(--text-primary);
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #a5b4fc 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.playground-title-block p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0.25rem 0 0 0;
    font-family: var(--font-mono);
    opacity: 0.8;
}

.playground-toggles-grid {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border-glass);
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    gap: 0.5rem;
    user-select: none;
}
.toggle-switch input {
    display: none;
}
.toggle-slider {
    width: 36px;
    height: 18px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    position: relative;
    transition: all 0.3s;
    border: 1px solid var(--border-glass);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #cbd5e1;
    top: 2px;
    left: 2px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border-color: #818cf8;
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: #ffffff;
}
.toggle-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.playground-split-panes {
    display: flex;
    gap: 1.25rem;
    flex-grow: 1;
    overflow: hidden;
    min-height: 0;
}

@media (max-width: 992px) {
    .playground-split-panes {
        flex-direction: column;
    }
    .playground-modal {
        height: auto;
        max-height: 98vh;
        overflow-y: auto;
    }
    .playground-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.code-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    overflow: hidden;
    min-height: 0;
}

.pane-title {
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-block-scroll {
    margin: 0;
    padding: 1rem;
    flex-grow: 1;
    overflow: auto;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    color: #e2e8f0;
    text-align: left;
    background: transparent;
}

.playground-footer {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    border-top: 1px solid var(--border-glass);
    padding-top: 1rem;
}

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

/* Optimized highlighting highlights inside translation preview */
.gas-comment-opt {
    color: #34d399 !important;
    font-style: italic;
    background: rgba(16, 185, 129, 0.08);
    border-left: 2px solid #10b981;
    display: block;
    padding: 0.15rem 0.5rem;
    margin: 0.25rem 0;
    border-radius: 0 4px 4px 0;
}

/* --- Component 3: Macro Complexity & Risk Heatmap --- */
.heatmap-section-wrapper {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1.25rem;
}

.heatmap-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.heatmap-cell {
    aspect-ratio: 1.4;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.03);
    user-select: none;
}
.heatmap-cell span {
    font-size: 0.65rem;
    font-weight: 600;
    opacity: 0.75;
    margin-top: 0.2rem;
}

.heatmap-cell:hover {
    transform: translateY(-4px) scale(1.05);
    z-index: 10;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.heatmap-cell.low {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}
.heatmap-cell.low:hover {
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.3);
}

.heatmap-cell.medium {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.2);
}
.heatmap-cell.medium:hover {
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.heatmap-cell.high {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}
.heatmap-cell.high:hover {
    box-shadow: 0 0 15px rgba(248, 113, 113, 0.3);
}

.heatmap-cell.critical {
    background: rgba(168, 85, 247, 0.16);
    color: #c084fc;
    border-color: rgba(168, 85, 247, 0.3);
    animation: heatmap-critical-pulse 2s infinite alternate;
}
.heatmap-cell.critical:hover {
    box-shadow: 0 0 20px rgba(192, 132, 252, 0.5);
}

@keyframes heatmap-critical-pulse {
    0% {
        box-shadow: 0 0 5px rgba(168, 85, 247, 0.1);
        border-color: rgba(168, 85, 247, 0.25);
    }
    100% {
        box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
        border-color: rgba(168, 85, 247, 0.55);
    }
}

/* Floating heatmap tooltip styling */
.heatmap-tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-glass);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    padding: 1rem;
    font-size: 0.75rem;
    z-index: 9999;
    pointer-events: none;
    max-width: 320px;
    color: #cbd5e1;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: opacity 0.15s ease-out;
}
.heatmap-tooltip-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.25rem;
}
.heatmap-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
}
.heatmap-tooltip-row span:last-child {
    font-weight: 600;
    color: #f1f5f9;
}
.heatmap-tooltip-preview {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.4rem;
    border-radius: 6px;
    margin-top: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #a5b4fc;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 80px;
    overflow-y: auto;
}

/* --- Component 4: Non-Intrusive Guided Onboarding Tour --- */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 10, 24, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9990;
    pointer-events: none; /* Allows pointer events through if needed, except we explicitly block or handle */
}

.tour-pulse-overlay {
    position: absolute;
    border-radius: 8px;
    border: 2px solid #818cf8;
    box-shadow: 0 0 0 9999px rgba(8, 10, 24, 0.6);
    pointer-events: none;
    z-index: 9991;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    animation: tour-pulse-anim 1.5s infinite;
}

@keyframes tour-pulse-anim {
    0% { outline: 0px solid rgba(129, 140, 248, 0.8); outline-offset: 0px; }
    50% { outline: 4px solid rgba(129, 140, 248, 0.4); outline-offset: 4px; }
    100% { outline: 8px solid rgba(129, 140, 248, 0); outline-offset: 8px; }
}

.tour-popover {
    position: fixed;
    width: 320px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border-glass);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    border-radius: 16px;
    padding: 1.25rem;
    z-index: 9995;
    color: #cbd5e1;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    font-size: 0.8rem;
    line-height: 1.4;
}

.tour-popover h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tour-popover-text {
    color: #94a3b8;
}

.tour-popover-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
}

.tour-step-indicator {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.tour-buttons {
    display: flex;
    gap: 0.5rem;
}

.tour-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    border: 1px solid transparent;
}

.tour-btn-skip {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.tour-btn-skip:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.tour-btn-next {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}
.tour-btn-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.5);
}

/* Pulsing help tour badge on header bar */
.help-tour-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    padding: 0.4rem 0.9rem;
    border-radius: 50px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
    user-select: none;
}
.help-tour-badge:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #818cf8;
    color: var(--indigo-glow);
    transform: translateY(-1px);
}
.help-tour-badge i {
    animation: tour-icon-pulse 1.5s infinite;
}

@keyframes tour-icon-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- Bulk Selection and Actions Styles --- */
.bulk-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    accent-color: #6366f1; /* Deep Indigo color */
    vertical-align: middle;
}

html[data-theme="light"] .bulk-checkbox {
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.03);
}

.bulk-checkbox:hover {
    border-color: rgba(99, 102, 241, 0.8);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.bulk-checkbox:checked {
    border-color: #6366f1;
    background: #6366f1;
}

/* Sliding Floating Bulk Actions Bar at the bottom center of viewport */
.bulk-actions-bar {
    position: fixed;
    bottom: -100px; /* Start hidden below screen */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: rgba(15, 15, 25, 0.7);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.bulk-actions-bar.active {
    bottom: 24px;
    opacity: 1;
    pointer-events: auto;
}

html[data-theme="light"] .bulk-actions-bar {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 20px rgba(99, 102, 241, 0.05);
}

.bulk-actions-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

.bulk-actions-count {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.bulk-actions-btns {
    display: flex;
    gap: 0.75rem;
}


/* --- Light Mode Visibility Overrides --- */
html[data-theme="light"] .nav-tab {
    color: #475569 !important; /* Premium dark slate */
}

html[data-theme="light"] .nav-tab:hover,
html[data-theme="light"] .nav-tab.active {
    color: #0f172a !important; /* Premium deep navy */
    text-shadow: none !important;
}

html[data-theme="light"] .nav-tab.active {
    border-bottom-color: var(--indigo-glow) !important;
}

html[data-theme="light"] .admin-tab {
    color: #475569 !important; /* Premium dark slate */
}

html[data-theme="light"] .admin-tab:hover,
html[data-theme="light"] .admin-tab.active {
    color: #0f172a !important; /* Premium deep navy */
    text-shadow: none !important;
}

html[data-theme="light"] .admin-tab.active {
    border-bottom-color: var(--indigo-glow) !important;
}

html[data-theme="light"] .glass-card {
    box-shadow: 0 4px 12px 0 rgba(99, 102, 241, 0.03), 0 16px 40px 0 rgba(99, 102, 241, 0.06) !important;
}

html[data-theme="light"] .data-table th,
html[data-theme="light"] .data-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

html[data-theme="light"] .data-table tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.03) !important;
}

/* --- User Profile Dropdown & Preferences Pane --- */
.user-badge-container {
    position: relative;
    display: inline-block;
}

.user-badge {
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.user-badge-container:hover .user-badge {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-badge-container .dropdown-arrow {
    font-size: 0.6rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    margin-left: 0.15rem;
    margin-right: 0.3rem;
}

.user-badge-container:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.user-preferences-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 290px;
    background: var(--modal-content-bg) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    box-shadow: 0 10px 30px var(--shadow-color);
    padding: 1.15rem;
    display: flex;
    visibility: hidden;
    pointer-events: none;
    flex-direction: column;
    gap: 0.85rem;
    z-index: 1000;
    transform: translateY(8px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    text-align: left;
}

.user-preferences-dropdown.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.user-badge-container.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-header {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.dropdown-header h4 {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dropdown-header .user-email {
    font-size: 0.74rem;
    color: var(--text-secondary);
    word-break: break-all;
}

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

.preference-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.preference-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.preference-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.preference-desc {
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.25;
}

.dropdown-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.3rem;
}

/* Custom switch / toggle slider */
.preference-item .switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    flex-shrink: 0;
}

.preference-item .switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.preference-item .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.08);
    transition: .25s;
    border: 1px solid var(--border-glass);
}

.preference-item .slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: #ffffff;
    transition: .25s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.preference-item input:checked + .slider {
    background-color: var(--indigo-glow, #6366f1);
}

.preference-item input:checked + .slider:before {
    transform: translateX(16px);
}

.preference-item .slider.round {
    border-radius: 18px;
}

.preference-item .slider.round:before {
    border-radius: 50%;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
}

html[data-theme="light"] .preference-item .slider:before {
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.preference-item select.pref-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.2rem 1.4rem 0.2rem 0.4rem;
    font-size: 0.72rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 4px center;
    background-size: 16px;
}

html[data-theme="light"] .preference-item select.pref-select {
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
    background-image: url("data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
}

.preference-item select.pref-select:focus {
    border-color: var(--indigo-glow, #6366f1);
}

/* ==========================================================================
   MULTI-TENANT SAAS WORKSPACE SWITCHER & APPROVAL STYLES
   ========================================================================== */

/* Workspace Switcher Navigation Container */
.workspace-switcher-container {
    position: relative;
    margin-left: 0.75rem;
    display: inline-block;
}

/* Switcher Interactive Badge */
.workspace-switcher-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-primary);
    user-select: none;
}

.workspace-switcher-badge:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.workspace-switcher-badge:active {
    transform: translateY(0);
}

.workspace-switcher-badge .workspace-icon {
    font-size: 0.95rem;
    opacity: 0.85;
}

.workspace-switcher-badge .workspace-name-display {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-switcher-badge .dropdown-arrow {
    font-size: 0.65rem;
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.workspace-switcher-container:hover .dropdown-arrow {
    opacity: 0.9;
}

/* Glassmorphic Dropdown Container */
.workspace-dropdown {
    position: absolute;
    top: 130%;
    left: 0;
    min-width: 280px;
    z-index: 1000;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: dropdownSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top left;
    background: var(--modal-content-bg) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    box-shadow: 0 10px 30px var(--shadow-color) !important;
}

/* Light theme overrides for switcher dropdown */
html[data-theme="light"] .workspace-switcher-badge {
    background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .workspace-switcher-badge:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}

/* Dropdown Sub-components */
.workspace-dropdown .dropdown-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.workspace-dropdown .dropdown-header h4 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.workspace-dropdown .dropdown-header .workspace-sub {
    font-size: 0.725rem;
    color: var(--text-secondary);
}

.workspace-dropdown .dropdown-header .workspace-sub strong {
    color: var(--indigo-glow, #6366f1);
    font-weight: 500;
}

.workspace-dropdown .dropdown-divider {
    height: 1px;
    background: var(--border-glass);
    margin: 4px 0;
}

.workspace-dropdown .workspace-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Workspace List Items */
.workspace-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.workspace-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.04);
}

.workspace-item.active {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

html[data-theme="light"] .workspace-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

html[data-theme="light"] .workspace-item.active {
    background: rgba(79, 70, 229, 0.05);
    border: 1px solid rgba(79, 70, 229, 0.12);
}

.workspace-item .ws-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.workspace-item .ws-details {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-grow: 1;
    min-width: 0;
}

.workspace-item .ws-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-item.active .ws-name {
    color: var(--indigo-glow, #6366f1);
    font-weight: 600;
}

.workspace-item .ws-org {
    font-size: 0.68rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-item .ws-check {
    font-size: 0.75rem;
    color: var(--indigo-glow, #6366f1);
    font-weight: bold;
    flex-shrink: 0;
}

.workspace-item.no-workspaces {
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 16px;
    cursor: default;
}

.workspace-item.no-workspaces:hover {
    background: transparent;
    border-color: transparent;
}

/* Animations */
@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Awaiting Approval Hourglass Animation */
.awaiting-approval-hourglass {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    display: inline-block;
    animation: hourglassFlip 3s cubic-bezier(0.77, 0, 0.175, 1) infinite;
    transform-origin: center;
}

@keyframes hourglassFlip {
    0% {
        transform: rotate(0deg) scale(1);
    }
    45% {
        transform: rotate(0deg) scale(1.1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    55% {
        transform: rotate(180deg) scale(1);
    }
    95% {
        transform: rotate(180deg) scale(1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* --- Tenant RBAC Access Control & Admin Confirmation Styles --- */

.rbac-tab {
    position: relative;
}

.rbac-tab::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 1.25rem;
    right: 1.25rem;
    height: 3px;
    background-color: var(--indigo-glow);
    border-radius: 4px;
    opacity: 0;
    transform: scaleX(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.rbac-tab.active {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

.rbac-tab.active::after {
    opacity: 1;
    transform: scaleX(1);
}

.rbac-tab:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.02) !important;
}

.rbac-pane.hidden {
    display: none !important;
}

/* Premium iOS Switch styling */
.premium-switch input:checked + .premium-slider {
    background-color: var(--teal-glow) !important;
    border-color: var(--teal-glow) !important;
}

.premium-switch input:checked + .premium-slider::before {
    transform: translateX(20px);
}

.premium-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Styled Select pickers for Roles in tables */
.rbac-role-select {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

.rbac-role-select:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.rbac-role-select:focus {
    border-color: var(--indigo-glow);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

html[data-theme="light"] .rbac-role-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

html[data-theme="light"] .rbac-role-select:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

/* Styled option selectors for rbac-role-select to ensure complete cross-OS readability and glassmorphism aesthetic */
.rbac-role-select option {
    background-color: #121526; /* Premium solid dark background matching card-glass to avoid native browser styles */
    color: #ffffff;
    font-family: var(--font-sans);
    padding: 0.5rem;
}

html[data-theme="light"] .rbac-role-select option {
    background-color: #ffffff;
    color: #0f172a;
}

/* Confirmation modal styles */
#adminConfirmModal .modal-content {
    background: var(--modal-content-bg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-glass);
}

/* --- Admin Left Navigation & Bento Layout --- */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
    align-items: start;
    width: 100%;
}

.admin-nav-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-sans);
    padding: 0.85rem 1.25rem;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

.admin-nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.admin-nav-item.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
    border-left-color: var(--indigo-glow);
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
    box-shadow: inset 0 0 10px rgba(99, 102, 241, 0.05);
}

html[data-theme="light"] .admin-nav-item.active {
    background: rgba(99, 102, 241, 0.06);
    border-left-color: rgba(99, 102, 241, 0.8);
    text-shadow: none;
    box-shadow: inset 0 0 10px rgba(99, 102, 241, 0.03);
}

/* KPI Bento Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-tile-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease, box-shadow 0.3s ease !important;
}

.kpi-tile-card:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.1) !important;
}

html[data-theme="light"] .kpi-tile-card:hover {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.08) !important;
}

.kpi-badge-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    opacity: 0.8;
    transition: opacity 0.3s ease, height 0.3s ease;
}

.kpi-tile-card:hover .kpi-badge-glow {
    opacity: 1;
    height: 6px;
}

/* Responsive adjustment */
@media (max-width: 950px) {
    .admin-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* --- LIGHT THEME COLOR & ACCESSIBILITY ENHANCEMENTS --- */
html[data-theme="light"] .btn-secondary {
    background-color: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.2);
    color: #4f46e5;
}

html[data-theme="light"] .btn-secondary:hover {
    background-color: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.45);
    color: #4338ca;
}

html[data-theme="light"] .btn-danger {
    background-color: #f43f5e;
    color: #ffffff;
    border-color: #e11d48;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.25);
}

html[data-theme="light"] .btn-danger:hover {
    background-color: #e11d48;
    color: #ffffff;
    border-color: #be123c;
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.4);
}

html[data-theme="light"] .btn-table-remove {
    background-color: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #e11d48;
}

html[data-theme="light"] .btn-table-remove:hover {
    background-color: #f43f5e;
    color: #ffffff;
    border-color: #e11d48;
}

/* Light Theme Tooltip Fixes to prevent white-on-white text */
html[data-theme="light"] .heatmap-tooltip {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.08);
    color: #334155;
}

html[data-theme="light"] .heatmap-tooltip-title {
    color: #0f172a;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

html[data-theme="light"] .heatmap-tooltip-row span:last-child {
    color: #0f172a;
}

html[data-theme="light"] .heatmap-tooltip-preview {
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}

/* Light Theme Onboarding Tour Popover */
html[data-theme="light"] .tour-popover {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.12);
    color: #475569;
}

html[data-theme="light"] .tour-popover h3 {
    color: #0f172a;
}

html[data-theme="light"] .tour-popover-text {
    color: #334155;
}

html[data-theme="light"] .tour-btn-skip {
    color: #64748b;
}

html[data-theme="light"] .tour-btn-skip:hover {
    color: #0f172a;
    background: rgba(99, 102, 241, 0.05);
}

/* --- Row Action Buttons & Open Sheet Alignment/Centering Overrides --- */
.btn-row-action {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 32px !important;
    padding: 0 1.1rem !important; /* Fixed padding, height-based vertical centering */
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    border-radius: 50px !important;
    line-height: 1 !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
}

/* --- Light Theme Overrides for Status Badges (ensure high contrast and no white text) --- */
html[data-theme="light"] .status-badge.pending,
html[data-theme="light"] .status-badge.analyzing {
    background: rgba(37, 99, 235, 0.12) !important;
    color: #1d4ed8 !important; /* Dark blue */
    border-color: rgba(37, 99, 235, 0.35) !important;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.05) !important;
}

html[data-theme="light"] .status-badge.analyzed {
    background: rgba(217, 119, 6, 0.12) !important;
    color: #b45309 !important; /* Dark amber/orange */
    border-color: rgba(217, 119, 6, 0.35) !important;
    box-shadow: 0 0 10px rgba(217, 119, 6, 0.05) !important;
}

html[data-theme="light"] .status-badge.size_warning {
    background: rgba(234, 88, 12, 0.12) !important;
    color: #c2410c !important; /* Dark orange */
    border-color: rgba(234, 88, 12, 0.4) !important;
    box-shadow: 0 0 10px rgba(234, 88, 12, 0.05) !important;
}

html[data-theme="light"] .status-badge.translating,
html[data-theme="light"] .status-badge.converting {
    background: rgba(79, 70, 229, 0.12) !important;
    color: #4338ca !important; /* Dark indigo */
    border-color: rgba(79, 70, 229, 0.35) !important;
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.05) !important;
}

html[data-theme="light"] .status-badge.completed {
    background: rgba(5, 150, 105, 0.12) !important;
    color: #047857 !important; /* Dark green */
    border-color: rgba(5, 150, 105, 0.35) !important;
    box-shadow: 0 0 10px rgba(5, 150, 105, 0.05) !important;
}

html[data-theme="light"] .status-badge.failed {
    background: rgba(220, 38, 38, 0.12) !important;
    color: #b91c1c !important; /* Dark red */
    border-color: rgba(220, 38, 38, 0.35) !important;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.05) !important;
}

html[data-theme="light"] .status-badge.draft {
    background: rgba(75, 85, 99, 0.12) !important;
    color: #374151 !important; /* Dark grey */
    border-color: rgba(75, 85, 99, 0.35) !important;
    box-shadow: 0 0 10px rgba(75, 85, 99, 0.05) !important;
}

/* --- Light Theme Overrides for File Extension Badges (prevent white text / low contrast) --- */
html[data-theme="light"] .file-ext-xlsm {
    background: rgba(5, 150, 105, 0.1) !important;
    color: #047857 !important;
    border: 1px solid rgba(5, 150, 105, 0.25) !important;
}

html[data-theme="light"] .file-ext-xlsx {
    background: rgba(79, 70, 229, 0.1) !important;
    color: #4338ca !important;
    border: 1px solid rgba(79, 70, 229, 0.25) !important;
}

html[data-theme="light"] .file-ext-xlsb {
    background: rgba(217, 119, 6, 0.1) !important;
    color: #b45309 !important;
    border: 1px solid rgba(217, 119, 6, 0.25) !important;
}

html[data-theme="light"] .file-ext-xls {
    background: rgba(220, 38, 38, 0.1) !important;
    color: #b91c1c !important;
    border: 1px solid rgba(220, 38, 38, 0.25) !important;
}

html[data-theme="light"] .file-ext-docx {
    background: rgba(3, 105, 161, 0.1) !important;
    color: #0369a1 !important;
    border: 1px solid rgba(3, 105, 161, 0.25) !important;
}

html[data-theme="light"] .file-ext-badge {
    background: rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: var(--text-secondary) !important;
}

/* Report warning tabs (§18): .tab-btn removes the outline, so keyboard focus needs its own ring. */
.warning-tab-btn:focus-visible {
    outline: 2px solid var(--accent-color, #60a5fa) !important;
    outline-offset: 2px;
}

/* Google Drive picker (20.35). Google draws the files inside its own frame, but the box around that
   frame is added to this page, with Google's class picker-dialog (checked in Chrome 2026-10-15). The
   class is not documented: if Google renames it, the corners only stay square. */
.picker.picker-dialog {
    border-radius: 16px;
    overflow: hidden;
}
