/* Inovance Robot 3D Simulation */
:root {
    --bg:         #0b0e14;
    --bar-bg:     rgba(15, 19, 28, 0.95);
    --accent:     #007aff;
    --accent-glow:rgba(0,122,255,0.3);
    --accent-dim: rgba(0,122,255,0.1);
    --text-1:     #ffffff;
    --text-2:     #94a3b8;
    --border:     rgba(255,255,255,0.09);
    --axis-x:     #d32f2f;
    --axis-y:     #388e3c;
    --axis-z:     #1976d2;
    --topbar-h:   72px;
    --stats-h:    48px;
    --scrollbar-track: rgba(15, 23, 42, 0.72);
    --scrollbar-thumb: rgba(96, 165, 250, 0.48);
    --scrollbar-thumb-hover: rgba(96, 165, 250, 0.78);
    --ease:       cubic-bezier(0.4,0,0.2,1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-1);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Keep compact simulation panels consistent with the dark blue UI theme. */
:is(#canvas-container, .panel-popout-body, .position-value-dialog, .interference-zone-panel, .interference-zone-dialog) {
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    scrollbar-width: thin;
}

:is(#canvas-container, .panel-popout-body, .position-value-dialog, .interference-zone-panel, .interference-zone-dialog) *::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

:is(.position-value-dialog, .interference-zone-dialog)::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

:is(#canvas-container, .panel-popout-body, .position-value-dialog, .interference-zone-panel, .interference-zone-dialog) *::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 999px;
}

:is(.position-value-dialog, .interference-zone-dialog)::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 999px;
}

:is(#canvas-container, .panel-popout-body, .position-value-dialog, .interference-zone-panel, .interference-zone-dialog) *::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 2px solid rgba(13, 18, 28, 0.92);
    border-radius: 999px;
}

:is(.position-value-dialog, .interference-zone-dialog)::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 2px solid rgba(13, 18, 28, 0.92);
    border-radius: 999px;
}

:is(#canvas-container, .panel-popout-body, .position-value-dialog, .interference-zone-panel, .interference-zone-dialog) *::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

:is(.position-value-dialog, .interference-zone-dialog)::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

:is(#canvas-container, .panel-popout-body, .position-value-dialog, .interference-zone-panel, .interference-zone-dialog) *::-webkit-scrollbar-thumb:active {
    background: #60a5fa;
}

:is(.position-value-dialog, .interference-zone-dialog)::-webkit-scrollbar-thumb:active {
    background: #60a5fa;
}

:is(#canvas-container, .panel-popout-body, .position-value-dialog, .interference-zone-panel, .interference-zone-dialog) *::-webkit-scrollbar-corner {
    background: transparent;
}

:is(.position-value-dialog, .interference-zone-dialog)::-webkit-scrollbar-corner {
    background: transparent;
}

/* ── TOP BAR ───────────────────────────────── */
#topbar {
    position: fixed;
    top:0; left:0; right:0;
    height: var(--topbar-h);
    background: var(--bar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    gap: 1.5rem;
    z-index: 200;
    transition: transform 0.28s var(--ease), opacity 0.2s ease;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}

.logo-link {
    display: flex;
    align-items: center;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
    transition: all 0.3s var(--ease);
}

.logo-link:hover {
    transform: scale(1.05);
}

.logo {
    height: 60px; /* 로고 크기 1.5배 확대 (40px -> 60px) 및 패딩 제거 */
    width: auto;
    object-fit: contain;
    display: block;
}

.app-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.45rem; 
    font-weight: 700;
    letter-spacing: -0.3px;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border);
    white-space: nowrap;
    text-transform: none;
    color: var(--text-1);
    margin-right: 1.5rem;
}

.add-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 1.5rem;
    height: 44px;
    min-width: 160px;
    white-space: nowrap;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s var(--ease);
    color: var(--text-2);
    user-select: none;
    margin-left: 1rem;
}

.add-mode-toggle:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--accent);
}

.add-mode-toggle input {
    display: none;
}

.add-mode-toggle input:checked + span {
    color: var(--accent);
}

.add-mode-toggle input:checked ~ span i {
    color: var(--accent);
}

/* ── Select Combobox ───────────────────────── */
.topbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    max-width: 600px;
}

.simulation-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    flex: 0 0 auto;
    height: 44px;
    padding: 0 0.9rem;
    border: 1px solid rgba(248, 113, 113, 0.36);
    border-radius: 12px;
    background: rgba(127, 29, 29, 0.22);
    color: #fca5a5;
    font-family: 'Outfit', sans-serif;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}

.simulation-reset-btn:hover {
    border-color: #f87171;
    background: #b91c1c;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(248, 113, 113, 0.22);
}

.simulation-reset-btn:focus-visible {
    outline: 2px solid #fca5a5;
    outline-offset: 2px;
}

.select-wrapper {
    position: relative;
    width: 100%;
}

.select-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

.arrow-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-2);
    font-size: 0.8rem;
    pointer-events: none;
}

#model-select {
    width: 100%;
    padding: 0.8rem 2.8rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    appearance: none;
    transition: all 0.2s var(--ease);
}

#model-select:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(59, 130, 246, 0.5);
}

#model-select optgroup {
    background-color: #0f172a;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#model-select option {
    background-color: #0f172a;
    color: #ffffff;
    padding: 10px;
}

/* ── UI Buttons ───────────────────────────── */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.viewer-language-row {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

/* Keep number fields editable while removing the browser's built-in stepper buttons. */
input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.viewer-language-row .inorobot-language-switcher {
    position: static;
}

.ui-btn {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text-2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s var(--ease);
}

.ui-btn:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.ui-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.ui-btn.active:hover {
    box-shadow: 0 4px 12px var(--accent-glow), 0 0 20px rgba(0, 122, 255, 0.4);
}

.simulation-reset-dialog {
    width: min(420px, calc(100vw - 32px));
    margin: auto;
    padding: 0;
    overflow: hidden;
    color: var(--text-1);
    background: #111827;
    border: 1px solid rgba(248, 113, 113, 0.38);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(2, 6, 23, 0.72);
}

.simulation-reset-dialog::backdrop {
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(3px);
}

.simulation-reset-dialog form {
    margin: 0;
    padding: 1.35rem 1.4rem 1.15rem;
}

.simulation-reset-dialog-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.9rem;
}

.simulation-reset-dialog-header i {
    color: #f87171;
    font-size: 1.15rem;
}

.simulation-reset-dialog-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.08rem;
}

.simulation-reset-dialog p {
    color: #cbd5e1;
    font-size: 0.92rem;
    line-height: 1.65;
}

.simulation-reset-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 1.2rem;
}

.simulation-reset-dialog-actions button {
    min-width: 72px;
    padding: 0.55rem 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 9px;
    color: #e2e8f0;
    background: rgba(51, 65, 85, 0.72);
    font: inherit;
    cursor: pointer;
}

.simulation-reset-dialog-actions button:hover {
    border-color: #60a5fa;
}

.simulation-reset-dialog-actions .primary {
    border-color: #dc2626;
    background: #b91c1c;
}

.simulation-reset-dialog-actions .primary:hover {
    border-color: #f87171;
    background: #dc2626;
}

.simulation-reset-dialog-actions button:disabled {
    cursor: wait;
    opacity: 0.6;
}

/* ── Workspace recovery dialog ───────────────── */
.workspace-recovery-dialog {
    width: min(620px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    margin: auto;
    padding: 0;
    overflow: auto;
    color: var(--text-1);
    background:
        radial-gradient(circle at 12% 0%, rgba(59, 130, 246, 0.16), transparent 42%),
        #0f172a;
    border: 1px solid rgba(96, 165, 250, 0.38);
    border-radius: 18px;
    outline: none;
    box-shadow: 0 28px 90px rgba(2, 6, 23, 0.78);
}

.workspace-recovery-dialog::backdrop {
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(5px);
}

.workspace-recovery-dialog form {
    margin: 0;
    padding: 1.45rem;
}

.workspace-recovery-dialog-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.workspace-recovery-dialog-icon {
    display: grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    place-items: center;
    color: #bfdbfe;
    background: rgba(37, 99, 235, 0.28);
    border: 1px solid rgba(96, 165, 250, 0.38);
    border-radius: 14px;
    font-size: 1.15rem;
}

.workspace-recovery-dialog-header > div > span {
    display: block;
    margin-bottom: 0.16rem;
    color: #60a5fa;
    font: 700 0.68rem/1 'Outfit', sans-serif;
    letter-spacing: 0.12em;
}

.workspace-recovery-dialog-header h2 {
    margin: 0;
    font: 700 1.2rem/1.25 'Outfit', sans-serif;
}

.workspace-recovery-description {
    margin: 0;
    color: #dbeafe;
    font-size: 0.94rem;
    line-height: 1.6;
}

.workspace-recovery-options {
    min-inline-size: 0;
    margin: 1rem 0 0;
    padding: 0;
    border: 0;
}

.workspace-recovery-options[hidden],
.workspace-recovery-details[hidden] {
    display: none;
}

.workspace-recovery-options legend {
    margin-bottom: 0.58rem;
    padding: 0;
    color: #bfdbfe;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
}

.workspace-recovery-list {
    display: grid;
    max-height: min(300px, 38vh);
    gap: 0.58rem;
    padding: 0.12rem 0.22rem 0.12rem 0.12rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.workspace-recovery-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: flex-start;
    gap: 0.72rem;
    padding: 0.78rem 0.84rem;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.workspace-recovery-option:hover {
    border-color: rgba(96, 165, 250, 0.62);
    background: rgba(30, 41, 59, 0.82);
}

.workspace-recovery-option:focus-within {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.workspace-recovery-option.is-selected,
.workspace-recovery-option:has(input[type="radio"]:checked) {
    background: rgba(30, 64, 175, 0.24);
    border-color: #60a5fa;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.18);
}

.workspace-recovery-option input[type="radio"] {
    width: 1rem;
    height: 1rem;
    margin: 0.18rem 0 0;
    accent-color: #3b82f6;
    cursor: pointer;
}

.workspace-recovery-option-content {
    display: grid;
    min-width: 0;
    gap: 0.28rem;
}

.workspace-recovery-option-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
}

.workspace-recovery-option-title {
    color: #eff6ff;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.35;
}

.workspace-recovery-option-live,
.workspace-recovery-option-incomplete {
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.35;
}

.workspace-recovery-option-live {
    color: #bae6fd;
    background: rgba(3, 105, 161, 0.3);
    border: 1px solid rgba(56, 189, 248, 0.34);
}

.workspace-recovery-option-incomplete {
    color: #fde68a;
    background: rgba(180, 83, 9, 0.3);
    border: 1px solid rgba(245, 158, 11, 0.42);
}

.workspace-recovery-option-meta,
.workspace-recovery-option-summary {
    color: #cbd5e1;
    font-size: 0.78rem;
    line-height: 1.45;
}

.workspace-recovery-option-meta {
    color: #93c5fd;
}

.workspace-recovery-details {
    display: grid;
    gap: 0.48rem;
    margin-top: 1rem;
    padding: 0.85rem 0.95rem;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
}

.workspace-recovery-details.is-incomplete {
    background: rgba(180, 83, 9, 0.16);
    border-color: rgba(245, 158, 11, 0.42);
}

.workspace-recovery-details.is-incomplete #workspace-recovery-summary {
    color: #fde68a;
}

.workspace-recovery-details p {
    margin: 0;
    color: #e2e8f0;
    font-size: 0.86rem;
    line-height: 1.45;
}

.workspace-recovery-details p:first-child {
    color: #93c5fd;
}

.workspace-recovery-isolation-note {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0.85rem 0 0;
    padding: 0.72rem 0.8rem;
    color: #cbd5e1;
    background: rgba(30, 41, 59, 0.52);
    border-radius: 10px;
    font-size: 0.79rem;
    line-height: 1.55;
}

.workspace-recovery-isolation-note i {
    margin-top: 0.18rem;
    color: #38bdf8;
}

.workspace-recovery-error {
    margin: 0.85rem 0 0;
    padding: 0.68rem 0.78rem;
    color: #fecaca;
    background: rgba(127, 29, 29, 0.3);
    border: 1px solid rgba(248, 113, 113, 0.34);
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.workspace-recovery-error[hidden] {
    display: none;
}

.workspace-recovery-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 1.15rem;
}

.workspace-recovery-dialog-actions button {
    min-height: 40px;
    padding: 0.58rem 0.95rem;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 10px;
    color: #e2e8f0;
    background: rgba(51, 65, 85, 0.76);
    font: 600 0.86rem 'Inter', sans-serif;
    cursor: pointer;
}

.workspace-recovery-dialog-actions button:hover {
    border-color: #60a5fa;
    background: rgba(51, 65, 85, 0.96);
}

.workspace-recovery-dialog-actions button:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.workspace-recovery-dialog-actions .primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    color: #eff6ff;
    background: #2563eb;
    border-color: #60a5fa;
}

