        /* --- Sidebar Stack --- */
        .side-stack {
            position: absolute;
            right: 24px;
            bottom: 76px;
            width: 320px;
            height: min(720px, calc(100vh - 128px));
            max-height: calc(100vh - 128px);
            display: flex;
            flex-direction: column;
            background: var(--panel-bg);
            backdrop-filter: var(--glass-blur);
            border: 1px solid var(--border-color);
            border-radius: 18px;
            box-shadow: 0 18px 45px rgba(0, 0, 0, 0.36);
            overflow: hidden;
            z-index: 650;
            pointer-events: auto;
            transition: max-height 0.25s ease, opacity 0.25s ease;
        }

        .side-stack-header {
            flex: 0 0 auto;
            min-height: 46px;
            box-sizing: border-box;
            padding: 12px 16px;
            background: rgba(255, 255, 255, 0.045);
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
        }

        .side-stack-content {
            display: flex;
            flex-direction: column;
            gap: 12px;
            padding: 12px;
            overflow-y: auto;
            overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
            min-height: 0;
        }

        .side-stack.collapsed {
            height: 46px;
            max-height: 46px;
        }

        .side-stack.collapsed .side-stack-content {
            display: none;
        }

        .floating-panel {
            position: relative;
            background: var(--panel-bg);
            backdrop-filter: var(--glass-blur);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            overflow: hidden;
            display: flex;
            flex-direction: column;
            transition: all 0.3s ease;
            flex-shrink: 0;
        }

        .side-stack .floating-panel {
            background: rgba(255, 255, 255, 0.025);
            box-shadow: none;
            border-radius: 14px;
        }

        .panel-header {
            padding: 12px 16px;
            background: rgba(255, 255, 255, 0.03);
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: pointer;
        }

        .panel-title {
            font-size: 0.75rem;
            font-weight: 700;
            letter-spacing: 0;
            color: var(--text-dim);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .panel-content {
            padding: 20px;
        }

        .btn-collapse {
            background: none;
            border: none;
            color: var(--text-dim);
            cursor: pointer;
            padding: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }

        .floating-panel.collapsed .panel-content {
            display: none;
        }

        .fd-container {
            text-align: center;
            margin-bottom: 16px;
        }

        .fd-value {
            font-size: 2.5rem;
            font-weight: 800;
            font-family: 'JetBrains Mono', monospace;
            background: linear-gradient(135deg, var(--accent-primary), #fff);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            line-height: 1;
        }

        .fd-value.busy {
            opacity: 0.55;
            -webkit-text-fill-color: var(--text-dim);
            background: none;
        }

        .fd-label {
            font-size: 0.75rem;
            color: var(--text-dim);
        }

        .metrics-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 16px;
        }

        .metric-card {
            background: rgba(255, 255, 255, 0.02);
            padding: 10px;
            border-radius: 10px;
            border: 1px solid var(--border-color);
        }

        .metric-label {
            font-size: 0.65rem;
            color: var(--text-dim);
        }

        .metric-value {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text-main);
        }

        .advanced-metrics-panel {
            background: rgba(255, 255, 255, 0.02);
            padding: 12px;
            border-radius: 12px;
            border: 1px solid var(--border-color);
            margin-bottom: 16px;
        }

        .advanced-metrics-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-top: 10px;
        }

        .advanced-metrics-grid .metric-card {
            padding: 8px;
        }

        .calibration-row {
            display: grid;
            grid-template-columns: 1fr 92px;
            gap: 8px;
            align-items: center;
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px solid rgba(255, 255, 255, 0.06);
        }

        .quality-panel {
            background: rgba(255, 255, 255, 0.02);
            padding: 12px;
            border-radius: 12px;
            border: 1px solid var(--border-color);
        }

        .quality-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-top: 10px;
        }

        .quality-note {
            display: none;
            margin-top: 10px;
            padding: 8px;
            border-radius: 8px;
            background: rgba(255, 170, 0, 0.08);
            border: 1px solid rgba(255, 170, 0, 0.25);
            color: #ffaa00;
            font-size: 0.68rem;
            line-height: 1.35;
        }

        .preview-container {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 12px;
        }

        .pipeline-preview-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 8px;
            color: var(--text-main);
            font-size: 0.72rem;
            font-weight: 800;
        }

        .pipeline-preview-head small {
            color: var(--text-dim);
            font-size: 0.56rem;
            font-weight: 600;
            text-align: right;
        }

        .pipeline-preview-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
        }

        .preview-item {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .canvas-wrapper {
            background: #000;
            aspect-ratio: 1;
            border-radius: 6px;
            border: 1px solid var(--border-color);
            overflow: hidden;
            position: relative;
        }

        .pipeline-preview-grid .canvas-wrapper {
            aspect-ratio: 4 / 3;
            border-radius: 8px;
            background:
                radial-gradient(circle at 50% 42%, rgba(0, 242, 255, 0.05), transparent 62%),
                #02050a;
        }

        .canvas-wrapper canvas {
            width: 100%;
            height: 100%;
            object-fit: contain;
            display: block;
        }

        .preview-tag {
            font-size: 0.55rem;
            color: var(--text-dim);
            text-align: center;
            letter-spacing: 0.03em;
        }

        .pipeline-details {
            display: grid;
            gap: 6px;
            margin-top: 12px;
            font-size: 0.68rem;
            color: var(--text-dim);
            line-height: 1.35;
        }

        .pipeline-step {
            display: flex;
            justify-content: space-between;
            gap: 12px;
            padding: 7px 8px;
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.025);
            border: 1px solid rgba(255, 255, 255, 0.05);
        }

        .pipeline-step strong {
            color: var(--text-main);
            font-size: 0.7rem;
        }

        .roi-detail-panel {
            background: rgba(255, 255, 255, 0.02);
            padding: 12px;
            border-radius: 12px;
            border: 1px solid var(--border-color);
        }

        .roi-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-top: 10px;
        }

        .roi-field {
            display: grid;
            grid-template-columns: 32px 1fr;
            align-items: center;
            gap: 6px;
            background: rgba(255, 255, 255, 0.025);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 8px;
            padding: 6px;
        }

        .roi-field label {
            color: var(--text-dim);
            font-size: 0.62rem;
            font-weight: 700;
        }

        #regression-chart-container {
            height: 120px;
            width: 100%;
        }

        #status-bar {
            position: absolute;
            bottom: 24px;
            right: 24px;
            width: 320px;
            max-width: calc(100vw - 48px);
            padding: 8px 16px;
            background: var(--panel-bg);
            backdrop-filter: var(--glass-blur);
            border-radius: 16px;
            border: 1px solid var(--border-color);
            font-size: 0.8rem;
            display: flex;
            align-items: flex-start;
            gap: 10px;
            z-index: 700;
            transition: bottom 0.25s ease, transform 0.25s ease;
        }

        #status-text {
            min-width: 0;
            line-height: 1.35;
            white-space: normal;
        }

        .status-dot {
            width: 8px;
            height: 8px;
            margin-top: 4px;
            flex: 0 0 auto;
            border-radius: 50%;
            background: var(--accent-success);
            box-shadow: 0 0 10px var(--accent-success);
            animation: pulse 2s infinite;
        }

        /* Single visible notification surface */
        #status-bar {
            position: fixed !important;
            width: 1px !important;
            height: 1px !important;
            min-width: 0 !important;
            max-width: 1px !important;
            padding: 0 !important;
            margin: 0 !important;
            border: 0 !important;
            clip: rect(0 0 0 0) !important;
            clip-path: inset(50%) !important;
            overflow: hidden !important;
            opacity: 0 !important;
            pointer-events: none !important;
            transform: none !important;
            box-shadow: none !important;
            background: transparent !important;
        }
        #status-bar .status-dot { display: none !important; }




        .notification-center {
            position: fixed;
            right: 24px;
            top: 76px;
            width: min(360px, calc(100vw - 32px));
            display: grid;
            gap: 10px;
            z-index: 2200;
            pointer-events: none;
        }

        .app-toast {
            position: relative;
            display: grid;
            grid-template-columns: 10px minmax(0, 1fr) auto;
            gap: 10px;
            align-items: flex-start;
            padding: 12px 12px 12px 14px;
            border: 1px solid var(--border-color);
            border-radius: 14px;
            background: rgba(13, 17, 23, 0.88);
            backdrop-filter: var(--glass-blur);
            color: var(--text-main);
            box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.02);
            pointer-events: auto;
            transform: translateY(-8px);
            opacity: 0;
            transition: opacity 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
        }

        .app-toast.visible { opacity: 1; transform: translateY(0); }
        .app-toast.removing { opacity: 0; transform: translateY(-8px) scale(0.98); }
        .app-toast::before {
            content: "";
            width: 9px;
            height: 9px;
            margin-top: 4px;
            border-radius: 50%;
            background: var(--accent-primary);
            box-shadow: 0 0 14px rgba(0, 242, 255, 0.45);
        }
        .app-toast.success { border-color: rgba(0, 255, 136, 0.24); }
        .app-toast.success::before { background: var(--accent-success); box-shadow: 0 0 14px rgba(0, 255, 136, 0.45); }
        .app-toast.error { border-color: rgba(255, 68, 68, 0.32); }
        .app-toast.error::before { background: #ff4444; box-shadow: 0 0 14px rgba(255, 68, 68, 0.42); }
        .app-toast.warning { border-color: rgba(255, 170, 0, 0.32); }
        .app-toast.warning::before { background: #ffaa00; box-shadow: 0 0 14px rgba(255, 170, 0, 0.42); }
        .app-toast-message {
            min-width: 0;
            font-size: 0.78rem;
            line-height: 1.42;
            color: var(--text-main);
            overflow-wrap: anywhere;
        }
        .app-toast-close {
            width: 24px;
            height: 24px;
            border: 0;
            border-radius: 8px;
            display: inline-grid;
            place-items: center;
            background: rgba(255, 255, 255, 0.05);
            color: var(--text-dim);
            cursor: pointer;
            transition: color 0.2s ease, background 0.2s ease;
        }
        .app-toast-close:hover,
        .app-toast-close:focus-visible {
            color: var(--text-main);
            background: rgba(255, 255, 255, 0.1);
            outline: none;
        }

        .analysis-state {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 0.65rem;
            font-weight: 700;
        }

        .analysis-state::before {
            content: "";
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: currentColor;
            box-shadow: 0 0 10px currentColor;
            animation: pulse 1.6s infinite;
        }

        .filter-panel {
            position: absolute;
            bottom: 84px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--panel-bg);
            backdrop-filter: var(--glass-blur);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 12px 20px;
            display: flex;
            gap: 24px;
            z-index: 1300;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            opacity: 0;
            pointer-events: none;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .filter-panel.visible {
            opacity: 1;
            pointer-events: all;
            bottom: 100px;
        }

        .auto-panel {
            position: fixed;
            top: 62px;
            right: 146px;
            width: 270px;
            background: var(--panel-bg);
            backdrop-filter: var(--glass-blur);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 10px;
            display: grid;
            gap: 8px;
            z-index: 1300;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            opacity: 0;
            pointer-events: none;
            transition: all 0.25s ease;
        }

        .auto-panel.visible {
            opacity: 1;
            pointer-events: all;
        }

        .auto-option {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 8px;
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.025);
            border: 1px solid rgba(255, 255, 255, 0.05);
        }

        .auto-option.analysis-link {
            background: rgba(0, 242, 255, 0.07);
            border-color: rgba(0, 242, 255, 0.22);
        }

        .auto-option span {
            flex: 1 1 auto;
            min-width: 0;
            font-size: 0.72rem;
            color: var(--text-main);
            line-height: 1.2;
        }

        .auto-option .switch {
            flex: 0 0 34px;
        }

        .auto-option small {
            display: block;
            margin-top: 2px;
            color: var(--text-dim);
            font-size: 0.58rem;
        }

        .auto-actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }

        .preset-block {
            border: 1px solid rgba(0, 242, 255, 0.13);
            background: rgba(0, 242, 255, 0.045);
            border-radius: 10px;
            padding: 9px;
        }

        .preset-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 8px;
            color: var(--text-main);
            font-size: 0.72rem;
            font-weight: 700;
        }

        .preset-active-label {
            color: var(--accent-primary);
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.58rem;
            font-weight: 600;
            text-align: right;
        }

        .preset-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 7px;
        }

        .preset-btn {
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: rgba(255, 255, 255, 0.035);
            color: var(--text-main);
            border-radius: 8px;
            padding: 8px;
            text-align: left;
            cursor: pointer;
            min-height: 58px;
            transition: all 0.2s ease;
        }

        .preset-btn strong {
            display: block;
            font-size: 0.68rem;
            line-height: 1.15;
        }

        .preset-btn small {
            display: block;
            margin-top: 4px;
            color: var(--text-dim);
            font-size: 0.55rem;
            line-height: 1.2;
        }

        .preset-btn:hover {
            border-color: rgba(0, 242, 255, 0.28);
            background: rgba(0, 242, 255, 0.08);
        }

        .preset-btn.active {
            border-color: rgba(0, 242, 255, 0.48);
            background: rgba(0, 242, 255, 0.14);
            box-shadow: inset 0 0 14px rgba(0, 242, 255, 0.08);
        }

        .mini-btn {
            border: 1px solid rgba(0, 242, 255, 0.22);
            background: rgba(0, 242, 255, 0.08);
            color: var(--accent-primary);
            border-radius: 7px;
            padding: 7px 8px;
            font-size: 0.68rem;
            font-weight: 700;
            cursor: pointer;
        }

        .alignment-preview-panel {
            position: absolute;
            left: 24px;
            bottom: 84px;
            width: min(580px, calc(100vw - 48px));
            background: var(--panel-bg);
            backdrop-filter: var(--glass-blur);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            box-shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
            overflow: hidden;
            z-index: 1350;
            opacity: 0;
            transform: translateY(12px);
            pointer-events: none;
            transition: opacity 0.22s ease, transform 0.22s ease;
        }

        .alignment-preview-panel.visible {
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto;
        }

        .alignment-preview-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 12px 14px;
            background: rgba(255, 255, 255, 0.045);
            border-bottom: 1px solid var(--border-color);
        }

        .alignment-preview-title {
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--text-main);
            font-weight: 800;
            font-size: 0.78rem;
        }

        .alignment-preview-body {
            padding: 12px;
        }

        .alignment-preview-canvas-wrap {
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: #02050a;
            border-radius: 12px;
            overflow: hidden;
            height: 340px;
        }

        #alignment-overlay-canvas {
            display: block;
            width: 100%;
            height: 100%;
        }

        .alignment-preview-meta {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 7px;
            margin-top: 9px;
            font-size: 0.62rem;
            color: var(--text-dim);
        }

        .alignment-preview-meta span {
            display: block;
            border: 1px solid rgba(255, 255, 255, 0.07);
            background: rgba(255, 255, 255, 0.03);
            border-radius: 8px;
            padding: 6px 7px;
            min-width: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .overlay-controls {
            display: grid;
            grid-template-columns: 1fr 120px;
            gap: 10px;
            align-items: center;
            margin-top: 10px;
        }

        .overlay-controls label {
            color: var(--text-dim);
            font-size: 0.64rem;
        }

        .overlay-legend {
            display: flex;
            justify-content: space-between;
            gap: 8px;
            margin-top: 8px;
            font-size: 0.6rem;
            color: var(--text-dim);
        }

        .legend-ref,
        .legend-target {
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }

        .legend-ref::before,
        .legend-target::before {
            content: '';
            width: 9px;
            height: 9px;
            border-radius: 50%;
            display: inline-block;
        }

        .legend-ref::before {
            background: #ffffff;
        }

        .legend-target::before {
            background: var(--accent-primary);
        }

        .alignment-preview-note {
            margin-top: 8px;
            color: var(--text-dim);
            font-size: 0.62rem;
            line-height: 1.45;
        }

        .filter-group {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 120px;
        }

        .filter-label {
            font-size: 0.7rem;
            color: var(--text-dim);
            display: flex;
            justify-content: space-between;
        }

        input[type="range"] {
            -webkit-appearance: none;
            width: 100%;
            height: 4px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 2px;
            outline: none;
        }

        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 12px;
            height: 12px;
            background: var(--accent-primary);
            border-radius: 50%;
            cursor: pointer;
            box-shadow: 0 0 5px var(--accent-primary);
        }

        ::-webkit-scrollbar {
            width: 6px;
        }

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

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

        .fade-in {
            animation: fadeIn 0.5s ease-out;
        }
