/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --app-header-h: 48px;     /* global app header height (I2/I3/I4) */
    --bg-primary: #0F1419;
    --bg-secondary: #161B22;
    --bg-tertiary: #1C2128;
    --border: #30363D;
    --text-primary: #E6EDF3;
    --text-secondary: #8B949E;
    --text-muted: #484F58;
    --accent: #2B7CE9;
    --accent-hover: #62A0EA;
    --accent-rgb: 43, 124, 233;
    --success: #2DA44E;
    --warning: #D29922;
    --error: #CF222E;
    --header-height: 52px;
    --radius: 6px;
    --transition: 150ms ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== ACCESS GATE ===== */
.access-gate {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.access-gate-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 40px 36px 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 400px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.access-gate-logo {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.5);
    margin: -40px 0 -28px;
}

/* Gate logo internals — scoped here so landing-page redesigns can't break
   the gate (the old shared .logo-dock styles were removed with the hero). */
.access-gate-logo .logo-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1.5px solid transparent;
    border-top-color: rgba(43, 124, 233, 0.6);
    border-right-color: rgba(46, 204, 113, 0.3);
    animation: gate-logo-spin 8s linear infinite;
}

.access-gate-logo .logo-ring-2 {
    inset: -18px;
    border-top-color: rgba(46, 204, 113, 0.4);
    border-right-color: rgba(43, 124, 233, 0.15);
    border-left-color: rgba(43, 124, 233, 0.1);
    animation: gate-logo-spin-reverse 12s linear infinite;
}

@keyframes gate-logo-spin {
    to { transform: rotate(360deg); }
}

@keyframes gate-logo-spin-reverse {
    to { transform: rotate(-360deg); }
}

.access-gate-logo .logo-frame {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(43, 124, 233, 0.08) 0%, rgba(15, 20, 25, 0.9) 50%, rgba(46, 204, 113, 0.06) 100%);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(43, 124, 233, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow:
        0 0 20px rgba(43, 124, 233, 0.1),
        inset 0 0 30px rgba(43, 124, 233, 0.03);
}

.access-gate-logo .logo-corner {
    position: absolute;
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.access-gate-logo .logo-corner::before,
.access-gate-logo .logo-corner::after {
    content: '';
    position: absolute;
    background: linear-gradient(90deg, #2B7CE9, #2ecc71);
    border-radius: 1px;
}

.access-gate-logo .logo-corner-tl { top: 8px; left: 8px; }
.access-gate-logo .logo-corner-tl::before { width: 18px; height: 1.5px; top: 0; left: 0; }
.access-gate-logo .logo-corner-tl::after  { width: 1.5px; height: 18px; top: 0; left: 0; }

.access-gate-logo .logo-corner-tr { top: 8px; right: 8px; }
.access-gate-logo .logo-corner-tr::before { width: 18px; height: 1.5px; top: 0; right: 0; }
.access-gate-logo .logo-corner-tr::after  { width: 1.5px; height: 18px; top: 0; right: 0; }

.access-gate-logo .logo-corner-bl { bottom: 8px; left: 8px; }
.access-gate-logo .logo-corner-bl::before { width: 18px; height: 1.5px; bottom: 0; left: 0; }
.access-gate-logo .logo-corner-bl::after  { width: 1.5px; height: 18px; bottom: 0; left: 0; }

.access-gate-logo .logo-corner-br { bottom: 8px; right: 8px; }
.access-gate-logo .logo-corner-br::before { width: 18px; height: 1.5px; bottom: 0; right: 0; }
.access-gate-logo .logo-corner-br::after  { width: 1.5px; height: 18px; bottom: 0; right: 0; }

.access-gate-logo .logo-img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(43, 124, 233, 0.3));
    position: relative;
    z-index: 2;
}

.access-gate-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

.access-gate-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 2px 0 12px;
    text-align: center;
    line-height: 1.4;
}

.access-gate-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.access-gate-input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition);
    text-align: left;
    letter-spacing: normal;
    box-sizing: border-box;
}

/* OTP input — centered, spaced digits */
.access-gate-input[inputmode="numeric"] {
    text-align: center;
    letter-spacing: 6px;
    font-size: 1.35rem;
    font-weight: 600;
    padding: 12px 14px;
}

.access-gate-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.access-gate-input::placeholder {
    color: var(--text-muted);
    letter-spacing: normal;
    font-weight: 400;
    font-size: 0.95rem;
}

.access-gate-error {
    color: var(--error);
    font-size: 0.8rem;
    text-align: center;
    min-height: 0;
}
.access-gate-error:empty {
    display: none;
}

.access-gate-submit {
    width: 100%;
    padding: 11px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
    margin-top: 2px;
}

.access-gate-submit:hover {
    background: var(--accent-hover);
}

.access-gate-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.access-gate-back {
    margin-top: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
    width: 100%;
    text-align: center;
    padding: 4px;
    font-family: inherit;
}
.access-gate-back:hover {
    color: var(--text-primary);
}

/* ===== HOME VIEW ===== */
#home-view {
    height: 100vh;
    overflow-y: auto;
    scroll-behavior: smooth;
    position: relative;
}

/* ===== HERO GIZMO (rotating tech rings BEHIND the hero text) ===== */
/* The old top-left logo dock is gone (it duplicated the header logo-home);
   its signature rotating-ring animation became the hero's backdrop. Subtle by
   design: the text must stay perfectly readable (WCAG) over it. */
.hero-gizmo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 440px;
    height: 440px;
    transform: translate(-50%, -54%);
    pointer-events: none;
    z-index: 0;
}

.hg-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid transparent;
    border-top-color: rgba(43, 124, 233, 0.45);
    border-right-color: rgba(46, 204, 113, 0.22);
    animation: logo-spin 14s linear infinite;
}

.hg-ring-2 {
    inset: 38px;
    border-top-color: rgba(46, 204, 113, 0.30);
    border-right-color: rgba(43, 124, 233, 0.14);
    border-left-color: rgba(43, 124, 233, 0.08);
    animation: logo-spin-reverse 20s linear infinite;
}

.hg-ring-3 {
    inset: 82px;
    border-top-color: rgba(155, 107, 232, 0.22);
    border-bottom-color: rgba(43, 124, 233, 0.10);
    animation: logo-spin 26s linear infinite;
}

/* orbiting node on the outer ring */
.hg-ring::after {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #62A0EA;
    box-shadow: 0 0 10px rgba(98, 160, 234, 0.9);
}

@keyframes logo-spin {
    to { transform: rotate(360deg); }
}

@keyframes logo-spin-reverse {
    to { transform: rotate(-360deg); }
}

.hg-glow {
    position: absolute;
    inset: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(43, 124, 233, 0.12) 0%, rgba(46, 204, 113, 0.04) 45%, transparent 70%);
    animation: logo-pulse 4s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50%      { opacity: 1;    transform: scale(1.12); }
}

/* ===== HERO MODULE CARDS (the primary entry point of the interface) ===== */
/* The 6 modules as designed cards — same entries as the header nav, but with
   landing-grade presence: glass tiles, gradient icon chip, lift + glow. */
.hero-modules {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-top: 34px;
}

.hero-mod-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 10px 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(28, 33, 40, 0.85), rgba(15, 20, 25, 0.9));
    border: 1px solid rgba(48, 54, 61, 0.9);
    cursor: pointer;
    font-family: var(--font-family, 'Inter', sans-serif);
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease, background .22s ease;
    overflow: hidden;
}

/* animated gradient hairline that sweeps in on hover */
.hero-mod-card::before {
    content: '';
    position: absolute;
    top: 0; left: 14px; right: 14px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--accent, #2B7CE9), #2ecc71, transparent);
    opacity: 0;
    transform: scaleX(.4);
    transition: opacity .25s ease, transform .25s ease;
}

.hero-mod-card:hover {
    transform: translateY(-4px);
    border-color: rgba(43, 124, 233, 0.55);
    background: linear-gradient(180deg, rgba(33, 40, 50, 0.95), rgba(17, 23, 30, 0.95));
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), 0 0 24px rgba(43, 124, 233, 0.18);
}

.hero-mod-card:hover::before { opacity: 1; transform: scaleX(1); }
.hero-mod-card:active { transform: translateY(-1px) scale(.985); }
.hero-mod-card:focus-visible { outline: 2px solid var(--accent, #2B7CE9); outline-offset: 2px; }

/* Locked module (outside the user's plan) — same card for every user, just
   dimmed with a padlock badge; clicking explains instead of navigating. */
.hero-mod-card.hero-mod-locked {
    opacity: 0.55;
    filter: saturate(0.35);
    cursor: pointer; /* still clickable: opens the "Module locked" explainer */
}
.hero-mod-card.hero-mod-locked:hover {
    transform: none;
    border-color: rgba(139, 148, 158, 0.45);
    background: linear-gradient(180deg, rgba(28, 33, 40, 0.85), rgba(15, 20, 25, 0.9));
    box-shadow: none;
}
.hero-mod-card.hero-mod-locked:hover::before { opacity: 0; }
.hero-mod-card.hero-mod-locked:hover .hero-mod-icon { transform: none; box-shadow: none; color: inherit; }

.hero-mod-lock {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: rgba(15, 20, 25, 0.85);
    border: 1px solid rgba(139, 148, 158, 0.35);
    color: var(--text-secondary, #8B949E);
}
.hero-mod-lock svg { width: 11px; height: 11px; }

.hero-mod-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(43, 124, 233, 0.18), rgba(46, 204, 113, 0.10));
    border: 1px solid rgba(43, 124, 233, 0.30);
    color: #79b8ff;
    transition: transform .22s ease, box-shadow .22s ease, color .22s ease;
}

.hero-mod-icon svg { width: 22px; height: 22px; }

.hero-mod-card:hover .hero-mod-icon {
    transform: scale(1.08);
    color: #9ecbff;
    box-shadow: 0 0 18px rgba(43, 124, 233, 0.35);
}

.hero-mod-label {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--text-primary, #E6EDF3);
    text-align: center;
    line-height: 1.25;
}

.hero-mod-desc {
    font-size: 10.5px;
    line-height: 1.45;
    color: var(--text-secondary, #8B949E);
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 1180px) {
    .hero-modules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .hero-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- Hero Section --- */
.home-hero {
    position: relative;
    padding: 60px 40px 50px;
    text-align: center;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(43,124,233,0.08) 0%, transparent 60%),
        var(--bg-primary);
    border-bottom: 1px solid var(--border);
}

.hero-content {
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 1;               /* above the .hero-gizmo backdrop */
}

.hero-content > p {
    max-width: 700px;         /* prose stays at a readable measure */
    margin-left: auto;
    margin-right: auto;
}

.hero-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #62A0EA;
    background: rgba(43,124,233,0.1);
    border: 1px solid rgba(43,124,233,0.2);
    margin-bottom: 20px;
}

.home-hero h2 {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #E6EDF3, #62A0EA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.home-hero p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 28px;
}

/* ===== Hero CTAs — refined professional style ===== */
.hero-actions {
    margin-bottom: 36px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.hero-cta {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    padding: 14px 30px;
    background: linear-gradient(135deg, #1E4FA3 0%, #2B7CE9 50%, #3B8CF5 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.4, 1),
                box-shadow 0.25s ease,
                filter 0.2s ease;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.15) inset,
        0 0 0 1px rgba(43, 124, 233, 0.25),
        0 10px 28px -8px rgba(43, 124, 233, 0.55),
        0 4px 12px -2px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.hero-cta::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 55%);
    pointer-events: none;
}

.hero-cta::after {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 80%;
    height: 100%;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.18) 50%,
        rgba(255, 255, 255, 0) 100%);
    transform: skewX(-20deg);
    transition: left 0.7s ease;
    pointer-events: none;
}

.hero-cta:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.2) inset,
        0 0 0 1px rgba(43, 124, 233, 0.4),
        0 16px 38px -10px rgba(43, 124, 233, 0.7),
        0 6px 18px -4px rgba(0, 0, 0, 0.4);
}

.hero-cta:hover::after {
    left: 130%;
}

.hero-cta:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

.hero-cta svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.hero-cta-registration {
    background: linear-gradient(135deg, #5A2D96 0%, #8250DF 50%, #9B6BE8 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.15) inset,
        0 0 0 1px rgba(130, 80, 223, 0.3),
        0 10px 28px -8px rgba(130, 80, 223, 0.55),
        0 4px 12px -2px rgba(0, 0, 0, 0.35);
}

.hero-cta-registration:hover {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.2) inset,
        0 0 0 1px rgba(130, 80, 223, 0.45),
        0 16px 38px -10px rgba(130, 80, 223, 0.7),
        0 6px 18px -4px rgba(0, 0, 0, 0.4);
}

/* ===== FULL-PAGE SLICER MODE ===== */
.slicer-fullpage #left-panel {
    display: none !important;
}
.slicer-fullpage #right-panel {
    flex: 1;
}
/* Hide Three.js-specific UI that doesn't apply to the registration module */
.slicer-fullpage .viewer-toolbar,
.slicer-fullpage .obj-panel,
.slicer-fullpage .object-list-panel,
.slicer-fullpage #viewport-overlay,
.slicer-fullpage #viewport-empty {
    display: none !important;
}

/* ===== FULL-PAGE MESH VIEWER MODE (MCP deep-link /?view=) ===== */
/* Like slicer-fullpage but KEEPS the MeshLab viewer UI (toolbar, object panel). */
.viewer-fullpage #left-panel,
.viewer-fullpage #project-sidebar {
    display: none !important;
}
.viewer-fullpage #right-panel {
    flex: 1;
}
#viewer-exit-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1000;
    padding: 8px 14px;
    border-radius: var(--border-radius, 6px);
    background: var(--bg-elevated, #21262D);
    color: var(--text-primary, #E6EDF3);
    border: 1px solid var(--border-color, #30363D);
    cursor: pointer;
    font-size: 13px;
}
#viewer-exit-btn:hover {
    background: var(--accent, #2B7CE9);
    border-color: var(--accent, #2B7CE9);
}

/* Empty placeholder — 4-panel slicer grid shown before any volume is loaded */
.reg-empty-slicer {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    background: #000;
    z-index: 5;
    pointer-events: none;
}
.reg-empty-panel {
    position: relative;
    background: #07090C;
    border: 1px solid rgba(255, 255, 255, 0.04);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.reg-empty-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at center, rgba(155, 107, 232, 0.05) 0%, rgba(0, 0, 0, 0) 55%),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 14px);
    pointer-events: none;
}
.reg-empty-panel .reg-empty-label {
    position: absolute;
    top: 10px;
    left: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(139, 148, 158, 0.6);
    padding: 3px 8px 3px 10px;
    background: rgba(0, 0, 0, 0.5);
    border-left: 2px solid rgba(155, 107, 232, 0.4);
    border-radius: 2px;
    backdrop-filter: blur(2px);
}
.reg-empty-panel .reg-empty-center {
    position: relative;
    z-index: 2;
    text-align: center;
    color: rgba(139, 148, 158, 0.55);
    font-family: var(--font-family, 'Inter', sans-serif);
    font-size: 12px;
    line-height: 1.5;
    max-width: 80%;
    pointer-events: none;
}
.reg-empty-panel .reg-empty-center svg {
    display: block;
    margin: 0 auto 10px;
    color: rgba(155, 107, 232, 0.35);
}
.reg-empty-panel .reg-empty-hint {
    font-size: 10px;
    color: rgba(139, 148, 158, 0.4);
    margin-top: 6px;
    letter-spacing: 0.4px;
}

/* Loading overlay for uploads */
.reg-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(7, 9, 12, 0.88);
    backdrop-filter: blur(10px);
    color: #E6EDF3;
    font-family: var(--font-family, 'Inter', sans-serif);
    animation: reg-fade-in 0.2s ease;
}
@keyframes reg-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.reg-loading-overlay .reg-loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 32px 48px;
    background: linear-gradient(180deg, #1A1F28 0%, #12171E 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(155, 107, 232, 0.15);
    min-width: 320px;
    max-width: 480px;
}
.reg-loading-overlay .reg-loading-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #E6EDF3;
}
.reg-loading-overlay .reg-loading-sub {
    font-size: 11px;
    color: #8B949E;
    text-align: center;
    min-height: 14px;
}
.reg-loading-overlay .reg-loading-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.reg-loading-overlay .reg-loading-bar-fill {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, #6C3FA0, #9B6BE8, #B58AF0);
    border-radius: 2px;
    animation: reg-loading-slide 1.4s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(155, 107, 232, 0.6);
}
@keyframes reg-loading-slide {
    0%   { transform: translateX(-100%); }
    50%  { transform: translateX(120%); }
    100% { transform: translateX(300%); }
}