.workspace-recovery-dialog-actions .primary:hover {
    background: #1d4ed8;
    border-color: #93c5fd;
}

.workspace-recovery-dialog-actions button:disabled {
    cursor: wait;
    opacity: 0.58;
}

@media (max-width: 520px) {
    .workspace-recovery-dialog form {
        padding: 1.15rem;
    }

    .workspace-recovery-dialog-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .workspace-recovery-dialog-actions .primary {
        grid-row: 1;
    }

    .workspace-recovery-list {
        max-height: min(260px, 36vh);
    }

    .workspace-recovery-option-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ── 3D file import dialog ─────────────────── */
.import-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(360px, calc(100vw - 32px));
    margin: 0;
    padding: 1.35rem;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 18px;
    outline: none;
    background: rgba(13, 18, 28, 0.98);
    color: var(--text-1);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
    transform: translate(-50%, -50%);
}

#btn-test-model,
#btn-import-3d,
#btn-download-cad {
    width: auto;
    min-width: 70px;
    gap: 0.38rem;
    padding: 0 0.7rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
}

#btn-download-cad {
    font: 700 0.7rem 'Outfit', sans-serif;
}

.ui-btn:disabled {
    opacity: 0.36;
    cursor: default;
    transform: none;
    box-shadow: none;
}

/* Keep the complete model selector readable in the 1200px manual player and
   on compact desktop windows without changing the mobile toolbar. */
@media (min-width: 769px) and (max-width: 1280px) {
    #topbar {
        padding: 0 1rem;
        gap: 0.65rem;
    }

    .topbar-left {
        gap: 0.75rem;
    }

    .logo {
        height: 40px;
    }

    .app-title {
        margin-right: 0;
        padding-left: 0.75rem;
        font-size: 1.1rem;
    }

    .topbar-center {
        min-width: 0;
        max-width: none;
        gap: 0.4rem;
    }

    .select-wrapper {
        width: auto;
        min-width: 220px;
        flex: 1 1 300px;
    }

    .add-mode-toggle {
        width: 44px;
        min-width: 44px;
        margin-left: 0;
        padding: 0;
    }

    .add-mode-toggle span {
        font-size: 0;
    }

    .add-mode-toggle span i {
        font-size: 1rem;
    }

    .topbar-right {
        flex: 0 0 auto;
        gap: 0.4rem;
    }

    .viewer-language-row .inorobot-language-label {
        display: none;
    }

    .viewer-language-row .inorobot-language-select {
        min-width: 80px;
    }
}

/* Position point editor */
.position-value-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(650px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, 0.32);
    border-radius: 18px;
    outline: none;
    background: rgba(13, 18, 28, 0.99);
    color: var(--text-1);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.66);
    transform: translate(-50%, -50%);
}

.position-value-dialog::backdrop {
    background: rgba(3, 6, 12, 0.76);
    backdrop-filter: blur(5px);
}

.position-value-dialog form {
    max-height: calc(100vh - 32px);
    padding: 1.15rem;
    overflow-y: auto;
}

.position-value-dialog-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 34px;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.position-value-dialog-header span {
    color: #60a5fa;
    font: 700 0.58rem 'Outfit', sans-serif;
    letter-spacing: 0.14em;
}

.position-value-dialog-header h2 {
    margin-top: 0.12rem;
    font: 700 1.05rem 'Outfit', sans-serif;
}

.position-value-dialog-header strong {
    padding: 0.38rem 0.6rem;
    border: 1px solid rgba(96, 165, 250, 0.34);
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.12);
    color: #bfdbfe;
    font: 700 0.82rem 'Outfit', sans-serif;
}

.position-value-dialog-header button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-2);
    cursor: pointer;
}

.position-value-section {
    margin-top: 0.9rem;
}

.position-value-section h3,
.position-value-label > span {
    display: block;
    margin-bottom: 0.38rem;
    color: #94a3b8;
    font: 700 0.65rem 'Outfit', sans-serif;
    letter-spacing: 0.05em;
}

.position-value-grid {
    display: grid;
    gap: 0.45rem;
}

.position-value-grid.pose-grid,
.position-value-grid.external-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.position-value-grid.arm-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.position-value-grid label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}

.position-value-grid label > span,
.position-value-grid label > small {
    color: #94a3b8;
    font-size: 0.62rem;
    white-space: nowrap;
}

.position-value-grid input,
.position-value-label input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: #fff;
    font: 600 0.72rem 'Outfit', sans-serif;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.position-value-label {
    display: block;
    margin-top: 0.9rem;
}

.position-value-label input {
    box-sizing: border-box;
    padding: 0.58rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    text-align: left;
}

.position-value-label small {
    display: block;
    margin-top: 0.32rem;
    color: #64748b;
    font-size: 0.58rem;
}

.position-value-error {
    display: none;
    margin-top: 0.65rem;
    color: #fca5a5;
    font-size: 0.66rem;
}

.position-value-error.visible { display: block; }

.position-value-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
    margin-top: 1rem;
}

.position-value-dialog-actions button {
    min-width: 92px;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #fff;
    font: 700 0.68rem 'Outfit', sans-serif;
    cursor: pointer;
}

.position-value-dialog-actions .secondary { background: rgba(255, 255, 255, 0.05); }
.position-value-dialog-actions .primary { border-color: #2563eb; background: #2563eb; }

.import-dialog::backdrop {
    background: rgba(3, 6, 12, 0.72);
    backdrop-filter: blur(5px);
}

.import-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.import-dialog-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
}

.import-close-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-2);
    cursor: pointer;
}

.import-settings-grid {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.import-setting {
    display: grid;
    gap: 0.35rem;
    color: #94a3b8;
    font: 700 0.66rem 'Outfit', sans-serif;
    letter-spacing: 0.03em;
}

.import-setting small {
    color: #64748b;
    font: 500 0.6rem 'Inter', sans-serif;
    line-height: 1.35;
    letter-spacing: 0;
}

.import-settings-grid select {
    width: 100%;
    padding: 0.62rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
    background: #151c29;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.76rem;
}

.import-settings-grid select:focus {
    border-color: var(--accent);
}

.import-settings-grid option:disabled {
    color: #64748b;
}

.import-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.import-dialog-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 92px;
    padding: 0.65rem 0.85rem;
    border-radius: 9px;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

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

.import-primary-btn {
    border: 1px solid #3b82f6;
    background: #2563eb;
}

.import-dialog-actions button:disabled {
    cursor: wait;
    opacity: 0.55;
}



/* ── Viewport & Overlays ─────────────── */
#main-content {
    position: absolute;
    top: var(--topbar-h);
    left: 0; right: 0;
    bottom: var(--stats-h);
}

body.fullscreen-ui-mode #main-content {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    top: 0;
    bottom: 0;
}

body.fullscreen-ui-mode #canvas-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
}

body.fullscreen-ui-mode #topbar {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

body.fullscreen-ui-mode #stats-bar {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

body.fullscreen-ui-mode.fullscreen-topbar-revealed #topbar,
body.fullscreen-ui-mode.fullscreen-statsbar-revealed #stats-bar {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

#canvas-container {
    width: 100%; height: 100%;
    position: relative;
}

.viewer-control-dock {
    position: static;
    flex: none;
    display: flex;
    align-items: center;
    gap: 0.32rem;
    margin-left: auto;
}

.viewer-control-dock button,
.panel-header-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.32rem;
    min-width: 30px;
    height: 30px;
    padding: 0 0.48rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-family: 'Outfit', sans-serif;
    font-size: 0.66rem;
    font-weight: 600;
    cursor: pointer;
}

.viewer-control-dock button:hover,
.viewer-control-dock button.active,
.panel-header-actions button:hover {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(37, 99, 235, 0.16);
    color: #fff;
}

.viewer-control-dock button:disabled {
    opacity: 0.32;
    cursor: default;
}

.viewer-control-divider {
    width: 1px;
    height: 20px;
    margin: 0 0.12rem;
    background: var(--border);
}

/* ── Scene model tree & numeric transform editor ── */
.model-browser-panel {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 70;
    width: 310px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 18px;
    background: rgba(13, 18, 28, 0.94);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
}

.model-browser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.05rem 0.8rem;
    border-bottom: 1px solid var(--border);
    cursor: move;
    user-select: none;
}

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

.panel-header-actions button {
    padding: 0;
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.035);
}

.panel-edge-resizable[data-resize-edge] {
    touch-action: none;
    user-select: none;
}

.panel-edge-resizable:is([data-resize-edge="n"], [data-resize-edge="s"]),
.panel-edge-resizable:is([data-resize-edge="n"], [data-resize-edge="s"]) * {
    cursor: ns-resize !important;
}

.panel-edge-resizable:is([data-resize-edge="e"], [data-resize-edge="w"]),
.panel-edge-resizable:is([data-resize-edge="e"], [data-resize-edge="w"]) * {
    cursor: ew-resize !important;
}

.panel-edge-resizable:is([data-resize-edge="ne"], [data-resize-edge="sw"]),
.panel-edge-resizable:is([data-resize-edge="ne"], [data-resize-edge="sw"]) * {
    cursor: nesw-resize !important;
}

.panel-edge-resizable:is([data-resize-edge="nw"], [data-resize-edge="se"]),
.panel-edge-resizable:is([data-resize-edge="nw"], [data-resize-edge="se"]) * {
    cursor: nwse-resize !important;
}

.model-browser-header h2 {
    margin-top: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
}

.model-transform-heading > div > span,
.numeric-position-title > span {
    color: #60a5fa;
    font-family: 'Outfit', sans-serif;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.model-tree-count {
    min-width: 28px;
    padding: 0.24rem 0.5rem;
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.14);
    color: #bfdbfe;
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
}

.model-tree {
    min-height: 92px;
    max-height: 240px;
    overflow-y: auto;
    padding: 0.65rem;
}

.model-browser-panel.panel-edge-resized .model-tree {
    max-height: none;
    flex: 1 1 auto;
}

.model-browser-panel.zero-point-editing .model-tree {
    min-height: 52px;
    max-height: 118px;
    flex: 0 1 118px;
}

.model-browser-panel.zero-point-editing .model-transform-panel {
    flex: 1 1 auto;
}

.model-tree-empty {
    padding: 1rem 0.5rem;
    color: #64748b;
    font-size: 0.74rem;
    line-height: 1.5;
    text-align: center;
}

.model-tree-list,
.model-tree-children {
    display: grid;
    gap: 0.3rem;
    list-style: none;
}

.model-tree-children {
    margin: 0.3rem 0 0.15rem 1.3rem;
    padding-left: 0.55rem;
    border-left: 1px solid rgba(148, 163, 184, 0.22);
}

.model-tree-children[hidden] {
    display: none;
}

.model-tree-node {
    min-width: 0;
}

.model-tree-node-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.model-tree-toggle,
.model-tree-toggle-placeholder {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
}

.model-tree-toggle {
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: 0.16s ease;
}

.model-tree-toggle:hover {
    border-color: rgba(96, 165, 250, 0.32);
    background: rgba(96, 165, 250, 0.12);
    color: #dbeafe;
}

.model-tree-toggle:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 1px;
}

.model-tree-button {
    width: 100%;
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.58rem 0.62rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    text-align: left;
    cursor: pointer;
    transition: 0.16s ease;
}

.model-tree-button:hover {
    border-color: rgba(96, 165, 250, 0.22);
    background: rgba(255, 255, 255, 0.045);
    color: #fff;
}

.model-tree-button.active {
    border-color: rgba(59, 130, 246, 0.6);
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.24), rgba(30, 64, 175, 0.1));
    color: #fff;
    box-shadow: inset 3px 0 0 #3b82f6;
}

.model-tree-icon {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 7px;
    background: rgba(96, 165, 250, 0.12);
    color: #60a5fa;
    font-size: 0.72rem;
}

.model-tree-button-tool .model-tree-icon {
    background: rgba(249, 115, 22, 0.14);
    color: #fb923c;
}

.model-tree-button-3d-model .model-tree-icon {
    background: rgba(101, 163, 13, 0.16);
    color: #a3e635;
}

.model-tree-name {
    min-width: 0;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-tree-kind {
    color: #64748b;
    font-size: 0.57rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.model-tree-part-node {
    min-width: 0;
}

.model-tree-part-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.model-tree-part-visibility {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #22d3ee;
    cursor: pointer;
}

.model-tree-part-button {
    width: 100%;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 0.42rem;
    min-width: 0;
    padding: 0.35rem 0.45rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #cbd5e1;
    text-align: left;
    cursor: pointer;
    transition: 0.16s ease;
}

.model-tree-part-button:hover {
    border-color: rgba(34, 211, 238, 0.28);
    background: rgba(34, 211, 238, 0.08);
    color: #fff;
}

.model-tree-part-button.active {
    border-color: rgba(34, 211, 238, 0.72);
    background: rgba(34, 211, 238, 0.16);
    color: #ecfeff;
    box-shadow: inset 2px 0 0 #22d3ee;
}

.model-tree-part-icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(34, 211, 238, 0.12);
    color: #67e8f9;
    font-size: 0.62rem;
}

.model-tree-part-name {
    min-width: 0;
    overflow: hidden;
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-transform-panel {
    min-height: 0;
    overflow-y: auto;
    padding: 0.9rem 1.05rem 1rem;
    border-top: 1px solid var(--border);
}

.model-transform-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.7rem;
}

.model-transform-heading > div {
    min-width: 0;
    display: grid;
    gap: 0.22rem;
}

.model-transform-heading strong {
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
    font-size: 0.84rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transform-mode-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    margin-top: 0.75rem;
}

.transform-mode-buttons button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    min-width: 0;
    padding: 0.48rem 0.2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: #94a3b8;
    font-size: 0.67rem;
    font-weight: 600;
    cursor: pointer;
}

.transform-mode-buttons button:hover,
.transform-mode-buttons button.active {
    border-color: rgba(59, 130, 246, 0.62);
    background: rgba(37, 99, 235, 0.17);
    color: #fff;
}

.numeric-position-editor {
    margin-top: 0.8rem;
    padding: 0.72rem;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(3, 7, 18, 0.34);
}

.numeric-position-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.55rem;
}

.numeric-position-title small {
    color: #64748b;
    font-size: 0.62rem;
}

.numeric-position-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.42rem;
}

.numeric-position-grid label {
    display: grid;
    grid-template-columns: 27px minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}

.numeric-position-grid label > span {
    font-family: 'Outfit', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    text-align: center;
}

.numeric-position-grid .axis-x > span { color: var(--axis-x); }
.numeric-position-grid .axis-y > span { color: var(--axis-y); }
.numeric-position-grid .axis-z > span { color: var(--axis-z); }

.numeric-position-grid input {
    width: 100%;
    min-width: 0;
    padding: 0.46rem 0.28rem;
    border: 0;
    border-left: 1px solid var(--border);
    outline: none;
    background: transparent;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    text-align: right;
}

.numeric-position-grid input:focus {
    background: rgba(59, 130, 246, 0.09);
}

.numeric-rotation-title {
    margin-top: 0.75rem;
}

.model-transform-help {
    margin-top: 0.65rem;
    color: #64748b;
    font-size: 0.64rem;
    line-height: 1.45;
}

.model-zero-point-editor {
    margin-top: 0.8rem;
    padding: 0.72rem;
    border: 1px solid rgba(34, 211, 238, 0.34);
    border-radius: 11px;
    background: linear-gradient(180deg, rgba(8, 47, 73, 0.28), rgba(3, 7, 18, 0.34));
}

.zero-point-editor-heading,
.zero-point-vector-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.zero-point-editor-heading > div {
    display: grid;
    gap: 0.22rem;
}

.zero-point-editor-heading span,
.zero-point-vector-title span {
    color: #67e8f9;
    font-family: 'Outfit', sans-serif;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.zero-point-editor-heading strong {
    color: #ecfeff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
}

.zero-point-close {
    width: 24px;
    min-height: 24px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    cursor: pointer;
}

.zero-point-close:hover {
    border-color: rgba(248, 113, 113, 0.65);
    color: #fecaca;
}

.zero-point-editor-help {
    margin: 0.55rem 0 0;
    color: #94a3b8;
    font-size: 0.62rem;
    line-height: 1.45;
}

.zero-point-current-readout {
    margin-top: 0.45rem;
    padding: 0.42rem 0.5rem;
    border: 1px solid rgba(250, 204, 21, 0.28);
    border-radius: 7px;
    background: rgba(120, 53, 15, 0.18);
    color: #fde68a;
    font: 600 0.6rem/1.4 'Outfit', sans-serif;
}

.zero-point-snap-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.45rem;
    margin-top: 0.65rem;
    padding: 0.55rem;
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 9px;
    background: rgba(2, 6, 23, 0.28);
}

.zero-point-snap-controls label {
    min-width: 0;
    color: #94a3b8;
    font-size: 0.58rem;
}

.zero-point-snap-controls label > span {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
    margin-bottom: 0.28rem;
}

.zero-point-snap-controls select {
    width: 100%;
    min-width: 0;
    padding: 0.3rem 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.65);
    color: #fff;
    font: inherit;
}

.zero-point-snap-controls input[type="range"] {
    width: 100%;
    accent-color: #22d3ee;
}

.zero-point-snap-controls output {
    color: #a5f3fc;
}

.zero-point-snap-readout {
    min-height: 32px;
    margin-top: 0.45rem;
    padding: 0.42rem 0.5rem;
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.62);
    color: #94a3b8;
    font-size: 0.58rem;
    line-height: 1.4;
}

.zero-point-multi-center-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.4rem;
    padding: 0.4rem 0.45rem;
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 7px;
    background: rgba(8, 47, 73, 0.28);
}

.zero-point-multi-center-controls span {
    color: #a5f3fc;
    font-size: 0.58rem;
}

.zero-point-multi-center-controls button,
.zero-point-snap-button,
.zero-point-editor-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    min-height: 28px;
    border: 1px solid rgba(34, 211, 238, 0.28);
    border-radius: 7px;
    background: rgba(8, 145, 178, 0.12);
    color: #cffafe;
    font: 700 0.62rem/1 'Outfit', sans-serif;
    cursor: pointer;
}

.zero-point-multi-center-controls button {
    padding: 0 0.42rem;
}

.zero-point-multi-center-controls button:hover:not(:disabled),
.zero-point-snap-button:hover:not(:disabled),
.zero-point-editor-actions button:hover:not(:disabled) {
    border-color: #22d3ee;
    background: rgba(8, 145, 178, 0.25);
    color: #fff;
}

.zero-point-multi-center-controls button:disabled,
.zero-point-snap-button:disabled,
.zero-point-editor-actions button:disabled {
    opacity: 0.38;
    cursor: default;
}

.zero-point-snap-button {
    width: 100%;
    margin-top: 0.45rem;
}

.zero-point-snap-button.active {
    border-color: #22d3ee;
    background: rgba(8, 145, 178, 0.82);
    color: #fff;
}

.zero-point-vector-block {
    margin-top: 0.65rem;
}

.zero-point-vector-title small {
    color: #64748b;
    font-size: 0.56rem;
}

.zero-point-axis-directions {
    display: grid;
    gap: 0.25rem;
    margin-top: 0.45rem;
    padding: 0.42rem 0.48rem;
    border: 1px solid rgba(34, 211, 238, 0.16);
    border-radius: 7px;
    background: rgba(2, 6, 23, 0.28);
}

.zero-point-axis-directions > div {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 0.35rem;
    align-items: center;
    color: #94a3b8;
    font-size: 0.58rem;
}

.zero-point-axis-directions b {
    font-family: 'Outfit', sans-serif;
    font-size: 0.62rem;
}

.zero-point-axis-directions > div:nth-child(1) b { color: var(--axis-x); }
.zero-point-axis-directions > div:nth-child(2) b { color: var(--axis-y); }
.zero-point-axis-directions > div:nth-child(3) b { color: var(--axis-z); }

.zero-point-axis-directions output {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.zero-point-vector-block .numeric-position-grid {
    margin-top: 0.42rem;
}

.zero-point-editor-actions {
    display: grid;
    grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
    gap: 0.4rem;
    margin-top: 0.7rem;
}

.zero-point-editor-actions button {
    padding: 0 0.45rem;
}

.zero-point-editor-actions button.primary {
    border-color: rgba(34, 211, 238, 0.6);
    background: rgba(8, 145, 178, 0.36);
}

/* ── HUD / Stats Bar ── */
#stats-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--stats-h);
    transition: transform 0.28s var(--ease), opacity 0.2s ease;
    background: var(--bar-bg);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    font-size: 0.85rem;
    z-index: 100;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.stat-item label {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--text-2);
    text-transform: none;
}

.stat-item span {
    font-family: 'Outfit', sans-serif; /* 모델명과 상태 글꼴도 Outfit으로 통일 */
    color: var(--text-1);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.stat-divider {
    width: 1px;
    height: 14px;
    background: var(--border);
}

#status-dot {
    font-size: 0.5rem;
    color: var(--accent);
}

/* Loading & Empty state */
#loading-overlay {
    position: absolute;
    inset: 0;
    /* Loading must never intercept the viewer canvas. The scene underneath
       remains available while assets are being fetched or parsed. */
    pointer-events: none;
    background: transparent;
    backdrop-filter: none;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 1.25rem;
    z-index: 500;
    transition: opacity 0.4s var(--ease);
}

/* Model selection is intentionally non-blocking. The current scene remains
   interactive while the next robot is fetched and parsed in a Worker. */
.background-loading-indicator {
    position: absolute;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 520;
    pointer-events: none;
    width: min(320px, calc(100% - 2.5rem));
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(96, 165, 250, 0.45);
    border-radius: 0.65rem;
    background: rgba(15, 23, 42, 0.82);
    color: #dbeafe;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    font-size: 0.78rem;
    white-space: normal;
}

.background-loading-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.background-loading-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.background-loading-header strong {
    flex: 0 0 auto;
    color: #93c5fd;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.background-loading-track {
    width: 100%;
    height: 0.32rem;
    margin-top: 0.55rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(147, 197, 253, 0.2);
}

.background-loading-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #3b82f6, #67e8f9);
    transition: width 0.18s ease;
}

.loader-content {
    min-width: 220px;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(96, 165, 250, 0.45);
    border-radius: 0.65rem;
    background: rgba(15, 23, 42, 0.82);
    color: #dbeafe;
    text-align: left;
}

#empty-state {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 3rem;
    max-width: 540px;
    pointer-events: none;
}

#empty-state h2 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

#empty-state p {
    color: var(--text-2);
    line-height: 1.6;
}

.hero-icon-wrap {
    font-size: 4rem;
    color: var(--accent-dim);
    margin-bottom: 2rem;
}

.hint {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: #4ade80;
    opacity: 0.8;
}

/* ── Responsive Mobile ───────────────── */
@media (max-width: 768px) {
    #topbar {
        padding: 0 1rem;
        gap: 0.5rem;
    }
    
    .topbar-left {
        gap: 0.5rem;
    }
    
    .logo {
        height: 36px;
    }
    
    .app-title {
        display: none; /* Mobile에서 제목 숨김 */
    }
    
    .topbar-center {
        max-width: none;
        min-width: 0;
        overflow: hidden;
    }

    .simulation-reset-btn {
        width: 38px;
        height: 38px;
        padding: 0;
        border-radius: 8px;
    }

    .simulation-reset-btn span {
        display: none;
    }

    #model-select {
        padding: 0.6rem 2rem;
        font-size: 0.9rem;
        min-width: 0;
        width: 100%;
    }

    .select-icon {
        left: 10px;
    }
    
    .arrow-icon {
        right: 10px;
    }
    
    .topbar-right {
        gap: 0.4rem;
        flex-shrink: 0;
    }

    .viewer-language-row {
        min-width: 38px;
    }
    
    .ui-btn {
        width: 38px;
        height: 38px;
        border-radius: 8px;
    }

    #stats-bar {
        padding: 0 1rem;
        gap: 0.5rem;
        font-size: 0.75rem;
    }

    .stat-item label {
        display: none; /* Mobile에서 Label 숨김 (공간 확보) */
    }
}