/* Non-blocking studio error toast (restore failures must be SURFACED) */
.reg-toast-error {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9100;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(640px, calc(100% - 48px));
    padding: 11px 14px;
    background: linear-gradient(180deg, #2A1518 0%, #1E1013 100%);
    border: 1px solid rgba(255, 123, 114, 0.45);
    border-radius: 10px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
    color: #ffb4ad;
    font-size: 12px;
    line-height: 1.45;
    font-family: var(--font-family, 'Inter', sans-serif);
    animation: reg-fade-in 0.25s ease;
}
.reg-toast-error svg { flex: none; color: #ff7b72; }
.reg-toast-error .reg-toast-close {
    flex: none;
    margin-left: 4px;
    background: none;
    border: none;
    color: #8B949E;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
}
.reg-toast-error .reg-toast-close:hover { color: #E6EDF3; background: rgba(255,255,255,0.06); }
.reg-toast-error .reg-toast-close:focus-visible { outline: 2px solid #9B6BE8; outline-offset: 1px; }

/* ===== Registration Execution Progress Bar ===== */
.reg-exec-progress {
    height: 22px;
    background: rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.reg-exec-progress-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, #6C3FA0, #9B6BE8);
    transition: width 0.4s ease;
}
.reg-exec-progress-label {
    position: relative;
    z-index: 1;
    display: block;
    text-align: center;
    font-size: 11px;
    line-height: 22px;
    color: #E6EDF3;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* ===== Node Editor Block Progress Bar ===== */
.ne-block-progress {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: rgba(255,255,255,0.08);
    border-radius: 0 0 6px 6px;
    overflow: hidden;
}
.ne-block-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6C3FA0, #9B6BE8);
    transition: width 0.4s ease;
    border-radius: 0 0 6px 6px;
}

/* ===== Registration Studio Header Bar ===== */
.reg-studio-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    min-height: 52px;
    flex-shrink: 0;
    z-index: 200;
    /* fix: never let a button (Exit) overflow off-screen — the bar scrolls
       horizontally as a last resort once everything is sized down */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    background:
        linear-gradient(180deg, rgba(130, 80, 223, 0.04) 0%, rgba(130, 80, 223, 0) 100%),
        linear-gradient(180deg, #161B22 0%, #12171E 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 2px 12px rgba(0, 0, 0, 0.35);
    font-family: var(--font-family, 'Inter', -apple-system, sans-serif);
}

.reg-studio-header .reg-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.25px;
    color: #E6EDF3;
    white-space: nowrap;
    user-select: none;
    padding-right: 4px;
}
.reg-studio-header .reg-logo svg {
    color: #9B6BE8;
    filter: drop-shadow(0 0 8px rgba(155, 107, 232, 0.35));
}

/* Separator */
.reg-studio-header .reg-separator {
    width: 1px;
    height: 22px;
    background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
    flex-shrink: 0;
}

/* Input selector buttons */
.reg-studio-header .reg-input-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 7px;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.02);
    color: #8B949E;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    max-width: 230px;
    overflow: hidden;
    white-space: nowrap;
}
.reg-studio-header .reg-input-btn:hover {
    border-color: rgba(155, 107, 232, 0.5);
    background: rgba(155, 107, 232, 0.08);
    color: #E6EDF3;
}
.reg-studio-header .reg-input-btn.loaded {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    color: #E6EDF3;
}
.reg-studio-header .reg-input-btn.loaded:hover {
    border-color: rgba(155, 107, 232, 0.5);
    background: rgba(155, 107, 232, 0.1);
}
.reg-studio-header .reg-input-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 6px rgba(255, 255, 255, 0.15);
}
.reg-studio-header .reg-input-label {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}
.reg-studio-header .reg-input-chevron {
    color: #6E7681;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.reg-studio-header .reg-input-btn:hover .reg-input-chevron {
    color: #9B6BE8;
    transform: translateY(1px);
}

/* Method selector */
.reg-studio-header .reg-method-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.reg-studio-header .reg-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #6E7681;
    user-select: none;
}
.reg-studio-header .reg-method-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 7px 28px 7px 12px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238B949E' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 10px center,
        rgba(255, 255, 255, 0.03);
    color: #E6EDF3;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.reg-studio-header .reg-method-select:hover {
    border-color: rgba(155, 107, 232, 0.5);
    background-color: rgba(155, 107, 232, 0.06);
}
.reg-studio-header .reg-method-select:focus {
    outline: none;
    border-color: #9B6BE8;
    box-shadow: 0 0 0 3px rgba(155, 107, 232, 0.2);
}
.reg-studio-header .reg-method-select option {
    background: #161B22;
    color: #E6EDF3;
    padding: 6px 10px;
    font-weight: 500;
}
.reg-studio-header .reg-method-select option:hover,
.reg-studio-header .reg-method-select option:checked {
    background: #1F2530;
    color: #9B6BE8;
}
/* I5 — the two Part-F section titles (Registration / Segmentation) are <optgroup>
   labels. Unstyled, they inherit a light color on the native (light) dropdown
   popup → invisible white-on-white. Give them the muted heading color + dark bg
   used elsewhere so they read clearly. */
.reg-studio-header .reg-method-select optgroup {
    background: #161B22;
    color: var(--text-secondary, #8B949E);
    font-weight: 700;
    font-style: normal;
}

/* Fit-to-width fix: the secondary actions (Logs/DICOM/Theory/Save/Reset) become
   ICON-ONLY so the full toolbar fits without the Exit button overflowing. Their
   title= tooltips keep them discoverable. Primary Run keeps its label. */
.reg-studio-header .reg-icon-btn span { display: none; }
.reg-studio-header .reg-icon-btn { padding: 7px 8px; flex-shrink: 0; }
.reg-studio-header .reg-icon-btn svg { width: 16px; height: 16px; }
.reg-studio-header .reg-separator { margin: 0 1px; }
/* The brand logo-home now lives in the left rail, so the in-header "Registration
   Studio" wordmark and the "Method" label are redundant — hiding them frees the
   ~160px that pushed the Exit button to (and past) the right edge on <1440 screens. */
.reg-studio-header .reg-logo span { display: none; }
.reg-studio-header .reg-method-wrap .reg-label { display: none; }
/* run button: keep a label but a touch tighter, and don't let it grow the bar */
.reg-studio-header .reg-run-btn { min-width: 150px; padding: 8px 14px; flex-shrink: 0; }
.reg-studio-header .reg-input-btn { max-width: 168px; flex-shrink: 0; }
.reg-studio-header .reg-input-label { max-width: 110px; }
.reg-studio-header .reg-method-select { max-width: 188px; }
.reg-studio-header .reg-exit-btn { flex-shrink: 0; }

/* I5 — stable header: the run button must not resize when its label toggles
   between "Run Registration" and "Running…" (that reflowed the whole header). */
.reg-studio-header .reg-run-btn { min-width: 176px; justify-content: center; }
/* keep loaded input buttons from growing the header unboundedly */
.reg-studio-header .reg-input-label {
    max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* I5 — the execution progress strip is a fixed overlay (absolute) at the bottom
   of the viewport, so showing/hiding it causes ZERO reflow of the header or the
   slicer panels (was inserted into flow, pushing everything down 22px). */
.reg-exec-progress {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 6;
}

/* Run button — primary CTA */
.reg-studio-header .reg-run-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, #1E4FA3 0%, #2B7CE9 50%, #3B8CF5 100%);
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.4, 1),
                filter 0.15s ease,
                box-shadow 0.2s ease;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.18) inset,
        0 0 0 1px rgba(43, 124, 233, 0.2),
        0 4px 14px -4px rgba(43, 124, 233, 0.5);
    white-space: nowrap;
}
.reg-studio-header .reg-run-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.1);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.22) inset,
        0 0 0 1px rgba(43, 124, 233, 0.35),
        0 8px 22px -6px rgba(43, 124, 233, 0.65);
}
.reg-studio-header .reg-run-btn:active:not(:disabled) {
    transform: translateY(0);
    filter: brightness(0.95);
}
.reg-studio-header .reg-run-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: saturate(0.5);
}
.reg-studio-header .reg-run-btn.running {
    background: linear-gradient(135deg, #A4751A 0%, #D29922 50%, #E9A820 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.18) inset,
        0 0 0 1px rgba(210, 153, 34, 0.3),
        0 4px 18px -4px rgba(210, 153, 34, 0.6);
    animation: reg-running-pulse 1.8s ease-in-out infinite;
}
@keyframes reg-running-pulse {
    0%, 100% {
        box-shadow:
            0 1px 0 rgba(255, 255, 255, 0.18) inset,
            0 0 0 1px rgba(210, 153, 34, 0.3),
            0 4px 18px -4px rgba(210, 153, 34, 0.6);
    }
    50% {
        box-shadow:
            0 1px 0 rgba(255, 255, 255, 0.18) inset,
            0 0 0 1px rgba(210, 153, 34, 0.6),
            0 6px 26px -2px rgba(210, 153, 34, 0.85);
    }
}
.reg-studio-header .reg-run-btn .reg-spin {
    animation: reg-spin 0.9s linear infinite;
}
@keyframes reg-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Icon buttons (Logs, Theory) */
.reg-studio-header .reg-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    color: #8B949E;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.reg-studio-header .reg-icon-btn:hover:not(:disabled) {
    border-color: rgba(155, 107, 232, 0.4);
    background: rgba(155, 107, 232, 0.08);
    color: #E6EDF3;
}
.reg-studio-header .reg-icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Exit button (right-aligned) */
.reg-studio-header .reg-exit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: #8B949E;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: auto;
}
.reg-studio-header .reg-exit-btn:hover {
    border-color: rgba(207, 34, 46, 0.5);
    background: rgba(207, 34, 46, 0.1);
    color: #F85149;
}

/* --- Domain Showcase (large image cards) --- */
.domain-showcase {
    padding: 40px 40px 60px;
    max-width: 1440px;
    margin: 0 auto;
}

.domain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.domain-card {
    position: relative;
    height: 280px;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 300ms ease;
}

.domain-card:hover {
    transform: translateY(-6px);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px var(--domain-accent, #2B7CE9),
        0 0 30px -5px color-mix(in srgb, var(--domain-accent, #2B7CE9) 30%, transparent);
}

.domain-card-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 500ms ease;
}

.domain-card:hover .domain-card-bg {
    transform: scale(1.08);
}

.domain-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(15, 20, 25, 0.15) 0%,
        rgba(15, 20, 25, 0.6) 50%,
        rgba(15, 20, 25, 0.92) 100%
    );
    transition: background 300ms ease;
}

.domain-card:hover .domain-card-overlay {
    background: linear-gradient(
        to bottom,
        rgba(15, 20, 25, 0.05) 0%,
        rgba(15, 20, 25, 0.5) 50%,
        rgba(15, 20, 25, 0.88) 100%
    );
}

.domain-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
}

.domain-card-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.domain-card-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    line-height: 1.5;
    margin-bottom: 10px;
}

.domain-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
}

.domain-card-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
}

/* --- Domain Popup (overlay with module cards) --- */
.domain-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 150ms ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.domain-popup {
    background: var(--bg-secondary, #161B22);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 720px;
    max-width: 92vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    animation: popIn 200ms ease;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.domain-popup-header {
    position: relative;
    height: 180px;
    overflow: hidden;
    flex-shrink: 0;
}

.domain-popup-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.domain-popup-header-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(15, 20, 25, 0.2) 0%,
        rgba(15, 20, 25, 0.85) 100%
    );
}

.domain-popup-header-content {
    position: absolute;
    bottom: 20px;
    left: 28px;
    right: 28px;
}

.domain-popup-header-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.domain-popup-header-content p {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    line-height: 1.5;
}

.domain-popup-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease;
    z-index: 1;
}

.domain-popup-close:hover {
    background: rgba(207, 34, 46, 0.7);
}

.domain-popup-body {
    padding: 24px 28px 28px;
    overflow-y: auto;
    flex: 1;
}