/* Articulated STL JOG test */
.jog-panel {
    position: absolute;
    top: 0;
    right: 0;
    left: auto;
    z-index: 60;
    width: 280px;
    max-height: 100%;
    overflow-y: auto;
    padding: 0.9rem;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 18px;
    background: rgba(13, 18, 28, 0.92);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
}

.jog-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    cursor: move;
    user-select: none;
}

.jog-panel-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.jog-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(255,255,255,0.06);
    color: var(--text-2);
    font-family: 'Outfit', sans-serif;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
}

.panel-header-actions .jog-reset-btn {
    width: auto;
    padding: 0 0.55rem;
}

.jog-reset-btn:hover {
    border-color: var(--accent);
    color: #fff;
}

/* TCP settings */
.tcp-profile-panel {
    position: absolute;
    top: auto;
    right: 292px;
    bottom: 0;
    z-index: 67;
    width: 300px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 18px;
    background: rgba(13, 18, 28, 0.95);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
}

.tcp-profile-panel-header {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
    cursor: move;
    user-select: none;
}

.tcp-profile-panel-header h2 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    color: #dbeafe;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
}

.tcp-profile-panel .tcp-profile-manager {
    margin: 0;
    padding: 0.8rem 0.85rem 0.95rem;
}

.tcp-profile-panel button:disabled,
.tcp-profile-panel input:disabled,
.tcp-profile-panel select:disabled {
    opacity: 0.38;
    cursor: default;
}

#canvas-container.tcp-snap-picking canvas {
    cursor: crosshair;
}

#canvas-container.simulation-snap-picking canvas {
    cursor: crosshair;
}

/* Virtual controller */
.virtual-controller-panel {
    position: absolute;
    top: auto;
    right: 0;
    bottom: 0;
    z-index: 66;
    width: 280px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 18px;
    background: rgba(13, 18, 28, 0.94);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
}

.virtual-controller-header {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
    cursor: move;
    user-select: none;
}

.panel-drag-anywhere {
    cursor: grab;
}

.panel-drag-anywhere.panel-is-dragging {
    cursor: grabbing;
}

.virtual-controller-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
}

.virtual-controller-content {
    min-height: 0;
    display: grid;
    gap: 0.7rem;
    padding: 0.8rem;
    overflow-y: auto;
}

.virtual-controller-telemetry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
}

.virtual-controller-bridge-download,
.virtual-controller-trace-download,
.virtual-controller-bridge-actions button {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text-2);
    font-size: 0.64rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.virtual-controller-bridge-download:hover,
.virtual-controller-trace-download:hover,
.virtual-controller-bridge-actions button:hover {
    border-color: rgba(96, 165, 250, 0.58);
    color: #dbeafe;
    background: rgba(37, 99, 235, 0.16);
}

.virtual-controller-bridge-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.45rem;
}

.virtual-controller-bridge-actions button {
    padding: 0 0.55rem;
    background: rgba(255, 255, 255, 0.035);
    font-family: 'Inter', sans-serif;
}

.virtual-controller-bridge-actions button:last-child {
    border-color: rgba(248, 113, 113, 0.34);
    color: #fecaca;
}

.virtual-controller-trace-download {
    justify-content: center;
}

.virtual-controller-controller-settings {
    display: grid;
    gap: 0.7rem;
    padding: 0.65rem;
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.08);
}

[data-virtual-controller-source][hidden] {
    display: none;
}

.virtual-controller-target {
    display: grid;
    gap: 0.35rem;
    color: var(--text-2);
    font-size: 0.64rem;
    font-weight: 600;
}

.virtual-controller-target select,
.virtual-controller-target input {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 0.6rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
    background: #151b27;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
}

.virtual-controller-target input {
    padding: 0 0.6rem;
}

.virtual-controller-target select:focus,
.virtual-controller-target input:focus {
    border-color: var(--accent);
}

.virtual-controller-connect {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border: 1px solid rgba(59, 130, 246, 0.5);
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.2);
    color: #dbeafe;
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.virtual-controller-connect:hover {
    background: rgba(37, 99, 235, 0.34);
    color: #fff;
}

.virtual-controller-connect.active {
    border-color: rgba(248, 113, 113, 0.5);
    background: rgba(185, 28, 28, 0.2);
    color: #fecaca;
}

.virtual-controller-telemetry {
    min-height: 22px;
    color: var(--text-2);
    font-size: 0.64rem;
    font-variant-numeric: tabular-nums;
}

.virtual-controller-telemetry > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#virtual-controller-status-dot {
    margin-right: 0.25rem;
    color: #64748b;
    font-size: 0.5rem;
}

#virtual-controller-status-dot.connecting { color: #fbbf24; }
#virtual-controller-status-dot.connected { color: #22c55e; }
#virtual-controller-status-dot.disconnected,
#virtual-controller-status-dot.error { color: #ef4444; }

.virtual-controller-antenna {
    color: #ef4444;
    transition: color 0.18s ease;
}

.virtual-controller-antenna.connecting { color: #fbbf24; }
.virtual-controller-antenna.connected { color: #22c55e; }
.virtual-controller-antenna.disconnected,
.virtual-controller-antenna.error { color: #ef4444; }

.virtual-controller-telemetry strong {
    flex: none;
    color: #93c5fd;
    font-family: 'Outfit', sans-serif;
}

.virtual-controller-panel button:disabled,
.virtual-controller-panel select:disabled,
.virtual-controller-panel input:disabled {
    opacity: 0.38;
    cursor: default;
}

/* Saved camera views */
.view-presets-panel {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 69;
    width: 340px;
    max-height: calc(100% - 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 18px;
    background: rgba(13, 18, 28, 0.95);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
}

.view-window {
    position: absolute;
    top: 12px;
    left: 50%;
    z-index: 86;
    width: min(720px, calc(100% - 24px));
    height: min(440px, calc(100% - 24px));
    min-width: min(360px, calc(100% - 24px));
    min-height: min(220px, calc(100% - 24px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, 0.42);
    border-radius: 18px;
    background: rgba(8, 11, 18, 0.96);
    box-shadow: 0 22px 65px rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(18px);
    transform: translateX(-50%);
}

.view-window-header {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.7);
    cursor: move;
    user-select: none;
}

.view-window-header h2 {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    color: #dbeafe;
    font: 700 0.9rem 'Outfit', sans-serif;
}

.view-window-header h2 i {
    color: #60a5fa;
}

.view-window-header h2 strong {
    color: #93c5fd;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.view-window-eyebrow {
    display: block;
    margin-bottom: 0.08rem;
    color: #60a5fa;
    font: 700 0.52rem 'Outfit', sans-serif;
    letter-spacing: 0.14em;
}

.view-window-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.view-window-header button {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: #94a3b8;
    cursor: pointer;
}

.view-window-header button:hover {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(37, 99, 235, 0.16);
    color: #fff;
}

#view-window-grid {
    width: 100%;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    display: grid;
    gap: 0;
    padding: 0;
    background: #0b0e14;
}

#view-window-grid[data-count="1"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}

#view-window-grid[data-count="2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
}

#view-window-grid[data-count="3"],
#view-window-grid[data-count="4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

#view-window-grid[data-count="3"] .view-window-cell:last-child {
    grid-column: 1 / -1;
}

.view-window-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid rgba(148, 163, 184, 0.7);
    border-bottom: 1px solid rgba(148, 163, 184, 0.7);
    background: #0b0e14;
}

#view-window-grid[data-count="1"] .view-window-cell,
#view-window-grid[data-count="2"] .view-window-cell:last-child,
#view-window-grid[data-count="3"] .view-window-cell:last-child,
#view-window-grid[data-count="4"] .view-window-cell:nth-child(2n) {
    border-right: 0;
}

#view-window-grid[data-count="1"] .view-window-cell,
#view-window-grid[data-count="2"] .view-window-cell,
#view-window-grid[data-count="3"] .view-window-cell:last-child,
#view-window-grid[data-count="4"] .view-window-cell:nth-child(n + 3) {
    border-bottom: 0;
}

.view-window-label {
    position: absolute;
    top: 8px;
    left: 10px;
    z-index: 2;
    color: rgba(226, 232, 240, 0.9);
    font: 600 0.78rem/1 Inter, 'Noto Sans KR', sans-serif;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.view-window-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

.view-window-canvas:active {
    cursor: grabbing;
}

.view-window.panel-popout {
    transform: none !important;
}

.view-presets-header {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
    cursor: move;
    user-select: none;
}

.view-presets-header h2 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #dbeafe;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
}

.view-presets-content {
    min-height: 0;
    display: grid;
    gap: 0.7rem;
    padding: 0.8rem;
    overflow-y: auto;
}

.view-presets-help {
    color: var(--text-2);
    font-size: 0.64rem;
    line-height: 1.45;
}

.view-presets-list {
    display: grid;
    gap: 0.4rem;
}

.view-preset-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) repeat(3, 30px);
    align-items: center;
    gap: 0.35rem;
}

.view-preset-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 28px;
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 7px;
    background: rgba(37, 99, 235, 0.14);
    color: #bfdbfe;
    font: 700 0.7rem 'Outfit', sans-serif;
}

.view-preset-row input {
    min-width: 0;
    width: 100%;
    height: 30px;
    padding: 0 0.45rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font: 600 0.68rem 'Inter', sans-serif;
}

.view-preset-row input:focus {
    border-color: var(--accent);
}

.view-preset-row button {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: rgba(37, 99, 235, 0.12);
    color: #bfdbfe;
    cursor: pointer;
}

.view-preset-row button:hover:not(:disabled) {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, 0.28);
    color: #fff;
}

.view-preset-row button:disabled {
    opacity: 0.35;
    cursor: default;
}

.view-preset-row.active input {
    border-color: rgba(34, 197, 94, 0.7);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.12);
}

/* Multi-robot motion program */
.program-panel {
    position: absolute;
    top: 0;
    left: 320px;
    z-index: 65;
    width: min(340px, calc(100% - 32px));
    max-height: 62%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: none;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 18px;
    background: rgba(13, 18, 28, 0.94);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
    container-type: inline-size;
}

.program-panel-header,
.program-section-title,
.program-control-row,
.program-file-row,
.program-robot-row,
.program-step-row {
    display: flex;
    align-items: center;
}

.program-panel-header {
    justify-content: space-between;
    min-height: 48px;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
    cursor: move;
    user-select: none;
}

.program-panel-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
}

.program-panel-content {
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    overflow-y: auto;
}

.program-panel.program-panel-resized .program-point-section,
.panel-popout.program-panel .program-point-section {
    display: flex;
    flex: 1 1 174px;
    flex-direction: column;
}

.program-panel.program-panel-resized .program-step-list,
.panel-popout.program-panel .program-step-list {
    min-height: 0;
    flex: 1 1 auto;
    max-height: none;
}

/* OLP keeps only the mode button in the normal point-program section. */
.program-panel.olp-mode-active .program-point-section,
.panel-popout.program-panel.olp-mode-active .program-point-section {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    height: auto;
    max-height: none;
}

/* OLP is a compact source editor/runtime workspace.  Keep the first layout
 * deterministic so it does not flash to the full canvas width, while leaving
 * enough height for the source editor and runtime controls. */
.program-panel.olp-mode-active {
    top: 16px;
    right: auto;
    bottom: auto;
    left: 16px;
    width: min(480px, calc(100% - 32px));
    height: min(760px, calc(100% - 32px));
    max-width: calc(100% - 32px);
    max-height: calc(100% - 32px);
    box-sizing: border-box;
}

.program-panel.olp-mode-active.olp-panel-positioned {
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
}

.program-panel.olp-mode-active .program-panel-content {
    min-width: 0;
    overflow: hidden;
}

.program-panel.olp-mode-active .program-robot-section,
.program-panel.olp-mode-active .program-point-section,
.program-panel.olp-mode-active .program-file-row,
.program-panel.olp-mode-active .program-status {
    flex: 0 0 auto;
}