.domain-popup-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.domain-popup-modules {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Module card inside domain popup */
.domain-popup-module-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 12px;
    background: var(--bg-tertiary, #1C2128);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 200ms ease;
}

.domain-popup-module-card:hover {
    background: rgba(43, 124, 233, 0.06);
    border-color: var(--domain-accent, #2B7CE9);
    transform: translateX(4px);
}

.dpmc-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.dpmc-icon svg {
    width: 24px;
    height: 24px;
}

.dpmc-icon.processing     { background: rgba(43,124,233,0.12);  color: #2B7CE9; }
.dpmc-icon.reconstruction { background: rgba(45,164,78,0.12);   color: #2DA44E; }
.dpmc-icon.registration   { background: rgba(130,80,223,0.12);  color: #8250DF; }
.dpmc-icon.implicit       { background: rgba(47,163,115,0.12);  color: #2FA373; }
.dpmc-icon.features       { background: rgba(207,34,46,0.12);   color: #CF222E; }
.dpmc-icon.conversion     { background: rgba(191,135,72,0.12);  color: #BF8748; }
.dpmc-icon.segmentation   { background: rgba(210,153,34,0.12);  color: #D29922; }
.dpmc-icon.stereo         { background: rgba(219,135,68,0.12);  color: #DB8744; }
.dpmc-icon.lidar          { background: rgba(45,164,78,0.12);   color: #2DA44E; }
.dpmc-icon.collision      { background: rgba(207,34,46,0.12);   color: #CF222E; }
.dpmc-icon.medical        { background: rgba(43,124,233,0.12);  color: #2B7CE9; }

.dpmc-info {
    flex: 1;
    min-width: 0;
}

.dpmc-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.dpmc-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dpmc-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
}

.dpmc-methods {
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-primary, #0F1419);
}

.dpmc-video-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #CF222E;
    font-weight: 500;
}

.dpmc-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.4;
    transition: all 200ms ease;
}

.domain-popup-module-card:hover .dpmc-arrow {
    opacity: 1;
    color: var(--domain-accent, #2B7CE9);
    transform: translateX(3px);
}

.module-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 200ms ease;
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border-color: rgba(43, 124, 233, 0.4);
}

.module-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 18px 10px;
}

.module-card-body {
    padding: 0 18px 16px;
}

.module-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 20px;
    flex-shrink: 0;
}

.module-card-icon svg {
    width: 20px;
    height: 20px;
}

.module-card-icon.segmentation   { background: rgba(210,153,34,0.12);  color: #D29922; }
.module-card-icon.reconstruction { background: rgba(45,164,78,0.12);   color: #2DA44E; }
.module-card-icon.registration   { background: rgba(130,80,223,0.12);  color: #8250DF; }
.module-card-icon.implicit       { background: rgba(47,163,115,0.12);  color: #2FA373; }
.module-card-icon.features       { background: rgba(207,34,46,0.12);   color: #CF222E; }
.module-card-icon.conversion     { background: rgba(191,135,72,0.12);  color: #BF8748; }
.module-card-icon.processing     { background: rgba(43,124,233,0.12);  color: #2B7CE9; }
.module-card-icon.stereo         { background: rgba(219,135,68,0.12);  color: #DB8744; }
.module-card-icon.lidar          { background: rgba(45,164,78,0.12);   color: #2DA44E; }
.module-card-icon.collision      { background: rgba(207,34,46,0.12);   color: #CF222E; }
.module-card-icon.medical        { background: rgba(43,124,233,0.12);  color: #2B7CE9; }

.module-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.module-badge-category {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(43, 124, 233, 0.1);
    color: #8B949E;
}

.module-badge-category.processing     { color: #2B7CE9; background: rgba(43,124,233,0.1); }
.module-badge-category.reconstruction { color: #2DA44E; background: rgba(45,164,78,0.1); }
.module-badge-category.registration   { color: #8250DF; background: rgba(130,80,223,0.1); }
.module-badge-category.implicit       { color: #2FA373; background: rgba(47,163,115,0.1); }
.module-badge-category.features       { color: #CF222E; background: rgba(207,34,46,0.1); }
.module-badge-category.conversion     { color: #BF8748; background: rgba(191,135,72,0.1); }
.module-badge-category.segmentation   { color: #D29922; background: rgba(210,153,34,0.1); }
.module-badge-category.stereo         { color: #DB8744; background: rgba(219,135,68,0.1); }
.module-badge-category.lidar          { color: #2DA44E; background: rgba(45,164,78,0.1); }
.module-badge-category.collision      { color: #CF222E; background: rgba(207,34,46,0.1); }
.module-badge-category.medical        { color: #2B7CE9; background: rgba(43,124,233,0.1); }

.module-badge-video {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: rgba(207, 34, 46, 0.12);
    color: #CF222E;
    transition: all 0.15s ease;
}

.module-card:hover .module-badge-video {
    background: rgba(207, 34, 46, 0.2);
}

.module-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.module-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.module-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.module-card-meta .method-count {
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-tertiary);
}

.module-card-meta .coming-soon {
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(210, 153, 34, 0.12);
    color: var(--warning);
}

/* ===== PROJECT SIDEBAR ===== */
#project-sidebar {
    width: 260px;
    min-width: 260px;
    flex-shrink: 0;
    transition: width 200ms ease, min-width 200ms ease;
}

.project-sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #111318;
    border-right: 1px solid var(--border);
}

/* --- Collapsed state --- */
#project-sidebar.ps-collapsed {
    width: 48px;
    min-width: 48px;
}
.ps-collapsed .ps-body {
    display: none;
}
.ps-collapsed .ps-title {
    display: none;
}
.ps-collapsed .ps-header {
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 6px;
}
.ps-collapsed .ps-title-row {
    display: none;
}

.ps-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 14px 6px;
}

/* Home = the brand logo alone (clickable) */
.ps-home-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform var(--transition), background var(--transition);
}
.ps-home-logo { width: 28px; height: 28px; border-radius: 6px; display: block; }
.ps-home-btn:hover {
    background: var(--bg-elevated,#21262D);
    transform: scale(1.05);
}
.ps-collapsed .ps-home-btn { width: 32px; height: 32px; }

.ps-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.ps-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.ps-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}
.ps-toggle-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* --- Body (hides on collapse) --- */
.ps-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* --- Action buttons row --- */
.ps-actions {
    display: flex;
    gap: 6px;
    padding: 4px 10px 8px;
}

.ps-new-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}
.ps-new-btn:hover {
    background: rgba(43, 124, 233, 0.12);
    border-color: var(--accent);
    color: var(--accent);
}
.ps-new-btn svg { flex-shrink: 0; }

/* --- Delete button on project items --- */
.ps-item-delete {
    flex-shrink: 0;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition);
}
.ps-item:hover .ps-item-delete { opacity: 0.6; }
.ps-item-delete:hover {
    opacity: 1 !important;
    color: var(--danger, #f85149);
    background: rgba(248, 81, 73, 0.12);
}

/* --- Delete confirm button --- */
.ps-modal-btn-delete {
    background: var(--danger, #f85149);
    border-color: var(--danger, #f85149);
    color: #fff;
}
.ps-modal-btn-delete:hover {
    background: #da3633;
    border-color: #da3633;
}
.ps-modal-msg {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

/* --- Project list --- */
.ps-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}

.ps-empty {
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.ps-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 2px;
}
.ps-item:hover {
    background: var(--bg-tertiary);
}

.ps-item-active {
    background: rgba(43, 124, 233, 0.15);
}
.ps-item-active .ps-item-name {
    color: var(--accent);
    font-weight: 500;
}
.ps-item-active .ps-item-icon svg {
    stroke: var(--accent);
}

.ps-item-icon {
    flex-shrink: 0;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.ps-item-name {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- New Project Modal (uses ne-modal base) --- */
.ps-modal-new {
    min-width: 380px;
    max-width: 440px;
}

.ps-modal-field {
    margin-bottom: 16px;
}

.ps-modal-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.ps-modal-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition);
}
.ps-modal-input::placeholder {
    color: var(--text-muted);
}
.ps-modal-input:focus {
    border-color: var(--accent);
}
.ps-modal-input-error {
    border-color: var(--error) !important;
}

.ps-modal-error {
    font-size: 12px;
    color: var(--error);
    min-height: 18px;
    margin-bottom: 8px;
}

.ps-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.ps-modal-btn {
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
}

.ps-modal-btn-cancel {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}
.ps-modal-btn-cancel:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.ps-modal-btn-create {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}
.ps-modal-btn-create:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.ps-modal-btn-create:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- API Modal --- */
.ps-modal-api {
    min-width: 520px;
    max-width: 600px;
}

.ps-modal-api-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.api-key-display label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.api-key-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.api-key-box code {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--accent);
    word-break: break-all;
}

.api-copy-btn {
    flex-shrink: 0;
    padding: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.api-copy-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.api-usage {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.api-docs {
    padding: 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.api-docs h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.api-docs pre {
    margin: 0;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 10px;
}

.api-docs code {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: var(--text-primary);
    line-height: 1.6;
}

.api-docs-note {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.api-info {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.ps-modal-btn-primary {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.ps-modal-btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.ps-modal-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ps-modal-btn-danger {
    background: #d32f2f;
    color: white;
    border-color: #d32f2f;
}

.ps-modal-btn-danger:hover {
    background: #b71c1c;
    border-color: #b71c1c;
}

.ps-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    padding: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.ps-modal-close:hover {
    color: var(--text-primary);
}

/* ===== WORKSPACE: 50/50 SPLIT LAYOUT ===== */
#workspace-app {
    display: flex;
    height: 100vh;
}

#left-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow: hidden;
}

#right-panel {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
}

/* ===== PANEL HEADER (back + title) — hidden in universal toolbox mode ===== */
.panel-header {
    display: none;
}

.panel-header h2 {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-back:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: rgba(43, 124, 233, 0.05);
}

.back-arrow {
    font-size: 14px;
}

/* ===== TAB BAR — inside header, visible only in workspace ===== */
#tab-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}
#tab-bar.hidden {
    display: none;
}

.tab-btn {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-icon {
    font-size: 14px;
}

/* ===== TAB CONTENT ===== */
#tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Workflow tab uses flex layout for node editor when active */
#tab-workflow.active {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    flex: 1;
}

/* ===== VIDEO TAB ===== */
.video-container {
    margin-bottom: 20px;
}

.video-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-primary);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ===== WORKFLOW TAB ===== */
.wf-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
}

.wf-panel h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(43, 124, 233, 0.05);
}

.upload-icon {
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.upload-zone p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.upload-link {
    color: var(--accent);
    cursor: pointer;
}

.upload-formats {
    font-size: 11px !important;
    color: var(--text-muted) !important;
    margin-top: 8px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 8px;
}

#file-name {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#file-size {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-icon:hover {
    color: var(--error);
    background: rgba(248, 81, 73, 0.1);
}

/* Method section */
#method-select {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    margin-bottom: 12px;
}

#method-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.param-group {
    margin-bottom: 10px;
}

.param-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.param-group label .param-value {
    color: var(--accent);
    font-weight: 600;
    font-family: monospace;
}

.param-group input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.param-group .param-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.btn-primary {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 8px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* No methods */
.no-methods-text {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

.no-methods-text code {
    font-size: 12px;
    padding: 1px 5px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--accent);
}

/* ===== JOB TRACKER ===== */
.job-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.badge.pending { background: rgba(210, 153, 34, 0.15); color: var(--warning); }
.badge.running { background: rgba(43, 124, 233, 0.15); color: var(--accent); }
.badge.completed { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.badge.failed { background: rgba(248, 81, 73, 0.15); color: var(--error); }

#job-elapsed {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

#job-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

#job-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 300ms ease;
}

#job-progress-fill.indeterminate {
    width: 30%;
    animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.error-text {
    font-size: 12px;
    color: var(--error);
    margin-top: 8px;
    word-break: break-word;
}

/* ===== SCIENTIFIC TAB / THEORY ===== */
#theory-overview,
#theory-method {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.theory-heading {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.theory-body {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
}

.theory-body p {
    margin-bottom: 8px;
}

.theory-placeholder {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

/* KaTeX dark theme overrides */
.katex {
    color: var(--text-primary);
    font-size: 1.05em;
}

.katex-display {
    margin: 1em 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0;
}

.katex-display > .katex {
    color: #62A0EA;
}

/* ===== EMPTY TAB STATE ===== */
.empty-tab-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.empty-tab-state p {
    font-size: 14px;
    color: var(--text-muted);
}

/* ===== VIEWPORT ===== */
#viewport-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#viewport {
    width: 100%;
    height: 100%;
    display: block;
}

#viewport-overlay {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: flex;
    gap: 12px;
    font-size: 11px;
    font-family: monospace;
    color: var(--text-primary);
    background: rgba(22, 27, 34, 0.75);
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

#viewport-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#viewport-empty p {
    font-size: 15px;
    color: rgba(200, 210, 225, 0.6);
}

/* ===== SLICER MODE ===== */
/* ===== SLICER 2x2 GRID (3D Slicer MPR Layout) =====
 *  ┌─────────────┬─────────────┐
 *  │  SAGITTAL   │   CORONAL   │
 *  ├─────────────┼─────────────┤
 *  │    AXIAL    │  3D VOLUME  │
 *  └─────────────┴─────────────┘
 */
.slicer-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0;
    background: none;
    pointer-events: none;
}

.slicer-panel {
    position: relative;
    pointer-events: auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: none;
    cursor: crosshair;
}

.slicer-panel-volume3d {
    overflow: visible;
    cursor: default;
}

.slicer-label {
    position: absolute;
    top: 6px;
    left: 8px;
    z-index: 2;
    font-size: 11px;
    font-family: monospace;
    color: #e6edf3;
    background: rgba(0, 0, 0, 0.65);
    padding: 2px 8px 2px 12px;
    border-radius: 3px;
    border-left: 3px solid #888;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.slicer-slice-info {
    position: absolute;
    top: 6px;
    right: 8px;
    z-index: 2;
    font-size: 10px;
    font-family: monospace;
    color: #8b949e;
    background: rgba(0, 0, 0, 0.55);
    padding: 2px 6px;
    border-radius: 3px;
    pointer-events: none;
}

.slicer-slider-wrap {
    position: absolute;
    bottom: 6px;
    left: 8px;
    right: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
}

.slicer-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.slicer-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2B7CE9;
    border: 2px solid #fff;
    cursor: pointer;
}

.slicer-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2B7CE9;
    border: 2px solid #fff;
    cursor: pointer;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: none;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: loading-spin 0.8s linear infinite;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }
.loading-text {
    color: #ddd;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 400;
}

/* Hide normal overlays in slicer mode */
.slicer-active .viewer-toolbar,
.slicer-active .obj-panel,
.slicer-active #viewport-overlay,
.slicer-active #viewport-empty {
    display: none !important;
}

/* ===== REGISTRATION PANEL (kept for RegistrationPanel.js compatibility) ===== */
.reg-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    z-index: 200;
    overflow-y: auto;
    font-size: 13px;
    color: var(--text-primary);
}

.reg-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
}

.reg-panel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.reg-panel-close:hover {
    color: var(--error);
}

.reg-panel-section {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.reg-panel-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.reg-panel-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

/* Buttons */
.reg-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    white-space: nowrap;
}
.reg-btn:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
}
.reg-btn-ct { border-left: 3px solid #4a9eff; }
.reg-btn-mri { border-left: 3px solid #ff6b6b; }
.reg-btn-tfm { border-left: 3px solid #ffd93d; }
.reg-btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.reg-file-label {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Radio & Checkbox labels */
.reg-radio-label,
.reg-checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.reg-radio-label input,
.reg-checkbox-label input {
    accent-color: var(--accent);
    cursor: pointer;
}

/* Sliders */
.reg-slider {
    flex: 1;
    min-width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.reg-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}
.reg-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}
.reg-slider-wide { min-width: 100px; }

.reg-slider-label {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 28px;
    white-space: nowrap;
}

.reg-slider-value {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1199px) {
    #left-panel { flex: 1.4; }
    #right-panel { flex: 1; }
}

@media (max-width: 767px) {
    #project-sidebar {
        display: none;
    }
    #workspace-app {
        flex-direction: column;
    }
    #left-panel,
    #right-panel {
        flex: none;
        width: 100%;
        height: 50%;
    }
    #left-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

/* ===== SCROLLBARS ===== */
#tab-content::-webkit-scrollbar { width: 6px; }
#tab-content::-webkit-scrollbar-track { background: transparent; }
#tab-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

#home-view::-webkit-scrollbar { width: 6px; }
#home-view::-webkit-scrollbar-track { background: transparent; }
#home-view::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ============================================================
   NODE EDITOR — Simplified pipeline: [Inputs] → [Process] → [Execute]
   ============================================================ */

/* Container fills the workflow tab */
.ne-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: var(--bg-primary);
}

/* --- Toolbar: buttons center + zoom right --- */
.ne-toolbar {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.ne-toolbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.ne-zoom-group {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.ne-zoom-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}
.ne-zoom-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}
.ne-zoom-level {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 38px;
    text-align: center;
    font-family: monospace;
}

.ne-tool-btn {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition);
}
.ne-tool-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: rgba(43, 124, 233, 0.08);
}
.ne-tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Selector buttons (Inputs, Process) */
.ne-tool-selector {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.ne-tool-selector.ne-has-selection {
    color: var(--accent);
    border-color: rgba(43, 124, 233, 0.4);
    background: rgba(43, 124, 233, 0.06);
}
.ne-selector-label {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ne-dropdown-arrow {
    font-size: 10px;
    opacity: 0.6;
}

/* Section label in modals (e.g. "Primitives", "Open3D Datasets") */
.ne-modal-section-label {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2px;
}
.ne-modal-section-label:first-child {
    padding-top: 0;
}

/* Empty state in modals */
.ne-modal-empty {
    color: var(--text-muted);
    font-size: 13px;
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
}

.ne-modal-note {
    background: rgba(106, 170, 255, 0.1);
    border: 1px solid rgba(106, 170, 255, 0.3);
    border-radius: var(--radius);
    padding: 12px;
    margin: 16px 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Log popup */
.ne-modal-logs {
    width: 750px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.ne-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.ne-log-header .ne-modal-title {
    margin: 0;
    padding: 0;
}
.ne-log-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 10px;
}
.ne-log-status.pending   { color: var(--text-muted); background: rgba(139,148,158,0.12); }
.ne-log-status.running   { color: #58a6ff; background: rgba(88,166,255,0.12); }
.ne-log-status.completed { color: var(--success, #2DA44E); background: rgba(45,164,78,0.12); }
.ne-log-status.failed    { color: var(--error, #CF222E); background: rgba(207,34,46,0.12); }
.ne-log-status.running .ne-pulse {
    width: 6px; height: 6px; border-radius: 50%;
    background: #58a6ff;
    animation: ne-pulse-anim 1.2s ease-in-out infinite;
}
@keyframes ne-pulse-anim {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.7); }
}
.ne-log-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.ne-log-close:hover {
    color: var(--error);
}
.ne-log-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #c9d1d9;
    background: #0d1117;
    border-radius: 0 0 var(--radius) var(--radius);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 60vh;
}
/* Loguru-style log coloring */
.ne-log-content .log-timestamp { color: #8b949e; }
.ne-log-content .log-level-info     { color: #58a6ff; font-weight: 600; }
.ne-log-content .log-level-success  { color: #2da44e; font-weight: 600; }
.ne-log-content .log-level-warning  { color: #d29922; font-weight: 600; }
.ne-log-content .log-level-error    { color: #f85149; font-weight: 600; }
.ne-log-content .log-level-critical { color: #ff7b72; font-weight: 700; background: rgba(248,81,73,0.1); }
.ne-log-content .log-level-debug    { color: #8b949e; }
.ne-log-content .log-source  { color: #7ee787; }
.ne-log-content .log-message { color: #c9d1d9; }
.ne-log-content .log-number  { color: #d2a8ff; }
.ne-log-content .log-line-error { background: rgba(248,81,73,0.06); display: block; }
.ne-log-content .log-line-warning { background: rgba(210,153,34,0.06); display: block; }

/* Execute button (icon only) */
.ne-tool-execute {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ne-tool-execute:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.ne-tool-execute:disabled {
    opacity: 0.4;
    cursor: wait;
}

/* Save button in toolbar (icon only) */
.ne-tool-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--text-secondary);
    border-color: var(--border);
}
.ne-tool-save svg { flex-shrink: 0; }
.ne-tool-save:hover {
    color: var(--success, #2da44e);
    border-color: var(--success, #2da44e);
    background: rgba(45, 164, 78, 0.08);
}

/* API button in toolbar (icon only) */
.ne-tool-api {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--text-secondary);
    border-color: var(--border);
}
.ne-tool-api svg { flex-shrink: 0; }
.ne-tool-api:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(43, 124, 233, 0.08);
}

.ne-save-flash {
    background: rgba(45, 164, 78, 0.2) !important;
    border-color: var(--success, #2da44e) !important;
    color: var(--success, #2da44e) !important;
}

/* --- Wrapper parent: holds scrollable area (no overflow itself) --- */
.ne-wrapper-parent {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* --- Pannable wrapper (click-drag to pan, scrollbars hidden) --- */
.ne-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
    cursor: grab;
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* IE/Edge */
}
.ne-wrapper::-webkit-scrollbar {
    display: none;                  /* Chrome/Safari */
}
.ne-wrapper.ne-panning {
    cursor: grabbing;
    user-select: none;
}

/* --- Sizer: determines scrollable area (width/height set by JS) --- */
.ne-sizer {
    position: relative;
}

/* --- Zoom layer: CSS transform scale, all content inside --- */
.ne-zoom-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 3000px;
    height: 2000px;
    transform-origin: 0 0;
    background:
        radial-gradient(circle, var(--border) 1px, transparent 1px);
    background-size: 24px 24px;
}

.ne-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.ne-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* --- Connection lines --- */
.ne-conn-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    opacity: 0.6;
    transition: opacity 150ms, stroke-width 150ms;
}
.ne-conn-line:hover {
    opacity: 1;
    stroke-width: 3;
    filter: drop-shadow(0 0 3px rgba(43, 124, 233, 0.4));
}
.ne-conn-temp {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-dasharray: 8 4;
    opacity: 0.7;
    transition: stroke-width 100ms, opacity 100ms;
    filter: drop-shadow(0 0 3px rgba(43, 124, 233, 0.3));
}

/* --- Block: the draggable node element --- */
.ne-block {
    position: absolute;
    width: 260px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: default;
    user-select: none;
    transition: box-shadow 150ms, border-color 150ms;
    z-index: 10;
}
.ne-block:hover {
    border-color: rgba(43, 124, 233, 0.4);
}
.ne-block.ne-dragging {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border-color: var(--accent);
    z-index: 100;
}

/* Block header */
.ne-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 7px 7px 0 0;
    cursor: grab;
    user-select: none;
}
.ne-block.ne-dragging .ne-block-header {
    cursor: grabbing;
}

.ne-block-file-input .ne-block-header {
    background: rgba(43, 124, 233, 0.12);
}
.ne-block-process .ne-block-header {
    background: rgba(94, 140, 174, 0.15);
}

.ne-block-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.ne-block-video {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 3px;
    line-height: 1;
    border-radius: 3px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    opacity: 0.5;
}
.ne-block-video:hover {
    color: #CF222E;
    opacity: 1;
    background: rgba(207, 34, 46, 0.1);
}
.ne-block-log {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 3px;
    line-height: 1;
    border-radius: 3px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    opacity: 0.5;
}
.ne-block-log:hover {
    color: #2B7CE9;
    opacity: 1;
    background: rgba(43, 124, 233, 0.1);
}
.ne-block-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: 3px;
    transition: all var(--transition);
}
.ne-block-delete:hover {
    color: var(--error);
    background: rgba(207, 34, 46, 0.15);
}

/* Block body: contains ports + content */
.ne-block-body {
    display: flex;
    padding: 6px 0;
    min-height: 30px;
}

/* Ports columns */
.ne-ports {
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    flex-shrink: 0;
}
.ne-ports-left { padding-left: 0; }
.ne-ports-right { padding-right: 0; }
.ne-ports-top,
.ne-ports-bottom {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 2px 0;
}
.ne-ports-top { border-bottom: 1px solid var(--border); }
.ne-ports-bottom { border-top: 1px solid var(--border); }
.ne-ports-top .ne-port,
.ne-ports-bottom .ne-port {
    flex-direction: column;
    padding: 3px 6px;
}
.ne-ports-top .ne-port-label,
.ne-ports-bottom .ne-port-label {
    font-size: 9px;
}

/* Single port: dot + label */
.ne-port {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    cursor: pointer;
}
.ne-port:hover .ne-port-dot {
    transform: scale(1.4);
    box-shadow: 0 0 6px var(--accent);
}

.ne-port-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-secondary);
    flex-shrink: 0;
    transition: transform 150ms, box-shadow 150ms, background 150ms;
    cursor: crosshair;
    /* Larger invisible hit area */
    position: relative;
}
.ne-port-dot::after {
    content: '';
    position: absolute;
    top: -8px; left: -8px; right: -8px; bottom: -8px;
    border-radius: 50%;
}
.ne-port-in .ne-port-dot {
    background: var(--success);
}
.ne-port-out .ne-port-dot {
    background: var(--accent);
}

/* Pulsing glow on compatible ports while dragging a connection */
.ne-port-target .ne-port-dot {
    transform: scale(1.3);
    box-shadow: 0 0 8px rgba(43, 124, 233, 0.6);
    animation: ne-port-pulse 1s ease-in-out infinite;
}
.ne-port-target.ne-port-in .ne-port-dot {
    box-shadow: 0 0 8px rgba(39, 174, 96, 0.6);
}
@keyframes ne-port-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Snap highlight — when cursor is near enough to connect */
.ne-port-snap {
    transform: scale(1.8) !important;
    box-shadow: 0 0 12px var(--accent), 0 0 20px rgba(43, 124, 233, 0.4) !important;
    animation: none !important;
}
.ne-port-in .ne-port-snap {
    box-shadow: 0 0 12px var(--success), 0 0 20px rgba(39, 174, 96, 0.4) !important;
}

.ne-port-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Block content area (between ports) */
.ne-block-content {
    flex: 1;
    padding: 4px 6px;
    min-width: 0;
}

/* File input inside block */
.ne-file-drop {
    border: 1.5px dashed var(--border);
    border-radius: 4px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}
.ne-file-drop:hover,
.ne-file-drop.ne-drag-over {
    border-color: var(--accent);
    background: rgba(43, 124, 233, 0.06);
}
.ne-file-label {
    font-size: 11px;
    color: var(--text-muted);
}
.ne-file-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: background var(--transition);
}
.ne-file-info:hover {
    background: rgba(43, 124, 233, 0.08);
}
.ne-file-name {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ne-file-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
}
.ne-file-clear:hover {
    color: var(--error);
}

/* Parameter sliders inside blocks */
.ne-param {
    margin-bottom: 6px;
}
.ne-param label {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.ne-pval {
    color: var(--accent);
    font-weight: 600;
    font-family: monospace;
}
.ne-param input[type="range"] {
    width: 100%;
    height: 4px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Block status bar */
.ne-block-status {
    padding: 4px 10px;
    border-top: 1px solid var(--border);
    border-radius: 0 0 7px 7px;
}

.ne-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}
.ne-badge.idle       { background: var(--bg-tertiary); color: var(--text-muted); }
.ne-badge.running    { background: rgba(43, 124, 233, 0.15); color: var(--accent); animation: ne-pulse 1.5s infinite; }
.ne-badge.completed  { background: rgba(45, 164, 78, 0.15); color: var(--success); }
.ne-badge.failed     { background: rgba(207, 34, 46, 0.15); color: var(--error); }

@keyframes ne-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* --- Process Selection Popup (structured) --- */
.ne-modal-process {
    position: relative;
    min-width: 720px;
    max-width: 860px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

/* Header */
.ne-proc-header {
    padding: 28px 32px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.ne-proc-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 2px;
}
.ne-proc-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 14px;
}
.ne-proc-search-wrap {
    position: relative;
}
.ne-proc-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.ne-proc-search {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}
.ne-proc-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(43, 124, 233, 0.15);
}
.ne-proc-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms ease;
}
.ne-proc-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Scrollable body */
.ne-proc-body {
    overflow-y: auto;
    padding: 20px 32px 28px;
    flex: 1;
}
.ne-proc-body::-webkit-scrollbar { width: 6px; }
.ne-proc-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.ne-proc-body::-webkit-scrollbar-track { background: transparent; }

/* Domain section */
.ne-proc-domain {
    margin-bottom: 24px;
}
.ne-proc-domain:last-child { margin-bottom: 0; }

.ne-proc-domain-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.ne-proc-domain-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--domain-accent) 12%, transparent);
    color: var(--domain-accent);
    flex-shrink: 0;
}
.ne-proc-domain-icon svg {
    width: 16px;
    height: 16px;
}
.ne-proc-domain-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ne-proc-domain-count {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Module cards grid */
.ne-proc-module-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

/* Module card */
.ne-proc-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-primary);
    padding: 14px 16px 12px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.ne-proc-card:hover {
    border-color: var(--domain-accent, var(--accent));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--domain-accent, var(--accent)) 20%, transparent);
}

.ne-proc-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}
.ne-proc-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ne-proc-card-icon svg {
    width: 18px;
    height: 18px;
}
/* Category colors (reuse dpmc-icon colors) */
.ne-proc-card-icon.processing     { background: rgba(43,124,233,0.12);  color: #2B7CE9; }
.ne-proc-card-icon.reconstruction { background: rgba(45,164,78,0.12);   color: #2DA44E; }
.ne-proc-card-icon.registration   { background: rgba(130,80,223,0.12);  color: #8250DF; }
.ne-proc-card-icon.implicit       { background: rgba(47,163,115,0.12);  color: #2FA373; }
.ne-proc-card-icon.features       { background: rgba(207,34,46,0.12);   color: #CF222E; }
.ne-proc-card-icon.conversion     { background: rgba(191,135,72,0.12);  color: #BF8748; }
.ne-proc-card-icon.segmentation   { background: rgba(210,153,34,0.12);  color: #D29922; }
.ne-proc-card-icon.stereo         { background: rgba(219,135,68,0.12);  color: #DB8744; }
.ne-proc-card-icon.lidar          { background: rgba(45,164,78,0.12);   color: #2DA44E; }
.ne-proc-card-icon.collision      { background: rgba(207,34,46,0.12);   color: #CF222E; }
.ne-proc-card-icon.medical        { background: rgba(88,166,255,0.12);  color: #58a6ff; }

.ne-proc-card-info {
    flex: 1;
    min-width: 0;
}
.ne-proc-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.ne-proc-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Method buttons */
.ne-proc-card-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ne-proc-method-btn {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 150ms ease;
    white-space: nowrap;
}
.ne-proc-method-btn:hover {
    color: var(--domain-accent, var(--accent));
    border-color: var(--domain-accent, var(--accent));
    background: color-mix(in srgb, var(--domain-accent, var(--accent)) 8%, transparent);
}

/* --- Selected state for sample cards --- */
.ne-sample-card.ne-selected {
    border-color: var(--accent);
    background: rgba(43, 124, 233, 0.12);
    box-shadow: 0 0 0 1px var(--accent);
}

/* --- Sample Selection Modal --- */
.ne-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}
.ne-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    min-width: 420px;
    max-width: 560px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
.ne-modal.ne-modal-samples {
    max-width: 620px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.ne-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-align: center;
}
.ne-modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.ne-sample-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 200ms ease;
    text-align: center;
}
.ne-sample-card:hover {
    border-color: var(--accent);
    background: rgba(43, 124, 233, 0.08);
    transform: translateY(-1px);
}
.ne-sample-icon {
    font-size: 28px;
    line-height: 1;
}
.ne-sample-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}
.ne-sample-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 6px;
    border-radius: 8px;
}
.ne-sample-badge-mesh {
    background: rgba(130, 80, 223, 0.15);
    color: #8250DF;
}
.ne-sample-badge-pointcloud {
    background: rgba(43, 124, 233, 0.15);
    color: var(--accent);
}
.ne-sample-badge-volume {
    background: rgba(240, 81, 51, 0.15);
    color: #f05133;
}
.ne-sample-badge-structured_grid,
.ne-sample-badge-unstructured_grid {
    background: rgba(57, 211, 83, 0.15);
    color: #39d353;
}
.ne-sample-badge-format {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 8px;
}
.ne-sample-badge-size {
    background: rgba(255, 170, 0, 0.2);
    color: #ffaa00;
    font-size: 8px;
}
.ne-sample-card.ne-sample-unavailable {
    opacity: 0.6;
    border-style: dashed;
}
.ne-sample-card.ne-sample-unavailable:hover {
    opacity: 0.85;
}
.ne-sample-download-btn {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 3px 6px;
    font-size: 9px;
    border: 1px solid rgba(255, 170, 0, 0.4);
    border-radius: 4px;
    background: rgba(255, 170, 0, 0.1);
    color: #ffaa00;
    cursor: pointer;
    transition: background 0.15s;
}
.ne-sample-download-btn:hover:not(:disabled) {
    background: rgba(255, 170, 0, 0.25);
}
.ne-sample-download-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}
/* --- Tab bar for Open3D / PyVista --- */
.ne-tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.ne-tab {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 200ms ease;
    text-align: center;
}
.ne-tab:hover {
    color: var(--text-primary);
}
.ne-tab.ne-tab-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
/* Scrollable sample area */
.ne-modal-scroll {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    max-height: 55vh;
    margin-bottom: 12px;
    padding-right: 4px;
}
.ne-modal-scroll::-webkit-scrollbar {
    width: 6px;
}
.ne-modal-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
.ne-modal-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.ne-tab-pane { }
.ne-modal-upload-btn {
    display: block;
    width: 100%;
    padding: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.ne-modal-upload-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(43, 124, 233, 0.06);
}

.ne-modal-dicom-btn {
    border-color: #58a6ff;
    color: #58a6ff;
}
.ne-modal-dicom-btn:hover {
    color: #79c0ff;
    border-color: #79c0ff;
    background: rgba(88, 166, 255, 0.08);
}

/* ==================================================================
   Object List Panel — per-object controls overlay (viewport top-right)
   ================================================================== */

.obj-panel {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 240px;
    max-width: 44%;            /* B5 — shrink on a narrow (right-half) viewport so
                                  the top-left toolbar never has to overlap it */
    max-height: calc(100% - 60px);
    background: rgba(22, 27, 34, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 22;               /* B5 — object selection stays ABOVE the toolbar (20) */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(8px);
    font-size: 12px;
    color: var(--text-primary);
}

.obj-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
}

.obj-panel-title {
    font-weight: 600;
    font-size: 12px;
}

.obj-panel-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.obj-panel-body {
    overflow-y: auto;
    max-height: 400px;
}

.obj-row {
    border-bottom: 1px solid var(--border);
    padding: 6px 8px;
    transition: background var(--transition);
}

.obj-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.obj-row.selected {
    background: rgba(43, 124, 233, 0.08);
    border-left: 2px solid var(--accent);
    padding-left: 6px;
}

.obj-row-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.obj-vis-btn,
.obj-frame-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 3px;
    line-height: 1;
    border-radius: 3px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.obj-vis-btn:active,
.obj-frame-btn:active {
    background: var(--bg-tertiary);
}

.obj-vis-btn:hover,
.obj-frame-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.obj-type-icon {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.obj-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
}

.obj-name:hover {
    color: var(--accent);
}

.obj-row-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 4px;
}

.obj-ctrl {
    min-width: 0;
}

.obj-ctrl label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.obj-ctrl input[type="color"] {
    width: 28px;
    height: 20px;
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.obj-ctrl input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: var(--bg-tertiary);
    border-radius: 2px;
    outline: none;
}

.obj-ctrl input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

.obj-ctrl select {
    width: 100%;
    font-size: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 4px;
    outline: none;
}

.obj-checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    margin-top: 2px;
}

.obj-checkbox-label input[type="checkbox"] {
    width: 12px;
    height: 12px;
    accent-color: var(--accent);
    cursor: pointer;
}

.obj-normals-btn {
    width: 100%;
    font-size: 9px;
    font-weight: 600;
    padding: 3px 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 2px;
}

.obj-normals-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.obj-normals-btn.active {
    background: rgba(43, 124, 233, 0.15);
    color: var(--accent);
    border-color: var(--accent);
}

.obj-normals-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* ==================================================================
   Viewer Toolbar — camera + gizmo + export buttons (viewport top-left)
   ================================================================== */

.viewer-toolbar {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 2px;
    background: rgba(22, 27, 34, 0.88);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3px;
    z-index: 20;
    backdrop-filter: blur(8px);
}

.vt-btn {
    height: 30px;
    min-width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    padding: 0 6px;
    white-space: nowrap;
    transition: all var(--transition);
    position: relative;
}

.vt-btn svg {
    flex-shrink: 0;
}

.vt-label {
    font-size: 10px;
}

.vt-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: #0F1419;
    color: #E6EDF3;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 4px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 100;
}

.vt-btn:hover .vt-tooltip {
    opacity: 1;
}

.vt-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.vt-btn.active {
    background: rgba(43, 124, 233, 0.15);
    color: var(--accent);
    border-color: var(--accent);
}

.vt-separator {
    width: 1px;
    background: var(--border);
    margin: 4px 2px;
}

/* I4 — overflow ("⋯") dropdown for the responsive toolbar */
.vt-overflow-btn { flex-shrink: 0; }
.vt-overflow-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    background: rgba(22, 27, 34, 0.97);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
    backdrop-filter: blur(8px);
    z-index: 60;
    min-width: 140px;
}
.vt-overflow-menu .vt-btn {
    width: 100%;
    justify-content: flex-start;
    height: 28px;
}
/* the toolbar must never grow taller than one row; icons keep their min size */
.viewer-toolbar { max-width: calc(100% - 16px); flex-wrap: nowrap; }
.viewer-toolbar .vt-btn { flex-shrink: 0; }

/* ===== A.3 — Viewer HUD (white MeshLab-style overlay) ===== */
.viewer-hud {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 18;
    text-align: right;
    color: #ffffff;
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    line-height: 1.45;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    user-select: none;
}
.viewer-hud .hud-name { font-weight: 700; }

/* ===== A.1/A.2 — Viewer Settings panel ===== */
.viewer-settings-panel {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 21;
}
.viewer-settings-panel .vsp-toggle {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    background: rgba(22, 27, 34, 0.88);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    backdrop-filter: blur(8px);
}
.viewer-settings-panel .vsp-toggle:hover { color: var(--text-primary); }
.viewer-settings-panel .vsp-body {
    position: absolute;
    bottom: 36px;
    left: 0;
    width: 240px;
    background: rgba(22, 27, 34, 0.96);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.viewer-settings-panel.collapsed .vsp-body { display: none; }
.viewer-settings-panel .vsp-title {
    font-weight: 700;
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.viewer-settings-panel .vsp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    margin: 6px 0;
}
.viewer-settings-panel .vsp-check { justify-content: flex-start; cursor: pointer; }
.viewer-settings-panel .vsp-check kbd {
    margin-left: auto;
    font-size: 9px;
    background: var(--bg-tertiary);
    padding: 1px 4px;
    border-radius: 3px;
}
.viewer-settings-panel input[type="color"] {
    width: 40px; height: 22px; border: 1px solid var(--border);
    border-radius: 3px; background: none; cursor: pointer; padding: 0;
}
.viewer-settings-panel .vsp-sep { height: 1px; background: var(--border); margin: 8px 0; }
.viewer-settings-panel .vsp-restore {
    width: 100%;
    padding: 6px;
    font-size: 11px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
}
.viewer-settings-panel .vsp-restore:hover { background: var(--accent); color: #fff; }

/* ===== C.1/C.2 — MainNav (6-button) ===== */
/* I1 — all 6 entries on ONE horizontal row: equal-width cards, consistent
   icon + label, subtle hover. Below ~1100px the row scrolls horizontally
   (compact icon-cards) instead of wrapping to a second line. */
.main-nav-full {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    max-width: 1180px;
    margin: 24px 0;
}
.main-nav-full .main-nav-btn {
    flex: 1 1 0;
    min-width: 0;                 /* allow equal shrink, no overflow blowout */
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    text-align: center;
    padding: 16px 12px;
    background: var(--bg-secondary, #161B22);
    border: 1px solid var(--border, #30363D);
    border-radius: 10px;
    color: var(--text-primary, #E6EDF3);
    cursor: pointer;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.main-nav-full .main-nav-btn:hover {
    border-color: var(--accent, #2B7CE9);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.main-nav-full .mn-icon svg { width: 28px; height: 28px; color: var(--accent, #2B7CE9); }
.main-nav-full .mn-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.main-nav-full .mn-label { font-weight: 700; font-size: 13px; line-height: 1.25; }
.main-nav-full .mn-desc {
    font-size: 11px; color: var(--text-secondary, #8B949E); line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* Compact icon-cards on narrow viewports: keep ONE row, scroll horizontally. */
@media (max-width: 1100px) {
    .main-nav-full {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        scrollbar-width: thin;
    }
    .main-nav-full .main-nav-btn { flex: 0 0 132px; }
    .main-nav-full .mn-desc { display: none; }
}

.main-nav-compact {
    display: flex; gap: 4px; flex-wrap: wrap;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border, #30363D);
    background: var(--bg-tertiary, #1C2128);
}
.main-nav-compact .main-nav-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 8px; font-size: 10px; font-weight: 600;
    background: none; border: 1px solid transparent; border-radius: 5px;
    color: var(--text-secondary, #8B949E); cursor: pointer;
}
.main-nav-compact .main-nav-btn:hover { background: var(--bg-elevated, #21262D); color: var(--text-primary,#E6EDF3); }
.main-nav-compact .mn-icon svg { width: 14px; height: 14px; }
.main-nav-compact .mn-desc { display: none; }

/* Locked nav entry — same nav for every user; the padlock marks plan limits.
   Still clickable (opens the "Module locked" explainer). */
.main-nav-btn.mn-locked { opacity: 0.5; }
.main-nav-btn.mn-locked:hover { transform: none; box-shadow: none; }
.mn-lock {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    color: var(--text-secondary, #8B949E);
}
.mn-lock svg { width: 11px; height: 11px; }
.app-header.app-header--landing #main-nav-compact .main-nav-btn.mn-locked::after { display: none; }

/* ===== I2/I3/I4 — Global app header (single chrome on every page) ===== */
.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--app-header-h);
    z-index: 36000;            /* above page overlays (mcp 30000, label 35000),
                                  below panel-fullscreen (40000) + project picker (50000) */
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 14px;
    background: var(--bg-secondary, #161B22);
    border-bottom: 1px solid var(--border, #30363D);
    box-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.app-header .ah-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.app-header .ah-title {
    font-weight: 800; font-size: 14px; letter-spacing: .2px;
    color: var(--text-primary, #E6EDF3); white-space: nowrap;
}
.app-header .ah-project {
    display: inline-flex; align-items: center; gap: 6px;
    max-width: 200px; padding: 4px 10px;
    background: var(--bg-tertiary, #1C2128);
    border: 1px solid var(--border, #30363D); border-radius: 6px;
    color: var(--text-secondary, #8B949E); font-size: 11px; font-weight: 600;
    cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-header .ah-project:hover { border-color: var(--accent,#2B7CE9); color: var(--text-primary,#E6EDF3); }
/* the single compact MainNav lives in the header, taking the central space */
.app-header #main-nav-compact {
    flex: 1 1 auto; min-width: 0;
    border-bottom: none; background: none; padding: 0;
    overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin;
    justify-content: center;
}
.app-header .ah-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }

/* B2 — brand logo on the header left, proportional to the 48px header height */
.app-header .ah-logo {
    height: 30px; width: auto; display: block;
    border-radius: 6px; flex-shrink: 0;
}
.app-header .ah-logo-btn {
    background: none; border: none; padding: 3px; border-radius: 8px; cursor: pointer;
    display: inline-flex; align-items: center; transition: background .15s ease, transform .15s ease;
}
.app-header .ah-logo-btn:hover { background: var(--bg-elevated,#21262D); transform: scale(1.04); }
.app-header .ah-logo-btn:focus-visible { outline: 2px solid var(--accent,#2B7CE9); outline-offset: 2px; }

/* ===== B2/B3 — header MODES: premium landing vs compact workspace ===== */
/* Landing mode (REDESIGNED): a taller marketing bar laid out on a 3-column grid
   so the 6 module buttons sit truly CENTERED between the logo (left) and the
   AI-assistant CTA + avatar (right). Buttons are bigger pills — icon + label,
   refined Inter typography, animated underline, glow + elevation on hover,
   visible focus ring. Degrades to horizontal scroll under ~1100px. */
body.landing-header { --app-header-h: 64px; }
.app-header.app-header--landing {
    height: 64px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    padding: 0 22px;
    background: linear-gradient(180deg, rgba(22,27,34,.98), rgba(13,17,23,.96));
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(43,124,233,.14);
}
.app-header.app-header--landing .ah-left { justify-self: start; }
.app-header.app-header--landing .ah-logo { height: 38px; }
.app-header.app-header--landing .ah-right { justify-self: end; margin-left: 0; gap: 12px; }
.app-header.app-header--landing #main-nav-compact {
    justify-self: center;
    flex: 0 1 auto;
    max-width: 100%;
    justify-content: center;
    gap: 8px;
    overflow-x: auto;
}
.app-header.app-header--landing #main-nav-compact .main-nav-btn {
    position: relative;
    display: inline-flex; align-items: center; gap: 9px;
    padding: 11px 18px; border-radius: 12px;
    border: 1px solid transparent;
    /* premium, homogeneous with the Inter-based landing typography */
    font-family: var(--font-family, 'Inter', -apple-system, sans-serif);
    font-size: 13.5px; font-weight: 650; letter-spacing: 0.15px; line-height: 1;
    color: var(--text-secondary,#8B949E);
    transition: color .18s ease, background .18s ease, border-color .18s ease,
                transform .18s ease, box-shadow .18s ease;
}
.app-header.app-header--landing #main-nav-compact .main-nav-btn .mn-label {
    font: inherit; white-space: nowrap;
}
.app-header.app-header--landing #main-nav-compact .main-nav-btn .mn-icon { display: inline-flex; }
.app-header.app-header--landing #main-nav-compact .main-nav-btn .mn-icon svg {
    width: 17px; height: 17px; transition: color .18s ease; opacity: .92;
}
/* animated underline */
.app-header.app-header--landing #main-nav-compact .main-nav-btn::after {
    content: ''; position: absolute; left: 16px; right: 16px; bottom: 5px; height: 2px;
    background: linear-gradient(90deg, var(--accent,#2B7CE9), var(--accent-hover,#62A0EA));
    border-radius: 2px;
    transform: scaleX(0); transform-origin: center; transition: transform .2s ease;
}
.app-header.app-header--landing #main-nav-compact .main-nav-btn:hover {
    color: var(--text-primary,#E6EDF3);
    background: rgba(43,124,233,.10);
    border-color: rgba(43,124,233,.35);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(43,124,233,.22), inset 0 1px 0 rgba(255,255,255,.04);
}
.app-header.app-header--landing #main-nav-compact .main-nav-btn:hover .mn-icon svg { color: var(--accent-hover,#62A0EA); }
.app-header.app-header--landing #main-nav-compact .main-nav-btn:hover::after { transform: scaleX(1); }
.app-header.app-header--landing #main-nav-compact .main-nav-btn:active {
    transform: translateY(0) scale(.985);
    box-shadow: 0 3px 10px rgba(43,124,233,.18);
}
.app-header.app-header--landing #main-nav-compact .main-nav-btn:focus-visible {
    outline: 2px solid var(--accent,#2B7CE9); outline-offset: 2px;
}
@media (max-width: 1280px) {
    .app-header.app-header--landing { gap: 12px; padding: 0 14px; }
    .app-header.app-header--landing #main-nav-compact .main-nav-btn { padding: 10px 13px; font-size: 12.5px; gap: 7px; }
}
@media (max-width: 980px) {
    .app-header.app-header--landing #main-nav-compact .main-nav-btn { padding: 9px 10px; font-size: 12px; }
    .app-header.app-header--landing #main-nav-compact .main-nav-btn .mn-icon svg { width: 15px; height: 15px; }
}

/* AI Assistant header CTA — the highlighted, primary smart entry point. Stands
   out from the nav pills: gradient fill, glow, sparkle icon, inviting microcopy. */
.ah-ai-cta {
    position: relative;
    display: inline-flex; align-items: center; gap: 9px;
    padding: 10px 16px; border-radius: 12px;
    border: 1px solid rgba(155,107,232,.55);
    background: linear-gradient(135deg, rgba(108,63,160,.55), rgba(43,124,233,.40));
    color: #EBDFFF;
    font-family: var(--font-family,'Inter',sans-serif);
    font-size: 13px; font-weight: 650; letter-spacing: .15px; line-height: 1;
    cursor: pointer; white-space: nowrap;
    box-shadow: 0 0 18px rgba(155,107,232,.35), inset 0 1px 0 rgba(255,255,255,.08);
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease, background .2s ease;
    animation: ai-cta-pulse 3.2s ease-in-out infinite;
}
.ah-ai-cta .ai-cta-icon { display: inline-flex; }
.ah-ai-cta .ai-cta-icon svg { width: 16px; height: 16px; color: #C9A8FF; }
.ah-ai-cta:hover {
    transform: translateY(-1px);
    border-color: rgba(181,138,240,.85);
    box-shadow: 0 0 28px rgba(155,107,232,.55), 0 8px 24px rgba(0,0,0,.35);
    animation-play-state: paused;
}
.ah-ai-cta:active { transform: translateY(0) scale(.985); }
.ah-ai-cta:focus-visible { outline: 2px solid #B58AF0; outline-offset: 2px; }
@keyframes ai-cta-pulse {
    0%, 100% { box-shadow: 0 0 14px rgba(155,107,232,.28), inset 0 1px 0 rgba(255,255,255,.08); }
    50%      { box-shadow: 0 0 26px rgba(155,107,232,.5), inset 0 1px 0 rgba(255,255,255,.08); }
}
@media (max-width: 1280px) { .ah-ai-cta .ai-cta-label { display: none; } .ah-ai-cta { padding: 10px 12px; } }
/* The global header is shown ONLY on the landing page. Module pages have no
   header at all — they keep their own in-page chrome (input selection toolbar,
   node-editor toolbar) plus the collapsed project-sidebar rail (Home + projects)
   on the left. */

/* Home icon button — the in-page Home control on the overlay pages (MCP / Label)
   that returns to the landing. */
.page-home-btn {
    width: 34px; height: 34px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-tertiary,#1C2128); border: 1px solid var(--border,#30363D);
    color: var(--text-secondary,#8B949E); cursor: pointer; flex-shrink: 0;
    transition: color .15s ease, border-color .15s ease, background .15s ease, transform .15s ease;
}
.page-home-btn:hover {
    color: var(--text-primary,#E6EDF3); border-color: var(--accent,#2B7CE9);
    background: var(--bg-elevated,#21262D); transform: translateY(-1px);
}
.page-home-btn:focus-visible { outline: 2px solid var(--accent,#2B7CE9); outline-offset: 2px; }

/* ===== B2 — Nav explainer popup (centered, dismissible, keyboard-accessible) ===== */
.nav-info-overlay {
    position: fixed; inset: 0; z-index: 52000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(6,9,12,.62); backdrop-filter: blur(4px);
    padding: 24px;
}
.nav-info-dialog {
    position: relative;
    width: 100%; max-width: 460px;
    background: var(--bg-secondary,#161B22);
    border: 1px solid var(--border,#30363D);
    border-radius: 14px;
    padding: 28px 26px 22px;
    box-shadow: 0 24px 70px rgba(0,0,0,.6);
    text-align: center;
    transform: translateY(8px) scale(.97); opacity: 0;
    transition: transform .2s cubic-bezier(.2,.8,.2,1), opacity .2s ease;
}
.nav-info-dialog.is-open { transform: translateY(0) scale(1); opacity: 1; }
.nav-info-close {
    position: absolute; top: 10px; right: 12px;
    background: none; border: none; color: var(--text-muted,#8B949E);
    font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px;
    transition: color .15s ease, background .15s ease;
}
.nav-info-close:hover { color: var(--text-primary,#E6EDF3); background: var(--bg-tertiary,#1C2128); }
.nav-info-icon {
    width: 56px; height: 56px; margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px;
    background: rgba(43,124,233,.12); border: 1px solid rgba(43,124,233,.3);
}
.nav-info-icon svg { width: 28px; height: 28px; color: var(--accent-hover,#62A0EA); }
.nav-info-title { font-size: 18px; font-weight: 700; color: var(--text-primary,#E6EDF3); margin: 0 0 10px; }
.nav-info-blurb { font-size: 13px; line-height: 1.65; color: var(--text-secondary,#8B949E); margin: 0 0 22px; }
.nav-info-actions { display: flex; gap: 10px; justify-content: center; }
.nav-info-actions button {
    padding: 9px 16px; font-size: 13px; font-weight: 600; border-radius: 8px;
    cursor: pointer; transition: all .15s ease; border: 1px solid transparent;
}
.nav-info-cancel {
    background: var(--bg-tertiary,#1C2128); border-color: var(--border,#30363D); color: var(--text-secondary,#8B949E);
}
.nav-info-cancel:hover { color: var(--text-primary,#E6EDF3); border-color: var(--text-muted,#484F58); }
.nav-info-open {
    background: var(--accent,#2B7CE9); color: #fff;
    box-shadow: 0 4px 14px rgba(43,124,233,.35);
}
.nav-info-open:hover { background: var(--accent-hover,#62A0EA); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(43,124,233,.45); }
.nav-info-open:focus-visible, .nav-info-cancel:focus-visible, .nav-info-close:focus-visible {
    outline: 2px solid var(--accent,#2B7CE9); outline-offset: 2px;
}

/* When the header is present (authenticated), offset every page root below it. */
body.has-app-header #home-view,
body.has-app-header #workspace-app { height: calc(100vh - var(--app-header-h)); margin-top: var(--app-header-h); }
body.has-app-header .mcp-key-page,
body.has-app-header .label-module { top: var(--app-header-h); }

/* I4 — the avatar/logout button moves OUT of a floating fixed position and
   INTO the global header (top-right). Nothing renders over the viewport. */
#ah-avatar-slot .auth-user-btn {
    position: static;
    top: auto; right: auto;
    width: 34px; height: 34px;
    z-index: auto;
}

/* Panel fullscreen icon buttons (C.4) */
.panel-fs-btn {
    position: absolute; top: 8px; right: 8px; z-index: 30;
    width: 26px; height: 26px; border-radius: 5px;
    background: rgba(22,27,34,.85); border: 1px solid var(--border,#30363D);
    color: var(--text-secondary,#8B949E); cursor: pointer; font-size: 13px;
}
.panel-fs-btn:hover { color: var(--text-primary,#E6EDF3); }
#left-panel { position: relative; }

/* B6 — per-window fullscreen toggle, anchored at the window's BOTTOM-RIGHT
   (node editor + MeshLab viewer each own one; no longer in the header). */
.panel-fs-corner-btn {
    position: absolute; bottom: 12px; right: 12px; z-index: 32;
    width: 34px; height: 34px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(22,27,34,.9); border: 1px solid var(--border,#30363D);
    color: var(--text-secondary,#8B949E); cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0,0,0,.35);
    transition: color .15s ease, border-color .15s ease, transform .15s ease, background .15s ease;
}
.panel-fs-corner-btn:hover {
    color: var(--text-primary,#E6EDF3); border-color: var(--accent,#2B7CE9);
    background: var(--bg-tertiary,#1C2128); transform: translateY(-1px);
}
.panel-fs-corner-btn:focus-visible { outline: 2px solid var(--accent,#2B7CE9); outline-offset: 2px; }
/* the right viewport sits above the global AI chat bubble (bottom-right) so the
   fullscreen toggle is never hidden behind it */
#right-fullscreen-btn { bottom: 78px; }

/* Independent fullscreen 2D page (pose) — hide the right viewport (C.1 #4) */
#workspace-view.viewer-leftonly #right-panel { display: none; }
#workspace-view.viewer-leftonly #left-panel { width: 100%; flex: 1 1 100%; }

body.modal-open { overflow: hidden; }

/* ===== C.3 / quality pass — premium blocking project picker modal ===== */
.project-picker-overlay {
    position: fixed; inset: 0; z-index: 50000;
    background: rgba(6,9,12,.72); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.project-picker-dialog {
    width: 480px; max-width: 100%; max-height: 86vh; overflow: auto;
    background: linear-gradient(180deg, var(--bg-secondary,#161B22), var(--bg-primary,#0F1419));
    border: 1px solid var(--border,#30363D);
    border-radius: 16px; padding: 26px;
    box-shadow: 0 28px 80px rgba(0,0,0,.65);
    animation: pp-pop .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes pp-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

.project-picker-dialog .pp-header { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.pp-header-icon {
    flex-shrink: 0; width: 44px; height: 44px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(43,124,233,.12); border: 1px solid rgba(43,124,233,.3);
    color: var(--accent-hover,#62A0EA);
}
.pp-header-text { min-width: 0; }
.project-picker-dialog .pp-header h3 { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--text-primary,#E6EDF3); }
.project-picker-dialog .pp-header p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary,#8B949E); }

.pp-section-label {
    font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
    color: var(--text-muted,#8B949E); margin: 0 2px 8px;
}
.pp-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; max-height: 300px; overflow: auto; }
.pp-loading { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-secondary,#8B949E); padding: 10px 4px; }
.pp-spinner {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid var(--border,#30363D); border-top-color: var(--accent,#2B7CE9);
    animation: pp-spin .7s linear infinite;
}
@keyframes pp-spin { to { transform: rotate(360deg); } }
.pp-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    background: var(--bg-tertiary,#1C2128);
    border: 1px solid var(--border,#30363D); border-radius: 10px;
    cursor: pointer; color: var(--text-primary,#E6EDF3); text-align: left; width: 100%;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.pp-item:hover {
    border-color: var(--accent,#2B7CE9); transform: translateY(-1px);
    background: var(--bg-elevated,#21262D);
    box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.pp-item:focus-visible { outline: 2px solid var(--accent,#2B7CE9); outline-offset: 2px; }
.pp-thumb {
    flex-shrink: 0; width: 36px; height: 36px; border-radius: 9px;
    background: linear-gradient(135deg, var(--accent,#2B7CE9), #1f5fbf); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.pp-meta { display: flex; flex-direction: column; min-width: 0; }
.pp-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-date { font-size: 11px; color: var(--text-secondary,#8B949E); }
.pp-empty { font-size: 12.5px; color: var(--text-secondary,#8B949E); padding: 14px 8px; text-align: center; }

.pp-divider {
    display: flex; align-items: center; text-align: center;
    color: var(--text-muted,#8B949E); font-size: 11px; margin: 4px 0 14px;
}
.pp-divider::before, .pp-divider::after { content: ''; flex: 1; height: 1px; background: var(--border,#30363D); }
.pp-divider span { padding: 0 12px; }

.pp-create { display: flex; gap: 8px; }
.pp-new-name {
    flex: 1; min-width: 0; padding: 10px 12px; background: var(--bg-primary,#0F1419);
    border: 1px solid var(--border,#30363D); border-radius: 9px; color: var(--text-primary,#E6EDF3);
    font-size: 13px; transition: border-color .15s ease, box-shadow .15s ease;
}
.pp-new-name::placeholder { color: var(--text-muted,#8B949E); }
.pp-new-name:focus { outline: none; border-color: var(--accent,#2B7CE9); box-shadow: 0 0 0 3px rgba(43,124,233,.18); }
.pp-create-btn {
    padding: 10px 16px; background: var(--accent,#2B7CE9); color: #fff; border: none;
    border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap;
    box-shadow: 0 4px 14px rgba(43,124,233,.32); transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.pp-create-btn:hover { background: var(--accent-hover,#62A0EA); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(43,124,233,.42); }
.pp-create-btn:focus-visible, .pp-new-name:focus-visible { outline: 2px solid var(--accent,#2B7CE9); outline-offset: 2px; }
.pp-error { margin-top: 12px; color: #ff7b72; font-size: 12.5px; }

/* ===== C.4 — panel fullscreen popup ===== */
.panel-fullscreen-overlay {
    position: fixed; inset: 0; z-index: 40000;
    background: rgba(0,0,0,.78); display: flex; align-items: center; justify-content: center;
}
.pfs-dialog { width: 95vw; height: 95vh; background: var(--bg-primary,#0F1419);
    border: 1px solid var(--border,#30363D); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.pfs-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px;
    border-bottom: 1px solid var(--border,#30363D); background: var(--bg-tertiary,#1C2128); }
.pfs-title { font-size: 12px; font-weight: 700; color: var(--text-primary,#E6EDF3); }
.pfs-actions button { width: 28px; height: 28px; margin-left: 4px; background: none;
    border: 1px solid var(--border,#30363D); border-radius: 5px; color: var(--text-secondary,#8B949E); cursor: pointer; }
.pfs-actions button:hover { color: var(--text-primary,#E6EDF3); }
.pfs-content { flex: 1; position: relative; overflow: hidden; display: flex; }
.pfs-content > * { flex: 1; width: 100%; height: 100%; }

/* ===== C.1 #5 — MCP Key page ===== */
.mcp-key-page { position: fixed; inset: 0; z-index: 30000; background: var(--bg-primary,#0F1419);
    overflow: auto; padding: 0; display: flex; flex-direction: column; }
/* thin module bar at the top; the clickable logo returns to the landing */
.mkp-topbar .module-bar-logo { background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 7px; }
.mkp-topbar .module-bar-logo:hover { background: var(--bg-elevated,#21262D); }
.module-bar-logoimg { height: 24px; width: auto; border-radius: 5px; }
.mkp-header { max-width: 760px; width: 100%; margin: 28px auto 20px; padding: 0 24px; }
.mkp-header h2 { margin: 0 0 4px; color: var(--text-primary,#E6EDF3); }
.mkp-header p { margin: 0; color: var(--text-secondary,#8B949E); font-size: 13px; }
.mkp-body { max-width: 760px; width: 100%; margin: 0 auto; padding: 0 24px 32px; box-sizing: border-box; }
.mkp-generate { display: flex; gap: 8px; margin-bottom: 16px; }
.mkp-name { flex: 1; padding: 9px 12px; background: var(--bg-secondary,#161B22);
    border: 1px solid var(--border,#30363D); border-radius: 7px; color: var(--text-primary,#E6EDF3); }
.mkp-gen-btn { padding: 9px 16px; background: var(--accent,#2B7CE9); color: #fff; border: none; border-radius: 7px; cursor: pointer; font-weight: 600; }
.mkp-new-key { background: rgba(45,164,78,.1); border: 1px solid var(--success,#2DA44E); border-radius: 8px; padding: 12px; margin-bottom: 18px; }
.mkp-new-key-warn { font-size: 12px; color: var(--warning,#D29922); margin-bottom: 8px; }
.mkp-new-key-row { display: flex; gap: 8px; align-items: center; }
.mkp-new-key-value { flex: 1; font-family: var(--font-mono,monospace); font-size: 13px; color: var(--text-primary,#E6EDF3); word-break: break-all; }
.mkp-copy-btn { padding: 6px 12px; background: var(--bg-elevated,#21262D); border: 1px solid var(--border,#30363D); border-radius: 6px; color: var(--text-primary,#E6EDF3); cursor: pointer; }
.mkp-list-title { font-weight: 700; font-size: 13px; color: var(--text-primary,#E6EDF3); margin: 8px 0; }
.mkp-list { display: flex; flex-direction: column; gap: 6px; }
.mkp-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--bg-secondary,#161B22);
    border: 1px solid var(--border,#30363D); border-radius: 7px; font-size: 12px; }
.mkp-item.revoked { opacity: .5; }
.mkp-item-name { font-weight: 600; color: var(--text-primary,#E6EDF3); min-width: 110px; }
.mkp-item-key { font-family: var(--font-mono,monospace); color: var(--text-secondary,#8B949E); }
.mkp-item-date { margin-left: auto; color: var(--text-muted,#484F58); font-size: 11px; }
.mkp-revoke-btn { padding: 4px 10px; background: none; border: 1px solid var(--error,#CF222E); color: var(--error,#CF222E); border-radius: 6px; cursor: pointer; }
.mkp-empty { font-size: 12px; color: var(--text-secondary,#8B949E); padding: 8px; }
.mkp-setup { margin-top: 24px; }
.mcp-setup-title { font-weight: 700; font-size: 15px; color: var(--text-primary,#E6EDF3); margin-bottom: 4px; }
.mcp-setup-sub { font-size: 12px; color: var(--text-secondary,#8B949E); margin: 0 0 14px; }
.mcp-setup-block { margin-bottom: 14px; }
.mcp-setup-h { font-size: 12px; font-weight: 600; color: var(--text-primary,#E6EDF3); margin-bottom: 6px; }
.mcp-code { position: relative; background: #0a0d12; border: 1px solid var(--border,#30363D); border-radius: 7px; padding: 10px 12px; }
.mcp-code pre { margin: 0; font-family: var(--font-mono,monospace); font-size: 12px; color: #cfe3ff; white-space: pre-wrap; word-break: break-all; }
.mcp-copy { position: absolute; top: 6px; right: 6px; padding: 3px 8px; font-size: 11px; background: var(--bg-elevated,#21262D); border: 1px solid var(--border,#30363D); border-radius: 5px; color: var(--text-secondary,#8B949E); cursor: pointer; }
.mcp-copy:hover { color: #fff; }
.mcp-setup-note { margin: 0 0 6px; font-size: 11px; color: var(--text-secondary,#8B949E); }
.mcp-code + .mcp-code { margin-top: 8px; }
.mcp-setup-err { color: var(--error,#CF222E); font-size: 12px; }

/* Part H — terminal-aware install instructions */
.mcp-banner { font-size: 12px; border-radius: 7px; padding: 8px 12px; margin-bottom: 16px; border: 1px solid transparent; }
.mcp-banner code { font-family: var(--font-mono,monospace); background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 4px; color: #cfe3ff; }
.mcp-banner.warn { background: rgba(210,153,34,.10); border-color: rgba(210,153,34,.45); color: var(--warning,#D29922); }
.mcp-banner.ok { background: rgba(45,164,78,.10); border-color: rgba(45,164,78,.45); color: var(--success,#2DA44E); }
.mcp-method { border: 1px solid var(--border,#30363D); border-radius: 9px; padding: 14px 14px 4px; margin-bottom: 14px; background: rgba(255,255,255,.015); }
.mcp-method-h { font-size: 13px; font-weight: 700; color: var(--text-primary,#E6EDF3); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.mcp-method-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--accent,#2B7CE9); background: rgba(43,124,233,.14); border: 1px solid rgba(43,124,233,.4); padding: 2px 7px; border-radius: 999px; }
.mcp-setup-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mcp-where { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.mcp-where::before { margin-right: 4px; }
.mcp-where-terminal { color: #9ad1ff; background: rgba(43,124,233,.10); border-color: rgba(43,124,233,.35); }
.mcp-where-terminal::before { content: '\25B8'; } /* shell prompt */
.mcp-where-claude { color: #c9a6ff; background: rgba(150,90,255,.10); border-color: rgba(150,90,255,.35); }
.mcp-where-claude::before { content: '\2731'; } /* Claude Code */
.mcp-where-file { color: #8B949E; background: rgba(139,148,158,.10); border-color: rgba(139,148,158,.35); }
.mcp-where-file::before { content: '\1F4C4'; }
.mcp-os { display: inline-flex; gap: 4px; margin-bottom: 6px; }
.mcp-os-btn { font-size: 11px; padding: 3px 10px; border-radius: 6px; cursor: pointer; background: var(--bg-elevated,#21262D); border: 1px solid var(--border,#30363D); color: var(--text-secondary,#8B949E); }
.mcp-os-btn.active { color: #fff; border-color: var(--accent,#2B7CE9); background: rgba(43,124,233,.18); }
.mcp-alt { margin-top: 8px; }
.mcp-alt > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-secondary,#8B949E); padding: 4px 0; }
.mcp-alt > summary:hover { color: var(--text-primary,#E6EDF3); }
.mcp-alt[open] > summary { margin-bottom: 10px; }

/* ===== Part D — Label Assignment module ===== */
.label-module { position: fixed; inset: 0; z-index: 35000; background: #000; display: flex; flex-direction: column; }
.label-module .lm-viewport { position: absolute; inset: 0; }
.label-module .lm-canvas { width: 100%; height: 100%; display: block; }
.label-module .lm-cursor {
    position: absolute; border: 2px solid #fff; border-radius: 50%;
    transform: translate(-50%, -50%); pointer-events: none; mix-blend-mode: difference; display: none;
}
/* Shared thin module header bar (homogeneous across MCP / GPU / Label —
   same thickness/look as the Registration Studio header). */
.module-bar {
    display: flex; align-items: center; gap: 8px;
    min-height: 52px; padding: 8px 12px; box-sizing: border-box;
    background: linear-gradient(180deg, #161B22 0%, #12171E 100%);
    border-bottom: 1px solid rgba(255,255,255,.06);
    box-shadow: 0 2px 12px rgba(0,0,0,.35);
    overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
}
.module-bar-logo { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #E6EDF3; white-space: nowrap; user-select: none; }
.module-bar-logo svg { color: var(--accent-hover,#62A0EA); flex-shrink: 0; }
/* Reset action pinned to the right of a module bar (homogeneous icon button) */
.module-bar-reset, .imgproc-reset-btn {
    margin-left: auto; flex-shrink: 0;
    width: 32px; height: 32px; border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-tertiary,#1C2128); border: 1px solid var(--border,#30363D);
    color: var(--text-secondary,#8B949E); cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease, transform .15s ease;
}
.module-bar-reset:hover, .imgproc-reset-btn:hover {
    color: var(--text-primary,#E6EDF3); border-color: var(--accent,#2B7CE9);
    background: var(--bg-elevated,#21262D); transform: translateY(-1px);
}
.module-bar-reset:focus-visible, .imgproc-reset-btn:focus-visible { outline: 2px solid var(--accent,#2B7CE9); outline-offset: 2px; }

/* Label module: a project sidebar rail (full height) sits on the LEFT with the
   logo-home at its top — consistent with the other workspace pages; the tools
   live in a top header bar (.lm-topbar) to the RIGHT of the rail. */
.label-module .lm-topbar {
    position: absolute; top: 0; left: 48px; right: 0; z-index: 6;
}
.label-module .lm-topbar button {
    min-width: 30px; height: 30px; background: none; border: 1px solid transparent; border-radius: 5px;
    color: var(--text-secondary,#8B949E); cursor: pointer; font-size: 13px; padding: 0 8px; flex-shrink: 0;
}
.label-module .lm-topbar button:hover { color: #fff; background: var(--bg-elevated,#21262D); }
.label-module .lm-topbar button.active { color: var(--accent,#2B7CE9); border-color: var(--accent,#2B7CE9); }
.label-module .lm-sep { width: 1px; height: 20px; background: var(--border,#30363D); margin: 0 4px; flex-shrink: 0; }
/* Full-height project sidebar rail on the left (logo-home at top), collapsed by
   default; sits ABOVE the topbar so expanding it overlays the tools cleanly. */
.label-module #lm-sidebar { position: absolute; left: 0; top: 0; bottom: 0; width: 260px; z-index: 9; }
.label-module #lm-sidebar.ps-collapsed { width: 48px; }
/* viewport sits BELOW the topbar and to the RIGHT of the collapsed sidebar rail */
.label-module .lm-viewport { top: 52px; left: 48px; }
.label-module .lm-radius { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-secondary,#8B949E); }
/* I11 — fixed-width, tabular value box so dragging the brush slider changes ONLY
   the cursor radius and never reflows the centered toolbar. */
.label-module .lm-radius-input { width: 90px; flex: 0 0 90px; }
.label-module .lm-radius-val {
    display: inline-block; width: 3ch; text-align: right;
    font-variant-numeric: tabular-nums; flex: 0 0 3ch;
}
.label-module .lm-palette {
    position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 5px; z-index: 5; background: rgba(22,27,34,.92);
    border: 1px solid var(--border,#30363D); border-radius: 8px; padding: 6px 8px; flex-wrap: wrap; max-width: 90vw;
}
.label-module .lm-swatch { width: 24px; height: 24px; border-radius: 5px; border: 2px solid transparent; cursor: pointer; }
.label-module .lm-swatch.active { border-color: #fff; }
.label-module .lm-eraser { background: #333; color: #fff; }
.label-module .lm-custom { width: 26px; height: 26px; border: none; background: none; cursor: pointer; padding: 0; }
.label-module .lm-status { position: absolute; bottom: 14px; right: 16px; color: #fff; font-size: 12px; z-index: 5; text-shadow: 0 1px 2px #000; }
/* I10 — label naming + 3D box panel */
.label-module .lm-name-edit { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-secondary,#8B949E); }
.label-module .lm-label-name {
    width: 110px; padding: 3px 6px; font-size: 11px;
    background: var(--bg-primary,#0F1419); border: 1px solid var(--border,#30363D);
    border-radius: 5px; color: var(--text-primary,#E6EDF3);
}
.label-module .lm-boxes-panel {
    position: absolute; top: 64px; right: 14px; width: 190px; max-height: 46vh; overflow: auto;
    background: rgba(22,27,34,.92); border: 1px solid var(--border,#30363D); border-radius: 8px;
    padding: 8px; z-index: 5;
}
.label-module .lm-boxes-title { font-size: 11px; font-weight: 700; color: var(--text-secondary,#8B949E); margin-bottom: 6px; }
.label-module .lm-boxes-empty { font-size: 11px; color: var(--text-muted,#484F58); }
.label-module .lm-box-row {
    display: flex; align-items: center; gap: 6px; padding: 4px 5px; border-radius: 5px;
    color: var(--text-primary,#E6EDF3); font-size: 11px; cursor: pointer;
}
.label-module .lm-box-row.active { background: rgba(43,124,233,.18); }
.label-module .lm-box-row:hover { background: var(--bg-elevated,#21262D); }
.label-module .lm-box-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.label-module .lm-box-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-module .lm-box-vis, .label-module .lm-box-del {
    background: none; border: none; color: var(--text-secondary,#8B949E); cursor: pointer; font-size: 11px; padding: 0 2px;
}
.label-module .lm-box-del:hover { color: var(--error,#CF222E); }
.label-module .lm-rubber-band { position: absolute; border: 1px dashed #fff; background: rgba(255,255,255,.08); pointer-events: none; z-index: 4; }
.label-module .lm-picker { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10; background: rgba(0,0,0,.6); }
.label-module .lm-picker-card { width: 420px; max-width: 92vw; max-height: 80vh; overflow: auto; background: var(--bg-secondary,#161B22); border: 1px solid var(--border,#30363D); border-radius: 12px; padding: 20px; }
.label-module .lm-picker-card h3 { margin: 0 0 12px; color: var(--text-primary,#E6EDF3); }
.label-module .lm-picker-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.label-module .lm-picker-item { padding: 8px 10px; background: var(--bg-tertiary,#1C2128); border: 1px solid var(--border,#30363D); border-radius: 7px; color: var(--text-primary,#E6EDF3); cursor: pointer; text-align: left; }
.label-module .lm-picker-item:hover { border-color: var(--accent,#2B7CE9); }
.label-module .lm-picker-upload { font-size: 12px; color: var(--text-secondary,#8B949E); }

/* ===== B.1 — shared body-portal tooltip (flip/clamp, never clipped) ===== */
.app-tooltip {
    position: fixed;
    z-index: 100000;
    padding: 4px 8px;
    background: #0F1419;
    color: #E6EDF3;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 4px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* ===== A.6 — selection rubber-band (1px dashed) ===== */
.selection-rubber-band {
    position: absolute;
    border: 1px dashed #ffffff;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
    z-index: 19;
}



/* Workflow selector overlay scrollbar */
.workflow-selector-menu::-webkit-scrollbar {
    width: 8px;
}

.workflow-selector-menu::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}

.workflow-selector-menu::-webkit-scrollbar-thumb {
    background: rgba(43, 124, 233, 0.5);
    border-radius: 4px;
}

.workflow-selector-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(43, 124, 233, 0.7);
}

/* =========================================
   AUTH — User button, menu, modal
   ========================================= */

.auth-user-btn {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 500;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 200ms ease;
}
.auth-user-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}
.auth-avatar {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.5px;
}

/* User dropdown menu */
.auth-user-menu {
    position: fixed;
    z-index: 10001;
    min-width: 220px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 0;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}
.auth-menu-info {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.auth-menu-info strong {
    font-size: 14px;
    color: var(--text-primary);
}
.auth-menu-info span {
    font-size: 12px;
    color: var(--text-secondary);
}
.auth-menu-sep {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
.auth-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 150ms ease;
}
.auth-menu-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.auth-menu-logout:hover {
    color: #cf222e;
}
.auth-menu-plan {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}
.auth-plan-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg-tertiary, #1C2128);
    color: var(--text-secondary, #8B949E);
    border: 1px solid var(--border, #30363D);
}
.auth-plan-badge.pro {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
    border-color: transparent;
}
.auth-plan-renew {
    font-size: 11px;
    color: var(--text-secondary, #8B949E);
}
.auth-menu-upgrade {
    color: #c4b5fd;
    font-weight: 600;
}
.auth-menu-upgrade:hover {
    background: rgba(124, 58, 237, 0.12);
    color: #ddd6fe;
}

/* Auth modal */
.auth-modal {
    min-width: 380px;
    max-width: 420px;
}
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.auth-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 200ms ease;
}
.auth-tab:hover { color: var(--text-primary); }
.auth-tab-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.auth-form-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.auth-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.auth-input {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 200ms ease;
}
.auth-input:focus {
    border-color: var(--accent);
}
.auth-error {
    color: #cf222e;
    font-size: 13px;
    min-height: 18px;
}
.auth-submit-btn {
    padding: 11px 0;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms ease;
    margin-top: 4px;
}
.auth-submit-btn:hover:not(:disabled) {
    filter: brightness(1.1);
}
.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== LEFT PANEL SUB-TAB BAR ===== */
#left-tab-bar {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    background: var(--bg-primary, #0F1419);
    border-bottom: 1px solid var(--border-color, #30363D);
    flex-shrink: 0;
}
.left-tab-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted, #484F58);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.left-tab-btn:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary, #8B949E);
}
.left-tab-btn.active {
    background: rgba(43,124,233,0.12);
    color: var(--accent, #2B7CE9);
}
.left-tab-btn svg {
    flex-shrink: 0;
}

/* ===== IMAGE PROCESSING TAB ===== */
.imgproc-panel {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    overflow-y: auto;
}
.imgproc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #E6EDF3);
}
.imgproc-header svg {
    color: var(--accent, #2B7CE9);
}
/* GPU pages (generation / pose) — header as a consistent thin module bar that
   spans the full panel width (negate the panel's 16px padding at the top). */
.imgproc-header.module-bar {
    margin: -16px -16px 4px;
    font-size: 13px;
}

/* Upload slots */
.imgproc-uploads {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.imgproc-upload-slot {
    position: relative;
}
.imgproc-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px 10px;
    border: 2px dashed rgba(255,255,255,0.12);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 100px;
}
.imgproc-drop span {
    font-size: 11px;
    color: var(--text-muted, #484F58);
}
.imgproc-drop:hover, .imgproc-drop.drag-over {
    border-color: var(--accent, #2B7CE9);
    background: rgba(43,124,233,0.06);
}
.imgproc-preview {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color, #30363D);
}
.imgproc-preview img {
    width: 100%;
    height: auto;
    max-height: 140px;
    object-fit: cover;
    display: block;
}
.imgproc-filename {
    padding: 4px 8px;
    font-size: 10px;
    color: var(--text-secondary, #8B949E);
    background: var(--bg-secondary, #161B22);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.imgproc-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Method selector */
.imgproc-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #8B949E);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
}
.imgproc-select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color, #30363D);
    background: var(--bg-secondary, #161B22);
    color: var(--text-primary, #E6EDF3);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}
.imgproc-method-desc {
    font-size: 11px;
    color: var(--text-muted, #484F58);
    margin-top: 4px;
    min-height: 14px;
}

/* Params */
.imgproc-param-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.imgproc-param-row label {
    font-size: 12px;
    color: var(--text-secondary, #8B949E);
    min-width: 80px;
}
.imgproc-param-row input {
    flex: 1;
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color, #30363D);
    background: var(--bg-secondary, #161B22);
    color: var(--text-primary, #E6EDF3);
    font-size: 12px;
    font-family: inherit;
}

/* Run button */
.imgproc-run-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #2B7CE9, #1a5fb4);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.imgproc-run-btn:hover:not(:disabled) {
    filter: brightness(1.15);
}
.imgproc-run-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status */
.imgproc-status {
    font-size: 11px;
    color: var(--text-muted, #484F58);
    min-height: 16px;
}

/* Result */
.imgproc-result {
    border-top: 1px solid var(--border-color, #30363D);
    padding-top: 12px;
}
.imgproc-result-img {
    width: 100%;
    border-radius: 6px;
    border: 1px solid var(--border-color, #30363D);
    margin-top: 6px;
}
.imgproc-zip-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: var(--bg-secondary, #161B22);
    border-radius: 6px;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary, #8B949E);
}
.imgproc-result-info {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-secondary, #161B22);
    border-radius: 4px;
    font-size: 11px;
    font-family: var(--font-mono, monospace);
    color: var(--text-secondary, #8B949E);
    white-space: pre-wrap;
    max-height: 120px;
    overflow-y: auto;
}
.imgproc-download-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 14px;
    border-radius: 4px;
    background: rgba(43,124,233,0.15);
    color: var(--accent, #2B7CE9);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}
.imgproc-download-btn:hover {
    background: rgba(43,124,233,0.25);
}

/* Service selector bar */
.imgproc-service-bar {
    display: flex;
    gap: 4px;
    padding: 3px;
    background: var(--bg-secondary, #161B22);
    border-radius: 8px;
    border: 1px solid var(--border-color, #30363D);
}
.imgproc-service-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted, #484F58);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.imgproc-service-btn:hover {
    color: var(--text-secondary, #8B949E);
    background: rgba(255,255,255,0.04);
}
.imgproc-service-btn.active {
    color: var(--text-primary, #E6EDF3);
    background: var(--bg-tertiary, #1C2128);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Full-width upload slot for Trellis */
.imgproc-upload-full {
    grid-column: 1 / -1;
}

/* Trellis generate button accent */
.trellis-run-btn {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
}

/* Spinning icon for loading */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.spin-icon {
    animation: spin 1s linear infinite;
}

/* Trellis result section */
.trellis-result {
    border-top: 1px solid var(--border-color, #30363D);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Video container */
.trellis-video-container {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color, #30363D);
    background: #000;
}
.trellis-video-container video {
    width: 100%;
    display: block;
    max-height: 240px;
    object-fit: contain;
}

/* Trellis download buttons */
.trellis-downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.trellis-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 4px;
    background: rgba(124,58,237,0.15);
    color: #a78bfa;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}
.trellis-dl-btn:hover {
    background: rgba(124,58,237,0.25);
}

/* Trellis progress bar */
.trellis-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-tertiary, #1C2128);
    border: 1px solid var(--border-color, #30363D);
}
.trellis-progress[hidden] {
    display: none !important;
}
.trellis-progress-bar-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(124,58,237,0.15);
    overflow: hidden;
}
.trellis-progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    width: 0%;
    transition: width 0.5s ease;
}
.trellis-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-secondary, #8B949E);
}
.trellis-progress-stage {
    display: flex;
    align-items: center;
    gap: 6px;
}
.trellis-progress-stage .spin-icon {
    width: 12px;
    height: 12px;
}
.trellis-progress-pct {
    font-variant-numeric: tabular-nums;
    color: #a78bfa;
    font-weight: 500;
}

.methods-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Trellis activation popup */
.trellis-activation-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    backdrop-filter: blur(4px);
}
.trellis-activation-dialog {
    background: var(--bg-secondary, #161B22);
    border: 1px solid var(--border-color, #30363D);
    border-radius: 12px;
    padding: 32px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.trellis-activation-icon {
    color: #a78bfa;
    margin-bottom: 4px;
}
.trellis-activation-icon.activating {
    color: #60a5fa;
}
.trellis-activation-icon.error {
    color: #ef4444;
}
.trellis-activation-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #E6EDF3);
}
.trellis-activation-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary, #8B949E);
    line-height: 1.5;
}
.trellis-activation-note {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted, #484F58);
    font-style: italic;
}
.trellis-activate-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}
.trellis-activate-btn:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
.trellis-cancel-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary, #8B949E);
    font-size: 13px;
    cursor: pointer;
    padding: 6px 16px;
}
.trellis-cancel-btn:hover {
    color: var(--text-primary, #E6EDF3);
}
.trellis-activation-progress {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.trellis-activation-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}
.trellis-activation-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s ease;
}
.trellis-activation-progress-label {
    font-size: 12px;
    color: var(--text-secondary, #8B949E);
}

/* ===== AI Assistant full-page (Claude-Code-like agent experience) ===== */
.assistant-page {
    position: fixed;
    inset: 0;
    z-index: 35000;           /* same tier as the label module overlay */
    display: flex;
    flex-direction: column;
    background: var(--bg-primary, #0F1419);
    font-family: var(--font-family, 'Inter', sans-serif);
}
.assistant-page .ap-header {
    display: flex; align-items: center; gap: 12px;
    height: 46px; padding: 0 14px;
    background: var(--bg-secondary, #161B22);
    border-bottom: 1px solid var(--border, #30363D);
    flex: none;
}
.assistant-page .ap-logo { height: 26px; width: auto; display: block; border-radius: 5px; }
.assistant-page .ap-home { background: none; border: none; padding: 3px; cursor: pointer; border-radius: 8px; display: inline-flex; }
.assistant-page .ap-home:hover { background: var(--bg-elevated, #21262D); }
.assistant-page .ap-home:focus-visible { outline: 2px solid var(--accent, #2B7CE9); outline-offset: 2px; }
.assistant-page .ap-title {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 13px; font-weight: 700; color: var(--text-primary, #E6EDF3);
}
.assistant-page .ap-title svg { color: #B58AF0; }
.assistant-page .ap-sub { font-size: 11px; color: var(--text-secondary, #8B949E); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assistant-page .ap-body { flex: 1; display: flex; min-height: 0; }
.assistant-page .ap-sidebar {
    width: 280px; flex: none;
    display: flex; flex-direction: column;
    background: var(--bg-secondary, #161B22);
    border-right: 1px solid var(--border, #30363D);
    overflow-y: auto;
}
.assistant-page .ap-side-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px 8px;
    font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
    color: var(--text-secondary, #8B949E);
}
.assistant-page .ap-new-btn {
    padding: 5px 10px; border-radius: 7px; font-size: 11.5px; font-weight: 650;
    background: rgba(155,107,232,.16); color: #C9A8FF;
    border: 1px solid rgba(155,107,232,.4); cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.assistant-page .ap-new-btn:hover { background: rgba(155,107,232,.28); border-color: rgba(181,138,240,.7); }
.assistant-page .ap-new-btn:focus-visible { outline: 2px solid #B58AF0; outline-offset: 1px; }
.assistant-page .ap-new-form { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border, #30363D); }
.assistant-page .ap-new-form[hidden] { display: none; }
.assistant-page .ap-new-project, .assistant-page .ap-new-title {
    width: 100%; padding: 7px 9px; border-radius: 7px; font-size: 12px;
    background: var(--bg-tertiary, #1C2128); color: var(--text-primary, #E6EDF3);
    border: 1px solid var(--border, #30363D);
}
.assistant-page .ap-new-project:focus, .assistant-page .ap-new-title:focus { outline: none; border-color: #9B6BE8; }
.assistant-page .ap-new-actions { display: flex; gap: 8px; justify-content: flex-end; }
.assistant-page .ap-new-actions button {
    padding: 6px 12px; border-radius: 7px; font-size: 11.5px; font-weight: 650; cursor: pointer;
}
.assistant-page .ap-new-cancel { background: none; border: 1px solid var(--border, #30363D); color: var(--text-secondary, #8B949E); }
.assistant-page .ap-new-cancel:hover { color: var(--text-primary, #E6EDF3); }
.assistant-page .ap-new-create { background: #6C3FA0; border: 1px solid #9B6BE8; color: #fff; }
.assistant-page .ap-new-create:hover { background: #7d4cb8; }
.assistant-page .ap-conv-list { flex: 1; padding: 6px 8px 14px; }
.assistant-page .ap-group-label {
    margin: 10px 8px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: var(--text-muted, #484F58);
}
.assistant-page .ap-conv-item {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    padding: 8px 10px; margin: 2px 0; border-radius: 8px;
    font-size: 12.5px; color: var(--text-secondary, #8B949E);
    cursor: pointer; border: 1px solid transparent;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.assistant-page .ap-conv-item:hover { background: var(--bg-elevated, #21262D); color: var(--text-primary, #E6EDF3); }
.assistant-page .ap-conv-item.active {
    background: rgba(155,107,232,.12); color: var(--text-primary, #E6EDF3);
    border-color: rgba(155,107,232,.4);
}
.assistant-page .ap-conv-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assistant-page .ap-conv-title-edit {
    flex: 1; min-width: 0; padding: 3px 6px; font-size: 12px; border-radius: 5px;
    background: var(--bg-tertiary, #1C2128); color: var(--text-primary, #E6EDF3);
    border: 1px solid #9B6BE8;
}
.assistant-page .ap-conv-actions { display: none; gap: 2px; flex: none; }
.assistant-page .ap-conv-item:hover .ap-conv-actions,
.assistant-page .ap-conv-item.active .ap-conv-actions { display: inline-flex; }
.assistant-page .ap-act {
    background: none; border: none; cursor: pointer; color: var(--text-secondary, #8B949E);
    font-size: 12px; padding: 2px 4px; border-radius: 5px;
}
.assistant-page .ap-act:hover { color: var(--text-primary, #E6EDF3); background: rgba(255,255,255,.07); }
.assistant-page .ap-act:focus-visible { outline: 2px solid #9B6BE8; outline-offset: 1px; }
.assistant-page .ap-empty, .assistant-page .ap-loading {
    padding: 22px 14px; font-size: 12px; color: var(--text-muted, #484F58);
    text-align: center; line-height: 1.6;
}
.assistant-page .ap-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-primary, #0F1419); }
@media (max-width: 900px) {
    .assistant-page .ap-sidebar { width: 220px; }
    .assistant-page .ap-sub { display: none; }
}
@media (max-width: 720px) {
    .assistant-page .ap-sidebar { width: 180px; }
}

/* ===== 3D Generation page polish: FULL input image left + GPU status chip ===== */
/* The loaded input image fills the left pane (clean two-pane layout: full image
   on the left, generated 3D object in the right viewport). */
#imgproc-section-trellis .imgproc-upload-full .imgproc-preview {
    display: flex; flex-direction: column; gap: 8px;
}
#imgproc-section-trellis .imgproc-upload-full .imgproc-preview img {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 360px);
    object-fit: contain;
    border-radius: 10px;
    background: #0a0d12;
    border: 1px solid var(--border, #30363D);
}
.imgproc-gpu-chip {
    display: inline-flex; align-items: center; gap: 6px;
    margin-left: auto; margin-right: 10px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 10.5px; font-weight: 700; letter-spacing: .4px;
    border: 1px solid transparent; white-space: nowrap;
}
.imgproc-gpu-chip.warming {
    color: #E3B341; background: rgba(187,128,9,.12); border-color: rgba(187,128,9,.4);
    animation: gpu-chip-pulse 1.6s ease-in-out infinite;
}
.imgproc-gpu-chip.ready {
    color: #56D364; background: rgba(46,160,67,.12); border-color: rgba(46,160,67,.4);
    animation: none;
}
@keyframes gpu-chip-pulse { 0%,100% { opacity: .65; } 50% { opacity: 1; } }

/* ===== Label module S-spec additions ===== */
.label-module .lm-overlay { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-secondary,#8B949E); }
.label-module .lm-overlay-input { width: 70px; }
.label-module .lm-filter {
    padding: 4px 6px; border-radius: 6px; font-size: 11px;
    background: var(--bg-tertiary,#1C2128); color: var(--text-primary,#E6EDF3);
    border: 1px solid var(--border,#30363D);
}
.label-module .lm-hl-unlabeled {
    padding: 3px 8px; border-radius: 6px; font-size: 12px; cursor: pointer;
    background: none; border: 1px solid var(--border,#30363D); color: var(--text-secondary,#8B949E);
}
.label-module .lm-hl-unlabeled.active { color: #ff7b72; border-color: rgba(255,123,114,.55); background: rgba(255,123,114,.1); }
.label-module .lm-swatch-hidden { opacity: .25; filter: grayscale(.7); }
.label-module .lm-hint {
    position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
    font-size: 10.5px; color: var(--text-muted,#484F58); pointer-events: none;
    background: rgba(10,13,18,.7); padding: 3px 10px; border-radius: 999px;
}
.label-module .lm-perf-hud {
    position: absolute; top: 52px; right: 12px; z-index: 50;
    font: 11px/1.5 var(--font-mono,'JetBrains Mono',monospace);
    color: #56D364; background: rgba(8,12,16,.85);
    border: 1px solid rgba(46,160,67,.4); border-radius: 8px; padding: 7px 10px;
    pointer-events: none; white-space: pre;
}
.label-module .lm-toast {
    position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(180deg,#2A1518,#1E1013);
    border: 1px solid rgba(255,123,114,.45); color: #ffb4ad;
    padding: 9px 14px; border-radius: 9px; font-size: 12px; z-index: 60;
}

/* Danger variant for the shared Dialog confirm action */
.nav-info-open.dialog-danger { background: #B62324; box-shadow: 0 4px 14px rgba(207,34,46,.35); }
.nav-info-open.dialog-danger:hover { background: #DA3633; box-shadow: 0 6px 20px rgba(207,34,46,.45); }