.program-panel.olp-mode-active .olp-workspace {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    grid-template-rows: auto minmax(0, 1fr) auto minmax(35px, 95px);
}

.program-panel.olp-mode-active .program-robot-section,
.program-panel.olp-mode-active .program-point-section,
.program-panel.olp-mode-active .olp-workspace,
.program-panel.olp-mode-active .program-file-row,
.program-panel.olp-mode-active .program-status {
    min-width: 0;
    box-sizing: border-box;
}

.program-panel.olp-mode-active .olp-file-grid {
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.program-panel.olp-mode-active .olp-file-grid select,
.program-panel.olp-mode-active .olp-file-grid textarea {
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    height: 100%;
    box-sizing: border-box;
}

.program-panel.olp-mode-active .olp-file-grid textarea {
    resize: none;
}

.program-robot-section,
.program-point-section,
.program-playback,
.program-file-row {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.program-section-title {
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.program-section-title > span {
    color: var(--text-2);
    font: 700 0.62rem 'Outfit', sans-serif;
    letter-spacing: 0.12em;
}

.program-section-title > strong {
    min-width: 0;
    overflow: hidden;
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.program-section-title button,
.program-point-actions button,
.program-control-row button,
.program-file-row button {
    min-height: 28px;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-2);
    font-size: 0.66rem;
    cursor: pointer;
}

.program-section-title button:hover,
.program-point-actions button:hover,
.program-control-row button:hover,
.program-file-row button:hover {
    border-color: var(--accent);
    color: #fff;
}

.program-point-actions {
    display: flex;
    gap: 0.2rem;
}

.program-point-actions button {
    width: 27px;
    min-width: 27px;
    padding-right: 0;
    padding-left: 0;
}

.program-robot-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem;
    max-height: 104px;
    overflow-y: auto;
}

.program-robot-row {
    gap: 0.4rem;
    min-width: 0;
    padding: 0.42rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.program-robot-row.active {
    border-color: rgba(59, 130, 246, 0.8);
    background: rgba(37, 99, 235, 0.13);
}

.program-robot-select {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    border: 0;
    background: none;
    color: #fff;
    font-size: 0.67rem;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.program-robot-status {
    color: var(--text-2);
    font-size: 0.57rem;
    white-space: nowrap;
}

.program-robot-status.running { color: #60a5fa; }
.program-robot-status.paused { color: #fbbf24; }
.program-robot-status.error { color: #f87171; }
.program-robot-status.completed { color: #4ade80; }

.program-point-section {
    min-height: 120px;
    overflow: hidden;
}

.program-step-list {
    display: grid;
    grid-auto-rows: 42px;
    align-content: start;
    gap: 0.3rem;
    max-height: 174px;
    overflow-y: auto;
}

.program-point-overwrite-mark {
    margin-right: 1px;
    font: 800 0.67rem 'Outfit', sans-serif;
    line-height: 1;
}

.program-point-actions button.success {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

.program-step-empty {
    padding: 1rem;
    color: var(--text-2);
    font-size: 0.68rem;
    text-align: center;
}

.program-step-row {
    position: relative;
    gap: 0.2rem;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    padding: 0.36rem 0.3rem;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
    cursor: pointer;
}

.program-step-row.dragging {
    opacity: 0.38;
}

.program-step-row.drag-over-before::before,
.program-step-row.drag-over-after::after {
    position: absolute;
    right: 4px;
    left: 4px;
    z-index: 2;
    height: 3px;
    border-radius: 999px;
    background: #60a5fa;
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.75);
    content: '';
    pointer-events: none;
}

.program-step-row.drag-over-before::before { top: -4px; }
.program-step-row.drag-over-after::after { bottom: -4px; }

.program-step-row.active {
    border-color: rgba(59, 130, 246, 0.8);
    background: rgba(37, 99, 235, 0.12);
}

.program-step-row.running {
    box-shadow: inset 3px 0 0 var(--accent);
}

.program-step-row.delay {
    border-color: rgba(245, 158, 11, 0.32);
}

.program-step-row.delay .program-step-select {
    color: #fbbf24;
}

.program-step-row.timer {
    border-color: rgba(167, 139, 250, 0.38);
}

.program-step-row.timer .program-step-select {
    color: #c4b5fd;
}

.program-step-row.timer .program-step-speed:disabled {
    border-color: transparent;
    background: transparent;
    opacity: 0.55;
}

.program-step-select {
    flex: 0 0 48px;
    min-width: 48px;
    border: 0;
    background: none;
    color: #fff;
    font: 700 0.68rem 'Outfit', sans-serif;
    text-align: left;
    cursor: pointer;
}

.program-point-index {
    display: flex;
    align-items: center;
    gap: 0;
    height: 27px;
    padding: 0;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #121824;
    cursor: text;
}

.program-point-index > span {
    color: #bfdbfe;
    font: 700 0.65rem 'Outfit', sans-serif;
}

.program-point-index > input {
    width: 28px;
    height: 23px;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: center;
    font: 700 0.65rem 'Outfit', sans-serif;
}

.program-command-name {
    display: flex;
    align-items: center;
    overflow: hidden;
    color: #cbd5e1;
    font-size: 0.59rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.program-step-drag-handle {
    flex: 0 0 12px;
    width: 12px;
    height: 27px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 0.56rem;
    cursor: grab;
    touch-action: none;
}

.program-step-drag-handle:hover {
    color: #93c5fd;
}

.program-step-drag-handle:active {
    cursor: grabbing;
}

.program-step-row select,
.program-step-row input {
    min-width: 0;
    height: 27px;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    background: #121824;
    color: #fff;
    font-size: 0.64rem;
}

.program-step-row select { width: 60px; }
.program-step-speed { width: 42px; padding: 0 0.22rem; text-align: right; }
.program-step-unit { width: 24px; color: var(--text-2); font-size: 0.58rem; }
.program-step-label {
    flex: 0 1 82px;
    width: 82px;
    min-width: 0;
    padding: 0 0.28rem;
}

.program-step-label::placeholder { color: #475569; }

.program-step-context-menu {
    position: fixed;
    z-index: 400;
    min-width: 158px;
    padding: 0.28rem;
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 9px;
    background: rgba(13, 18, 28, 0.99);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

.program-step-context-menu [hidden] {
    display: none !important;
}

.program-step-context-menu button {
    display: flex;
    align-items: center;
    gap: 0.48rem;
    width: 100%;
    padding: 0.52rem 0.58rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #e2e8f0;
    font-size: 0.68rem;
    text-align: left;
    cursor: pointer;
}

.program-step-context-menu button:hover {
    background: rgba(37, 99, 235, 0.22);
    color: #fff;
}

.program-step-context-menu button:disabled {
    color: #64748b;
    cursor: not-allowed;
}

.program-step-context-menu button:disabled:hover {
    background: transparent;
    color: #64748b;
}

.program-step-context-menu button.model-context-danger {
    margin-top: 0.24rem;
    border-top: 1px solid rgba(248, 113, 113, 0.24);
    color: #fca5a5;
}

.program-step-context-menu button.model-context-danger:hover {
    background: rgba(127, 29, 29, 0.34);
    color: #fecaca;
}

.model-context-color-control {
    display: flex;
    align-items: center;
    gap: 0.48rem;
    width: 100%;
    padding: 0.42rem 0.58rem;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.68rem;
    cursor: pointer;
}

.model-context-color-control:hover {
    background: rgba(37, 99, 235, 0.22);
    color: #fff;
}

.model-context-color-control input[type="color"] {
    width: 28px;
    height: 20px;
    margin-left: auto;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
}

.simulation-snap-marker {
    --simulation-snap-camera-scale: 1;
    position: absolute;
    z-index: 115;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transform: translate(-7px, -50%);
    pointer-events: none;
}

.simulation-snap-candidate-marker {
    z-index: 112;
}

.simulation-snap-candidate-marker > span {
    opacity: 0.82;
}

.simulation-snap-marker > span {
    display: grid;
    width: 14px;
    height: 14px;
    place-items: center;
    box-sizing: border-box;
    overflow: hidden;
    border: 1.25px solid #f59e0b;
    border-radius: 1px;
    background: transparent;
    color: #f59e0b;
    font-size: 0;
    box-shadow: 0 0 6px rgba(217, 119, 6, 0.68);
    transform: scale(var(--simulation-snap-camera-scale));
    transform-origin: center;
}

.simulation-snap-marker[data-snap-type="endpoint"] > span {
    background: radial-gradient(circle at center, currentColor 0 1.25px, transparent 1.75px);
}

.simulation-snap-marker[data-snap-type="edge-midpoint"] > span {
    transform: rotate(45deg) scale(calc(var(--simulation-snap-camera-scale) * 0.78));
}

.simulation-snap-marker[data-snap-type="circle-center"] > span {
    border-radius: 50%;
}

.simulation-snap-marker[data-snap-type="rectangle-center"] > span {
    border-radius: 2px;
    background: radial-gradient(circle at center, currentColor 0 1.25px, transparent 1.75px);
}

.simulation-snap-marker[data-snap-type="multi-point-center"] > span {
    border-radius: 50%;
    background: radial-gradient(circle at center, currentColor 0 1.25px, transparent 1.75px);
}

.simulation-snap-marker > strong {
    max-width: 250px;
    padding: 0.32rem 0.45rem;
    overflow: hidden;
    border: 1px solid rgba(250, 204, 21, 0.35);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.94);
    color: #fef3c7;
    font-size: 0.58rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.simulation-snap-marker.label-left {
    flex-direction: row-reverse;
    transform: translate(calc(-100% + 7px), -50%);
}

.program-playback {
    display: grid;
    gap: 0.4rem;
}

.program-control-row {
    gap: 0.3rem;
}

.program-control-row > span {
    width: 62px;
    color: var(--text-2);
    font-size: 0.62rem;
}

.program-control-row button {
    min-width: 32px;
}

.program-repeat-toggle.active {
    border-color: rgba(59, 130, 246, 0.85);
    color: #fff;
    background: rgba(37, 99, 235, 0.35);
}

.program-cycle-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    padding: 0.42rem 0.6rem;
    border: 1px solid rgba(167, 139, 250, 0.24);
    border-radius: 8px;
    background: rgba(124, 58, 237, 0.08);
}

.program-cycle-time span {
    color: var(--text-2);
    font: 600 0.62rem 'Outfit', sans-serif;
    letter-spacing: 0.06em;
}

.program-cycle-time strong {
    color: #c4b5fd;
    font: 700 0.75rem 'Outfit', sans-serif;
}

.program-cycle-time strong.measuring {
    color: #fbbf24;
}

.program-file-row {
    justify-content: space-between;
    gap: 0.4rem;
}

.program-file-row button {
    flex: 1;
    min-width: 0;
    padding: 0.3rem 0.24rem;
    font-size: 0.58rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.program-status {
    min-height: 27px;
    padding: 0.45rem 0.75rem;
    color: var(--text-2);
    font-size: 0.62rem;
}

.program-status.error { color: #f87171; }
.program-status.working { color: #60a5fa; }
.program-panel button:disabled,
.program-panel input:disabled,
.program-panel select:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Offline Line Programming workspace */
#program-robot-name { display: none; }
.program-olp-button {
    min-width: 44px !important;
    color: #bfdbfe !important;
    border-color: rgba(96, 165, 250, 0.65) !important;
    background: rgba(37, 99, 235, 0.22) !important;
    font: 800 0.72rem 'Outfit', sans-serif !important;
    letter-spacing: 0.08em;
}
.program-olp-button.active {
    color: #fff !important;
    border-color: #60a5fa !important;
    background: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.18);
}
.olp-robot-control-slot {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    flex: 1 1 auto;
}
.olp-robot-control-slot .program-control-row {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
}
.olp-robot-control-slot code {
    min-width: 0;
    margin-left: 0.15rem;
    overflow: hidden;
    color: #bfdbfe;
    font: 700 0.54rem 'JetBrains Mono', Consolas, monospace;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.olp-workspace {
    display: grid;
    gap: 0.55rem;
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: rgba(30, 41, 59, 0.22);
}
.olp-workspace-header,
.olp-project-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    min-width: 0;
}
.olp-workspace-header > div { display: grid; gap: 0.2rem; min-width: 0; }
.olp-workspace-header strong { color: #93c5fd; font: 800 0.64rem 'Outfit', sans-serif; letter-spacing: 0.08em; }
.olp-workspace-header > div > span { overflow: hidden; color: var(--text-2); font-size: 0.62rem; text-overflow: ellipsis; white-space: nowrap; }
.olp-status-indicators { display: flex; align-items: center; gap: 0.5rem; flex: 0 0 auto; max-width: 100%; }
.olp-status-dot,
.olp-bus-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.olp-status-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    color: #64748b;
    font-size: 0.68rem;
}
/* READY is a program state, not a Virtual Bus connection state.  Keep it
 * neutral so a disconnected bus can never be mistaken for a green link. */
.olp-status-dot.ready { color: #94a3b8; }
.olp-status-dot.running { color: #38bdf8; animation: olp-indicator-pulse 1.15s ease-in-out infinite; }
.olp-status-dot.waiting { color: #facc15; animation: olp-indicator-pulse 1.4s ease-in-out infinite; }
.olp-status-dot.paused { color: #f59e0b; }
.olp-status-dot.stopping { color: #fb923c; animation: olp-indicator-pulse 0.8s ease-in-out infinite; }
.olp-status-dot.stopped { color: #94a3b8; }
.olp-status-dot.loading { color: #c4b5fd; animation: olp-indicator-pulse 1s ease-in-out infinite; }
.olp-status-dot.alarm,
.olp-status-dot.error { color: #f87171; animation: olp-indicator-alarm 0.9s ease-in-out infinite; }
.olp-bus-indicator {
    width: 20px;
    height: 20px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 6px;
    color: #64748b;
    font-size: 0.67rem;
}
.olp-bus-indicator.connected {
    border-color: rgba(74, 222, 128, 0.6);
    color: #4ade80;
    background: rgba(34, 197, 94, 0.12);
}
.olp-bus-indicator.connecting,
.olp-bus-indicator.waiting {
    border-color: rgba(250, 204, 21, 0.58);
    color: #facc15;
    background: rgba(234, 179, 8, 0.1);
    animation: olp-indicator-pulse 1.2s ease-in-out infinite;
}
.olp-bus-indicator.unavailable,
.olp-bus-indicator.disconnected {
    border-color: rgba(148, 163, 184, 0.32);
    color: #64748b;
    background: rgba(100, 116, 139, 0.08);
}
@keyframes olp-indicator-pulse {
    0%, 100% { opacity: 0.58; }
    50% { opacity: 1; }
}
@keyframes olp-indicator-alarm {
    0%, 100% { opacity: 0.62; box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.18); }
    50% { opacity: 1; box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.14); }
}
.olp-toolbar { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.olp-toolbar button { min-height: 26px; padding: 0.25rem 0.42rem; font-size: 0.58rem; }
.olp-file-grid { display: grid; grid-template-columns: minmax(115px, 0.8fr) minmax(0, 1.8fr); gap: 0.4rem; min-height: 140px; }
.olp-file-grid select,
.olp-file-grid textarea {
    min-width: 0;
    color: var(--text-1);
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--border);
    border-radius: 7px;
    font: 0.62rem/1.45 'JetBrains Mono', Consolas, monospace;
}
.olp-file-grid select { padding: 0.25rem; }
.olp-file-grid textarea { width: 100%; min-height: 140px; padding: 0.45rem; resize: vertical; box-sizing: border-box; }
.olp-file-grid textarea.olp-cursor-active { border-color: #38bdf8; box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.16); }
.olp-editor-shell {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.75);
}
.olp-editor-shell:focus-within {
    border-color: rgba(96, 165, 250, 0.72);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.14);
}
.olp-file-gutter {
    position: absolute;
    z-index: 2;
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    width: 2.65rem;
    margin: 0;
    padding: 0.45rem 0.45rem 0.45rem 0.25rem;
    box-sizing: border-box;
    overflow: hidden;
    border-right: 1px solid rgba(148, 163, 184, 0.18);
    color: #64748b;
    background: rgba(15, 23, 42, 0.9);
    font: 0.62rem/1.45 'JetBrains Mono', Consolas, monospace;
    text-align: right;
    white-space: pre;
    user-select: none;
    pointer-events: none;
}
.olp-file-highlight,
.olp-editor-shell textarea {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 2.65rem;
    width: auto;
    height: 100%;
    margin: 0;
    padding: 0.45rem;
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
    font: 0.62rem/1.45 'JetBrains Mono', Consolas, monospace;
    letter-spacing: normal;
    tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
}
.olp-file-highlight {
    z-index: 0;
    overflow: hidden;
    color: #e2e8f0;
    background: transparent;
    pointer-events: none;
}
.olp-editor-shell textarea {
    z-index: 1;
    resize: none;
    outline: none;
    overflow: auto;
    color: transparent;
    -webkit-text-fill-color: transparent;
    caret-color: #f8fafc;
    background: transparent;
}
.olp-editor-shell textarea::selection {
    color: transparent;
    -webkit-text-fill-color: transparent;
    background: rgba(56, 189, 248, 0.28);
}
.olp-editor-shell textarea.olp-cursor-active {
    border: 0;
    box-shadow: none;
}
.olp-point-table {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.98);
}
.olp-point-table-note {
    padding: 0.38rem 0.5rem;
    overflow: hidden;
    color: #93c5fd;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    font: 600 0.58rem/1.35 'Outfit', sans-serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.olp-point-table-scroll {
    min-width: 0;
    min-height: 0;
    overflow: auto;
}
.olp-point-table table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font: 0.6rem/1.35 'JetBrains Mono', Consolas, monospace;
}
.olp-point-table th,
.olp-point-table td {
    padding: 0.34rem 0.42rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    text-align: left;
    white-space: nowrap;
}
.olp-point-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #94a3b8;
    background: #172033;
    font: 700 0.58rem/1.3 'Outfit', sans-serif;
}
.olp-point-table tbody tr { cursor: context-menu; }
.olp-point-table tbody tr:hover { background: rgba(37, 99, 235, 0.16); }
.olp-point-table .olp-point-id { width: 3.1rem; color: #94a3b8; }
.olp-point-table .olp-point-name { min-width: 7rem; color: #38bdf8; }
.olp-point-table td:not(.olp-point-id):not(.olp-point-name) { min-width: 4.6rem; color: #e2e8f0; }
.olp-point-empty { padding: 1rem !important; color: #64748b !important; text-align: center !important; }
.olp-syntax-command { color: #7dd3fc; font-weight: 700; }
.olp-syntax-address { color: #fbbf24; font-weight: 600; }
.olp-syntax-number { color: #86efac; }
.olp-syntax-string { color: #fda4af; }
.olp-syntax-comment { color: #4ade80; font-style: italic; }
.olp-syntax-label { color: #c4b5fd; font-weight: 700; }
.olp-syntax-identifier { color: #e2e8f0; }
.olp-syntax-operator { color: #f0abfc; }
.olp-syntax-punctuation { color: #94a3b8; }
.olp-project-meta { color: var(--text-2); font-size: 0.56rem; }
.olp-project-meta span {
    min-width: 0;
    flex: 1 1 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}
.olp-runtime-panel { display: grid; gap: 0.26rem; padding: 0.45rem; border: 1px solid rgba(96, 165, 250, 0.45); border-radius: 7px; background: rgba(15, 23, 42, 0.78); }
.olp-runtime-heading { display: flex; align-items: center; gap: 0.42rem; min-width: 0; }
.olp-runtime-heading strong { overflow: hidden; color: #e0f2fe; font: 700 0.62rem 'Outfit', sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.olp-runtime-heading code { margin-left: auto; color: #bfdbfe; font: 600 0.56rem 'JetBrains Mono', Consolas, monospace; white-space: nowrap; }
.olp-runtime-badge { min-width: 3.65rem; padding: 0.14rem 0.28rem; border-radius: 4px; color: #0f172a; background: #94a3b8; font: 800 0.5rem 'JetBrains Mono', Consolas, monospace; text-align: center; }
.olp-runtime-badge.running { color: #082f49; background: #38bdf8; }
.olp-runtime-badge.waiting { color: #422006; background: #fbbf24; }
.olp-runtime-badge.paused { color: #312e81; background: #a5b4fc; }
.olp-runtime-badge.stopped, .olp-runtime-badge.completed { color: #052e16; background: #86efac; }
.olp-runtime-badge.error { color: #450a0a; background: #fca5a5; }
.olp-runtime-line { overflow: hidden; color: #f8fafc; font: 0.56rem/1.35 'JetBrains Mono', Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.olp-runtime-stack { overflow: hidden; color: var(--text-2); font: 0.5rem/1.3 'JetBrains Mono', Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.olp-io-monitor { display: grid; gap: 0.35rem; padding: 0.45rem; border: 1px solid rgba(96, 165, 250, 0.3); border-radius: 7px; background: rgba(15, 23, 42, 0.58); }
.olp-io-monitor-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; color: #93c5fd; font: 700 0.56rem 'Outfit', sans-serif; letter-spacing: 0.08em; }
.olp-io-monitor-heading span { overflow: hidden; color: #86efac; font: 500 0.54rem Inter, sans-serif; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }
.olp-io-monitor-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.3rem; }
.olp-io-monitor-cell { display: grid; gap: 0.12rem; min-width: 0; padding: 0.28rem; border-radius: 5px; background: rgba(2, 6, 23, 0.55); }
.olp-io-monitor-cell span { overflow: hidden; color: var(--text-2); font-size: 0.48rem; text-overflow: ellipsis; white-space: nowrap; }
.olp-io-monitor-cell code { color: #bfdbfe; font: 600 0.56rem 'JetBrains Mono', Consolas, monospace; }
.olp-io-monitor-cell b { color: #f8fafc; font: 700 0.62rem 'JetBrains Mono', Consolas, monospace; }
.olp-io-monitor-last { overflow: hidden; color: var(--text-2); font: 0.5rem/1.3 'JetBrains Mono', Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.olp-console { max-height: 95px; min-height: 35px; margin: 0; padding: 0.4rem; overflow: auto; color: #bfdbfe; background: rgba(2, 6, 23, 0.65); border: 1px solid var(--border); border-radius: 6px; cursor: text; font: 0.58rem/1.4 'JetBrains Mono', Consolas, monospace; user-select: text; white-space: pre-wrap; }

/* OLP can be resized independently of the viewport.  Container queries keep
 * the indicators and diagnostic text readable when the panel itself becomes
 * narrow on a wide monitor. */
@container (max-width: 500px) {
    .program-panel.olp-mode-active .olp-workspace-header {
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.35rem;
    }

    .program-panel.olp-mode-active .olp-project-meta {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .program-panel.olp-mode-active .olp-workspace-header > div:first-child {
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .program-panel.olp-mode-active .olp-status-indicators {
        flex: 0 0 auto;
        width: auto;
        margin-left: auto;
        justify-content: flex-end;
        gap: 0.35rem;
    }

    .program-panel.olp-mode-active .olp-project-meta span {
        min-width: 0;
        flex: 1 1 100%;
    }

    .program-panel.olp-mode-active .olp-workspace-header > div > span,
    .program-panel.olp-mode-active .olp-project-meta span,
    .program-panel.olp-mode-active .olp-io-monitor-heading span,
    .program-panel.olp-mode-active .olp-io-monitor-last {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .program-panel.olp-mode-active .olp-project-meta {
        display: grid;
        justify-content: stretch;
        gap: 0.25rem;
    }

    .program-panel.olp-mode-active .olp-file-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(70px, 0.55fr) minmax(150px, 1.45fr);
    }

    .program-panel.olp-mode-active .olp-runtime-heading,
    .program-panel.olp-mode-active .olp-io-monitor-heading {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .program-panel.olp-mode-active .olp-runtime-heading code,
    .program-panel.olp-mode-active .olp-io-monitor-heading span {
        width: 100%;
        margin-left: 0;
    }

    .program-panel.olp-mode-active .olp-runtime-line,
    .program-panel.olp-mode-active .olp-runtime-stack {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .program-panel.olp-mode-active .olp-io-monitor-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.model-tree.motion-locked {
    pointer-events: none;
    opacity: 0.55;
}

.jog-controls {
    display: grid;
    gap: 0.82rem;
}

.tcp-profile-manager {
    margin-bottom: 0.85rem;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.tcp-profile-heading,
.tcp-profile-heading > div,
.tcp-profile-editor-title,
.tcp-profile-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.tcp-profile-heading > div {
    justify-content: flex-start;
}

.tcp-profile-heading span,
.tcp-profile-editor-title span {
    color: #94a3b8;
    font-family: 'Outfit', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.tcp-profile-heading strong {
    color: #93c5fd;
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
}

.tcp-profile-heading button,
.tcp-profile-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 7px;
    background: rgba(37, 99, 235, 0.08);
    color: #bfdbfe;
    font-family: 'Outfit', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
}

.tcp-profile-heading button {
    height: 28px;
    padding: 0 0.55rem;
}

.tcp-profile-heading button:hover,
.tcp-profile-heading button.active,
.tcp-profile-actions button:hover {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, 0.2);
    color: #fff;
}

.tcp-profile-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    margin-top: 0.55rem;
}

.tcp-profile-tabs button {
    height: 30px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.035);
    color: #94a3b8;
    font-family: 'Outfit', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
}

.tcp-profile-tabs button:hover {
    border-color: rgba(96, 165, 250, 0.7);
    color: #bfdbfe;
}

.tcp-profile-tabs button.active {
    border-color: #3b82f6;
    background: rgba(37, 99, 235, 0.82);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}

.tcp-snap-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.45rem;
    margin-top: 0.65rem;
    padding: 0.55rem;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 9px;
    background: rgba(2, 6, 23, 0.28);
}

.tcp-snap-controls label {
    min-width: 0;
    color: #94a3b8;
    font-size: 0.58rem;
}

.tcp-snap-controls label > span {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
    margin-bottom: 0.28rem;
}

.tcp-snap-controls select {
    width: 100%;
    min-width: 0;
    padding: 0.3rem 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.65);
    color: #fff;
    font: inherit;
}

.tcp-snap-controls input[type="range"] {
    width: 100%;
    accent-color: #60a5fa;
}

.tcp-snap-controls output {
    color: #93c5fd;
}

.tcp-snap-readout {
    min-height: 32px;
    margin-top: 0.45rem;
    padding: 0.42rem 0.5rem;
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.62);
    color: #94a3b8;
    font-size: 0.58rem;
    line-height: 1.4;
}

.tcp-multi-center-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.4rem;
    padding: 0.4rem 0.45rem;
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 7px;
    background: rgba(8, 47, 73, 0.28);
}

.tcp-multi-center-controls span {
    color: #a5f3fc;
    font-size: 0.58rem;
}

.tcp-multi-center-controls button,
.tcp-snap-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    min-height: 28px;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 7px;
    background: rgba(37, 99, 235, 0.12);
    color: #bfdbfe;
    font: 700 0.62rem/1 'Outfit', sans-serif;
    cursor: pointer;
}

.tcp-multi-center-controls button {
    padding: 0 0.42rem;
}

.tcp-multi-center-controls button:hover:not(:disabled),
.tcp-snap-button:hover:not(:disabled) {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, 0.25);
    color: #fff;
}

.tcp-multi-center-controls button:disabled,
.tcp-snap-button:disabled {
    opacity: 0.38;
    cursor: default;
}

.tcp-snap-button {
    width: 100%;
    margin-top: 0.45rem;
    border-color: rgba(96, 165, 250, 0.38);
    background: rgba(37, 99, 235, 0.12);
    color: #bfdbfe;
}

.tcp-snap-button.active {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, 0.82);
    color: #fff;
}

.tcp-profile-editor {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(96, 165, 250, 0.18);
}

.tcp-profile-editor-title strong {
    color: #e2e8f0;
    font-size: 0.7rem;
}

.tcp-profile-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, auto);
    grid-auto-flow: column;
    gap: 0.38rem 0.5rem;
    margin-top: 0.55rem;
}

.tcp-profile-fields label {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 23px;
    align-items: center;
    gap: 0.25rem;
    color: #cbd5e1;
    font-family: 'Outfit', sans-serif;
    font-size: 0.66rem;
}

.tcp-profile-fields input {
    min-width: 0;
    width: 100%;
    padding: 0.32rem 0.28rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    text-align: right;
    font: inherit;
    font-variant-numeric: tabular-nums;
}

.tcp-profile-fields input:focus {
    border-color: #60a5fa;
}

.tcp-profile-fields small {
    color: #64748b;
    font-size: 0.58rem;
}

.tcp-profile-fields .tcp-axis-alias {
    margin-left: 0.1rem;
    color: #64748b;
    font-size: 0.5rem;
    font-weight: 600;
    vertical-align: 0.06em;
}

.tcp-profile-actions {
    justify-content: flex-end;
    margin-top: 0.6rem;
}

.tcp-profile-actions button {
    min-height: 29px;
    padding: 0 0.65rem;
}

.tcp-profile-actions button.primary {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.tcp-profile-status {
    margin-top: 0.5rem;
    color: #94a3b8;
    font-size: 0.62rem;
    line-height: 1.4;
}

.tcp-profile-status.success { color: #86efac; }
.tcp-profile-status.error { color: #fca5a5; }

.jog-mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding: 0.25rem;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.2);
}

.jog-mode-btn {
    padding: 0.5rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-family: 'Outfit', sans-serif;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
}

.jog-mode-btn.active {
    background: rgba(37, 99, 235, 0.9);
    color: #fff;
    box-shadow: 0 5px 14px rgba(37, 99, 235, 0.25);
}

.base-step-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.base-step-settings label {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-2);
    font-size: 0.7rem;
}

.base-step-settings input {
    min-width: 0;
    width: 100%;
    padding: 0.35rem 0.3rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    outline: none;
    background: rgba(255,255,255,0.06);
    color: #fff;
    text-align: right;
    font-family: 'Outfit', sans-serif;
}

.base-step-settings input:focus {
    border-color: var(--accent);
}

.base-gizmo-mode {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.jog-mode-btn.jog-snap-move {
    font-size: 0.66rem;
    letter-spacing: 0.03em;
}

.base-gizmo-mode button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.38rem;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: #94a3b8;
    font-family: 'Outfit', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
}

.base-gizmo-mode button:hover,
.base-gizmo-mode button.active {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(37, 99, 235, 0.2);
    color: #fff;
}

.base-jog-section + .base-jog-section {
    margin-top: 1rem;
}

.base-jog-title {
    display: block;
    margin-bottom: 0.45rem;
    color: #64748b;
    font-family: 'Outfit', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.base-jog-grid {
    display: grid;
    gap: 0.4rem;
}

.base-jog-row {
    display: grid;
    grid-template-columns: 30px 76px minmax(0, 1fr);
    align-items: center;
    gap: 0.4rem;
}

.base-jog-row strong {
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
}

.base-jog-row button {
    height: 32px;
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.14);
    color: #93c5fd;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.base-jog-buttons {
    display: grid;
    grid-template-columns: repeat(2, 38px);
}

.base-jog-buttons button:first-child {
    border-radius: 8px 0 0 8px;
    border-right-width: 0;
}

.base-jog-buttons button:last-child {
    border-radius: 0 8px 8px 0;
}

.base-jog-buttons button:first-child:hover,
.base-jog-buttons button:first-child:active,
.base-jog-buttons button:first-child.is-held {
    border-right-width: 1px;
}

.base-jog-row button:hover {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, 0.28);
    color: #fff;
}

.base-jog-row button.is-held,
.base-jog-row button:active {
    border-color: #93c5fd;
    background: rgba(37, 99, 235, 0.55);
    color: #fff;
    transform: translateY(1px);
}

.base-jog-value {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.2rem;
    color: #cbd5e1;
    font-family: 'Outfit', sans-serif;
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
}

.base-jog-value input {
    width: 70px;
    min-width: 0;
    padding: 0.34rem 0.3rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    text-align: right;
    font: inherit;
    font-variant-numeric: tabular-nums;
}

.base-jog-value input:focus {
    border-color: var(--accent);
}

.base-jog-status {
    margin-top: 0.9rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.1);
    color: #86efac;
    font-size: 0.7rem;
    line-height: 1.35;
}

.base-jog-status.working {
    background: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
}

.base-jog-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.jog-row {
    display: grid;
    grid-template-columns: 1fr 68px;
    align-items: center;
    gap: 0.45rem 0.75rem;
}

.jog-row-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.76rem;
}

.jog-row-heading strong {
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.84rem;
}

.jog-row-heading span {
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.jog-row input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

.jog-value {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.2rem;
    color: var(--text-2);
    font-size: 0.8rem;
}

.jog-value input {
    width: 52px;
    padding: 0.35rem 0.3rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: rgba(255,255,255,0.06);
    color: #fff;
    text-align: right;
    font-family: 'Outfit', sans-serif;
    font-variant-numeric: tabular-nums;
}

.jog-value input:focus {
    border-color: var(--accent);
}

@media (max-width: 768px) {
    .viewer-control-dock {
        gap: 0.16rem;
    }

    .viewer-control-dock [data-panel-toggle] {
        width: 30px;
        padding: 0;
        font-size: 0;
    }

    .viewer-control-dock [data-panel-toggle] i {
        font-size: 0.7rem;
    }

    .model-browser-panel {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: 44%;
    }

    .model-tree {
        max-height: 150px;
    }

    .jog-panel {
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-height: 48%;
        padding: 0.9rem;
    }

    .program-panel {
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-height: 58%;
        transform: none;
    }

    .tcp-profile-panel {
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-height: 58%;
    }

    .virtual-controller-panel {
        top: 12px;
        right: 12px;
        bottom: auto;
        left: 12px;
        width: auto;
        max-height: 48%;
    }

    .view-presets-panel {
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-height: 58%;
    }

    .view-window {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        height: min(58%, calc(100% - 24px));
        min-width: 0;
        min-height: 180px;
        transform: none;
    }

    .program-robot-list {
        grid-template-columns: 1fr;
    }

    #btn-test-model span,
    #btn-import-3d span,
    #btn-download-cad span { display: none; }
    #btn-test-model,
    #btn-import-3d,
    #btn-download-cad { min-width: 44px; width: 44px; padding: 0; }

    .position-value-grid.pose-grid,
    .position-value-grid.external-grid,
    .position-value-grid.arm-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .program-panel.olp-mode-active {
        top: 12px;
        right: auto;
        bottom: auto;
        left: 12px;
        width: min(480px, calc(100% - 24px));
        height: min(760px, calc(100% - 24px));
        max-width: calc(100% - 24px);
        max-height: calc(100% - 24px);
    }
}

.panel-user-hidden {
    display: none !important;
}

.panel-popout-body {
    min-height: 100vh;
    padding: 10px;
    overflow: hidden;
    background: #0b0e14;
}

.panel-popout {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: calc(100vh - 20px);
    max-height: none !important;
    border-radius: 12px !important;
}

/* OLP's canvas-sized placement must not leak into its separate window. */
.panel-popout.program-panel.olp-mode-active {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
    height: calc(100vh - 20px) !important;
    max-width: none !important;
    max-height: none !important;
}

.panel-popout .model-tree {
    max-height: 36vh;
}

.hidden { display: none !important; opacity: 0; }
/* Mesh-accurate collision feedback */
.collision-status {
    position: absolute;
    top: 0.9rem;
    left: 50%;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: min(90%, 520px);
    padding: 0.58rem 0.82rem;
    border: 1px solid rgba(248, 113, 113, 0.72);
    border-radius: 0.6rem;
    color: #fee2e2;
    background: rgba(127, 29, 29, 0.9);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    font-size: 0.78rem;
    font-weight: 700;
    pointer-events: none;
    transform: translateX(-50%);
}

.collision-status.hidden { display: none; }
.collision-status i { color: #fca5a5; }

/* Interference zones */
.interference-zone-panel {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 390px;
    max-height: calc(100% - 36px);
    display: flex;
    flex-direction: column;
    z-index: 40;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(2, 6, 23, 0.45);
    overflow: hidden;
}
.interference-zone-header,
.interference-zone-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(30, 41, 59, 0.9);
}
.interference-zone-dialog-header { cursor: move; user-select: none; touch-action: none; }
.interference-zone-dialog-header button { cursor: pointer; }
.interference-zone-dialog.interference-zone-is-dragging { user-select: none; }
.interference-zone-header h2,
.interference-zone-dialog-header h2 { margin: 0; font-size: 16px; }
.interference-zone-header h2 i { color: #f59e0b; margin-right: 7px; }
.interference-zone-content { padding: 14px; overflow: auto; }
.interference-zone-help { margin: 0 0 12px; color: #94a3b8; font-size: 12px; line-height: 1.45; }
.interference-zone-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.interference-zone-toolbar strong { font-size: 12px; color: #cbd5e1; }
.interference-zone-toolbar button,
.interference-zone-dialog button { border: 1px solid rgba(148, 163, 184, 0.34); border-radius: 7px; color: #e2e8f0; background: rgba(51, 65, 85, 0.72); padding: 7px 10px; cursor: pointer; }
.interference-zone-toolbar button:hover,
.interference-zone-dialog button:hover { border-color: #60a5fa; }
.interference-zone-toolbar button.secondary,
.interference-zone-dialog button.secondary { background: rgba(30, 41, 59, 0.9); }
.interference-zone-dialog button.primary { border-color: #2563eb; background: #2563eb; }
.interference-zone-list { display: grid; gap: 4px; }
.end-monitoring-section { margin-top: 15px; padding-top: 12px; border-top: 1px solid rgba(148, 163, 184, 0.2); }
.end-monitoring-list { display: grid; gap: 4px; }
.end-monitoring-row { display: grid; grid-template-columns: 28px minmax(55px, 1fr) 70px 58px 46px; align-items: center; gap: 5px; min-height: 32px; padding: 3px 6px; border-radius: 7px; background: rgba(30, 41, 59, 0.72); font-size: 11px; }
.end-monitoring-row:nth-child(even) { background: rgba(51, 65, 85, 0.5); }
.end-monitoring-row strong { color: #cbd5e1; text-align: center; }
.end-monitoring-row span { overflow: hidden; color: #94a3b8; text-overflow: ellipsis; white-space: nowrap; }
.end-monitoring-row em { color: #60a5fa; font-style: normal; text-align: center; }
.end-monitoring-row button { padding: 5px 4px; color: #93c5fd; background: transparent; border: 0; cursor: pointer; }
.end-monitoring-read { color: #86efac !important; font-size: 10px; }
.end-monitoring-read:disabled { color: #64748b !important; cursor: not-allowed; }
.end-monitoring-type-fields { margin-top: 14px; }
.end-monitoring-tcp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; border-radius: 8px; background: rgba(30, 41, 59, 0.72); color: #cbd5e1; font-size: 12px; }
.end-monitoring-tcp-grid input { accent-color: #2563eb; }
.end-monitoring-cuboid-method { margin-top: 10px; }
.end-monitoring-four-point-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.end-monitoring-four-point-grid > div { display: grid; grid-template-columns: auto auto; align-items: center; justify-content: start; gap: 7px; color: #cbd5e1; font-size: 11px; }
.end-monitoring-four-point-grid .interference-coordinate-grid { grid-column: 1 / -1; }
.end-monitoring-height { display: grid; grid-template-columns: 1fr minmax(90px, 160px) auto; align-items: center; gap: 7px; color: #cbd5e1; font-size: 11px; }
.end-monitoring-height input { min-width: 0; padding: 8px; color: #e2e8f0; background: #1e293b; border: 1px solid #475569; border-radius: 6px; }
.end-monitoring-height small { color: #64748b; }
.interference-zone-row { display: grid; grid-template-columns: 28px 30px minmax(55px, 1fr) 52px 58px 46px; align-items: center; gap: 5px; min-height: 34px; padding: 3px 6px; border: 1px solid transparent; border-radius: 7px; background: rgba(30, 41, 59, 0.72); font-size: 12px; }
.interference-zone-row:nth-child(even) { background: rgba(51, 65, 85, 0.5); }
.interference-zone-row.status-active { border-color: rgba(37, 99, 235, 0.3); }
.interference-zone-row.status-danger { border-color: rgba(245, 158, 11, 0.75); background: rgba(120, 53, 15, 0.35); }
.interference-zone-row.status-stopped { border-color: rgba(239, 68, 68, 0.9); background: rgba(127, 29, 29, 0.42); }
.interference-zone-number { color: #cbd5e1; text-align: center; }
.interference-zone-remarks { overflow: hidden; color: #94a3b8; text-overflow: ellipsis; white-space: nowrap; }
.interference-zone-state { color: #60a5fa; font-size: 11px; text-align: center; }
.status-danger .interference-zone-state { color: #fbbf24; }
.status-stopped .interference-zone-state { color: #fca5a5; }
.interference-zone-read { padding: 5px 3px !important; color: #86efac !important; background: transparent !important; border: 0 !important; cursor: pointer; font-size: 10px; }
.interference-zone-read:disabled { color: #64748b !important; cursor: not-allowed; }
.interference-zone-edit { padding: 5px 4px !important; color: #93c5fd !important; background: transparent !important; border: 0 !important; }
.interference-zone-activate { display: flex; justify-content: center; cursor: pointer; }
.interference-zone-activate input { accent-color: #2563eb; }
.interference-io-section { margin-top: 15px; padding-top: 12px; border-top: 1px solid rgba(148, 163, 184, 0.2); }
.interference-io-heading { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 11px; }
.interference-io-heading span { color: #64748b; }
.interference-io-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.interference-io-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 6px; color: #cbd5e1; background: rgba(51, 65, 85, 0.65); font-size: 10px; }
.interference-io-chip input { margin: 0; accent-color: #22c55e; }
.interference-io-chip.output { min-width: 45px; justify-content: space-between; }
.interference-io-chip.output strong { color: #64748b; font-size: 9px; }
.interference-io-chip.output.on strong { color: #4ade80; }
.interference-io-chip.output.off strong { color: #f87171; }

.interference-zone-dialog { position: fixed; top: 50%; left: 50%; width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 32px); margin: 0; padding: 0; overflow: auto; transform: translate(-50%, -50%); color: #e2e8f0; background: #0f172a; border: 1px solid rgba(148, 163, 184, 0.35); border-radius: 14px; box-shadow: 0 24px 80px rgba(2, 6, 23, 0.65); }
.interference-zone-dialog::backdrop { display: none; }
.interference-zone-dialog form { margin: 0; }
.interference-zone-dialog-header > div > span { color: #64748b; font-size: 10px; letter-spacing: .12em; }
.interference-zone-dialog-header button { width: 32px; height: 32px; padding: 0; background: transparent; border: 0; }
.interference-zone-step-tabs { display: flex; gap: 8px; padding: 12px 16px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.16); }
.interference-zone-step-tabs span { padding: 8px 10px; color: #64748b; border-bottom: 2px solid transparent; font-size: 12px; }
.interference-zone-step-tabs span.active { color: #93c5fd; border-color: #2563eb; }
.interference-zone-step { padding: 16px; }
.interference-zone-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.interference-zone-field-grid label,
.interference-zone-method,
.interference-zone-coordinate-grid label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; color: #94a3b8; font-size: 11px; }
.interference-zone-field-grid label.wide { grid-column: 1 / -1; }
.interference-zone-field-grid input,
.interference-zone-field-grid select,
.interference-zone-method select,
.interference-coordinate-grid input,
.interference-signal-row input[type=number] { min-width: 0; padding: 8px; color: #e2e8f0; background: #1e293b; border: 1px solid #475569; border-radius: 6px; }
.interference-zone-field-grid label.wide input { grid-column: 1 / -1; }
.interference-zone-field-grid small { grid-column: 2; color: #64748b; }
.interference-signal-grid { display: grid; gap: 8px; margin-top: 15px; }
.interference-signal-row { display: grid; grid-template-columns: 20px 36px 90px 1fr; align-items: center; gap: 8px; color: #cbd5e1; font-size: 12px; }
.interference-signal-row input[type=checkbox] { accent-color: #2563eb; }
.interference-signal-row small { color: #64748b; }
.interference-zone-note { margin: 14px 0 0; color: #64748b; font-size: 11px; line-height: 1.5; }
.interference-zone-method { grid-template-columns: 130px 1fr; margin-bottom: 12px; }
.interference-point-block { display: grid; gap: 9px; padding: 12px; background: rgba(30, 41, 59, 0.72); border-radius: 8px; }
.interference-point-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #cbd5e1; font-size: 12px; }
.interference-point-heading button { padding: 5px 8px; font-size: 10px; }
.interference-coordinate-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.interference-coordinate-grid label { grid-template-columns: 22px 1fr; color: #cbd5e1; }
.interference-coordinate-grid input { width: 100%; box-sizing: border-box; }
.interference-zone-validation { display: none; margin: 12px 0 0; color: #fca5a5; font-size: 11px; line-height: 1.45; }
.interference-zone-validation.visible { display: block; }
.interference-zone-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid rgba(148, 163, 184, 0.16); }

@media (max-width: 720px) {
    .interference-zone-panel { top: 8px; right: 8px; width: min(390px, calc(100% - 16px)); max-height: calc(100% - 16px); }
    .interference-zone-field-grid { grid-template-columns: 1fr; }
    .interference-zone-field-grid label.wide { grid-column: auto; }
    .end-monitoring-four-point-grid { grid-template-columns: 1fr; }
}

#btn-toggle-collision {
    flex: 0 0 30px;
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    gap: 0;
}

#btn-toggle-collision span {
    display: none;
}

/* Keep the interference editor aligned with the shared simulation-panel UI. */
.interference-zone-panel,
.interference-zone-dialog {
    color: var(--text-1);
    background: rgba(13, 18, 28, 0.95);
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.interference-zone-header,
.interference-zone-dialog-header {
    min-height: 48px;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

.interference-zone-header h2,
.interference-zone-dialog-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.interference-zone-dialog-header > div > span {
    color: #60a5fa;
    font-family: 'Outfit', sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.interference-zone-dialog-header button,
.interference-zone-panel .panel-header-actions button {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-2);
}

.interference-zone-dialog-header button:hover,
.interference-zone-panel .panel-header-actions button:hover {
    border-color: var(--accent);
    color: #fff;
}

.interference-zone-content {
    padding: 0.8rem 0.85rem 0.95rem;
}

.interference-zone-dialog form {
    color: var(--text-1);
}

.interference-zone-step-tabs {
    gap: 0.2rem;
    padding: 0.65rem 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.interference-zone-step-tabs span {
    padding: 0.55rem 0.65rem;
    color: var(--text-2);
    font: 700 0.62rem 'Outfit', sans-serif;
    letter-spacing: 0.04em;
}

.interference-zone-step-tabs span.active {
    color: #bfdbfe;
    border-color: var(--accent);
}

.interference-zone-step {
    padding: 0.85rem;
}

.interference-zone-field-grid label,
.interference-zone-method,
.interference-zone-coordinate-grid label,
.interference-signal-row {
    color: var(--text-2);
    font-size: 0.64rem;
}

.interference-zone-field-grid input,
.interference-zone-field-grid select,
.interference-zone-method select,
.interference-coordinate-grid input,
.interference-signal-row input[type=number] {
    height: 34px;
    padding: 0 0.6rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
    background: #151b27;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
}

.interference-zone-field-grid input:focus,
.interference-zone-field-grid select:focus,
.interference-zone-method select:focus,
.interference-coordinate-grid input:focus,
.interference-signal-row input[type=number]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.interference-zone-toolbar button,
.interference-zone-dialog button {
    min-height: 28px;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-2);
    font-size: 0.66rem;
    font-weight: 600;
}

.interference-zone-toolbar button:hover,
.interference-zone-dialog button:hover {
    border-color: var(--accent);
    color: #fff;
}

.interference-zone-dialog button.primary {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: #bfdbfe;
}

.interference-zone-row {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.035);
}

.interference-zone-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.interference-zone-row.status-active {
    border-color: rgba(0, 122, 255, 0.38);
    background: var(--accent-dim);
}

.interference-zone-state {
    color: #93c5fd;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

.interference-io-chip,
.interference-point-block {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
}

.interference-zone-dialog-actions {
    gap: 0.45rem;
    padding: 0.7rem 0.85rem 0.85rem;
    border-top: 1px solid var(--border);
}

#panel-launcher button[data-panel-toggle="interference-zone-panel"].interference-zone-launcher-active > i {
    color: #4ade80;
}

#panel-launcher button[data-panel-toggle="interference-zone-panel"].interference-zone-launcher-alert > i {
    color: #f87171;
}
