.outer {
    width: 100%;
    min-height: 100vh;
}

.ide {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #2a2230;
    overflow-y: auto;
    background-color: #0d0b0f;
    color: #e0ceed;
    font-family: monospace;
    font-size: 11pt;
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
    overflow: hidden;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

h1 {
    text-align: center;
}

.repl-text {
    color: #e0ceed;
    background-color: #110e13;
    font-size: clamp(10pt, 2.5vw, 12pt);
    font-family: monospace;
}

.repl {
    display: flex;
    flex-direction: column;
    white-space: pre;
    padding: 0;
    border-radius: 4px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.repl .log {
    white-space: pre-wrap;
    color: #e0ceed;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: 0.5rem;
}

.repl .prompt {
    white-space: pre;
    display: flex;
    align-items: flex-start;
    padding: 0.25rem 1rem;
    border-top: 1px solid #1a1520;
    flex-shrink: 0;
}

.repl .prompt textarea {
    flex-grow: 100;
    border: 0;
    padding: 0;
    color: #e0ceed;
    background-color: transparent;
    resize: none;
    overflow: hidden;
    min-height: 1.5em;
}

.repl .prompt textarea:focus {
    outline:none;
}

.repl .prompt .prompt-text {
    color: #a8e6cf;
    user-select: none;
    padding-right: 0.25em;
    flex-shrink: 0;
}

.repl .prompt:focus-within {
    box-shadow: none;
}

.prompt-text { color: #8b7b96; }
.input-text  { color: #e0ceed; }
.result-text { color: #a8e6cf; }
.error-text  { color: #ff6b6b; }
.output-text { color: #e0ceed; }
.info-text   { color: #b8a8c8; }
.heading-text { color: #c4a7e7; }
.accent-text  { color: #a8e6cf; }
.dim-text     { color: #6b5b7b; }
.title-text   { color: #c4a7e7; font-size: 1.4em; }
.tagline-text { color: #f6c177; }

.paren-indicator {
    color: #8b7b96;
    padding-left: 0.5em;
    font-size: 0.9em;
}

/* Sidebar header */
.sidebar-header {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #2a2230;
    flex-shrink: 0;
}
.sidebar-title {
    color: #8b7b96;
    font-size: 10pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.sidebar-toggle {
    cursor: pointer;
    color: #8b7b96;
    padding: 0 0.5rem;
    user-select: none;
}
.sidebar-toggle:hover { color: #e0ceed; }

/* Expand tab (visible when sidebar collapsed) */
.expand-tab {
    position: absolute;
    top: 0.5rem;
    left: 0.25rem;
    cursor: pointer;
    color: #8b7b96;
    font-family: monospace;
    font-size: 11pt;
    z-index: 1;
    user-select: none;
    padding: 0.25rem;
}
.expand-tab:hover { color: #e0ceed; }

/* Org list items */
.org-item {
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.org-item:hover { background-color: #1a1520; }
.org-item.selected { background-color: #1e1828; }
.org-item.active .org-name { color: #a8e6cf; }
.org-name { flex: 1; }
.org-action {
    color: #8b7b96;
    font-size: 10pt;
    cursor: pointer;
}
.org-action:hover { color: #e0ceed; }

/* Inspector detail (unified view) */
.org-detail {
    border-top: 1px solid #2a2230;
    padding: 0.5rem 0;
}
.section-header {
    color: #8b7b96;
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.5rem 0.75rem 0.25rem;
    border-bottom: 1px solid #1a1520;
    margin-top: 0.25rem;
}
.section-header:first-child { margin-top: 0; }
.inspector-row {
    padding: 0.15rem 0.75rem;
    font-size: 10pt;
    color: #b8a8c8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.inspector-row .name { color: #e0ceed; }
.inspector-row .value { color: #8b7b96; }
.inspector-row .version { color: #a8e6cf; }
.inspector-row .expressor-id { color: #b8a8c8; }

/* Empty state + detail header */
.sidebar-empty {
    color: #8b7b96;
    padding: 1rem 0.75rem;
    font-size: 10pt;
    white-space: pre-wrap;
}
.detail-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #2a2230;
}
.detail-header .org-name {
    flex: 1;
    color: #e0ceed;
}
.detail-header .org-action {
    color: #8b7b96;
    font-size: 10pt;
    cursor: pointer;
}
.detail-header .org-action:hover { color: #e0ceed; }

/* Delete button */
.org-delete { color: #ff6b6b; margin-left: 0.5rem; }
.org-delete:hover { color: #ff4444; }

/* Clickable inspector items */
.clickable { cursor: pointer; }
.clickable:hover { text-decoration: underline; }

/* Expressor filter */
.active-filter { background-color: #1e1828; }
.filter-badge { color: #ff6b6b; font-size: 9pt; cursor: pointer; margin-left: 0.5rem; }
.filter-badge:hover { color: #ff4444; }

/* Tab bar */
.tab-bar {
    display: flex;
    border-bottom: 1px solid #2a2230;
    background-color: #0d0b0f;
    flex-shrink: 0;
    overflow-x: auto;
    font-family: monospace;
    font-size: 10pt;
}
.tab {
    padding: 0.4rem 0.75rem;
    color: #8b7b96;
    cursor: pointer;
    white-space: nowrap;
    border-right: 1px solid #1a1520;
    user-select: none;
}
.tab:hover { background-color: #1a1520; color: #e0ceed; }
.tab-active { color: #a8e6cf; background-color: #110e13; border-bottom: 2px solid #a8e6cf; }

/* Ghost text autocomplete suggestion */
.ghost-text-suggestion {
    color: #4a4450;
    pointer-events: none;
    font-family: monospace;
    font-size: 12pt;
}

/* Code Viewer */
.code-viewer {
    position: fixed;
    top: 0;
    right: 0;
    width: 45%;
    height: 100vh;
    background-color: #0d0b0f;
    border-left: 1px solid #2a2230;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.code-viewer-header {
    padding: 0.75rem;
    border-bottom: 1px solid #2a2230;
    color: #8b7b96;
    font-size: 10pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: monospace;
    flex-shrink: 0;
}

.code-viewer-content {
    flex: 1;
    margin: 0;
    padding: 1rem;
    overflow: auto;
    color: #e0ceed;
    background-color: #0d0b0f;
    font-family: monospace;
    font-size: 11pt;
    line-height: 1.5;
    white-space: pre;
    tab-size: 2;
}

/* Terminal mount for xterm.js */
.terminal-mount {
    flex: 1;
    padding: 0;
    overflow: hidden;
}
.terminal-mount .xterm {
    height: 100%;
}
.code-viewer-header .cp-btn {
    margin-left: 0.5rem;
    font-size: 9pt;
    padding: 0.1rem 0.4rem;
}

/* Governed UI widgets — rendered from org's ui-widgets binding */
.ui-widgets:not(:empty) {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #1a1520;
    color: #e0ceed;
    font-family: monospace;
    font-size: 11pt;
}

/* Adjust main layout to accommodate code viewer */
body:has(.code-viewer) .ide {
    margin-right: 45%;
}

/* ── Control Panel ───────────────────────────────────────────────────── */

.action-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid #2a2230;
    background-color: #0d0b0f;
    font-family: monospace;
    font-size: 10pt;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.cp-btn {
    padding: 0.2rem 0.6rem;
    color: #b8a8c8;
    background-color: #1a1520;
    border: 1px solid #2a2230;
    border-radius: 3px;
    cursor: pointer;
    user-select: none;
    font-family: monospace;
    font-size: 10pt;
    white-space: nowrap;
}
.cp-btn:hover {
    color: #e0ceed;
    background-color: #1e1828;
    border-color: #3a3240;
}

.cp-btn-primary {
    color: #a8e6cf;
    border-color: #2a4a3a;
}
.cp-btn-primary:hover {
    background-color: #1a2a22;
    border-color: #3a6a4a;
}

.cp-btn-danger {
    color: #ff6b6b;
    border-color: #4a2a2a;
}
.cp-btn-danger:hover {
    background-color: #2a1a1a;
    border-color: #6a3a3a;
}

.cp-action {
    color: #8b7b96;
    cursor: pointer;
    padding: 0.25rem 0.75rem;
    font-family: monospace;
    font-size: 10pt;
}
.cp-action:hover {
    color: #a8e6cf;
}

.cp-form {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #1a1520;
}

.cp-input {
    width: calc(100% - 1rem);
    padding: 0.3rem 0.5rem;
    margin-bottom: 0.4rem;
    color: #e0ceed;
    background-color: #110e13;
    border: 1px solid #2a2230;
    border-radius: 3px;
    font-family: monospace;
    font-size: 10pt;
    outline: none;
    box-sizing: border-box;
}
.cp-input:focus {
    border-color: #a8e6cf;
    box-shadow: 0 0 4px rgba(168, 230, 207, 0.1);
}
.cp-input::placeholder {
    color: #4a4450;
}

.cp-btn-row {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.3rem;
}

.cp-status {
    color: #8b7b96;
    font-size: 9pt;
    margin-left: auto;
    font-family: monospace;
}
.cp-status-connected {
    color: #a8e6cf;
}
.cp-status-disconnected {
    color: #ff6b6b;
}

.inspector-actions {
    padding: 0.4rem 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    border-bottom: 1px solid #1a1520;
}

.cp-confirm {
    color: #ff6b6b;
    font-size: 10pt;
    font-family: monospace;
    padding: 0.2rem 0.4rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 0; border-right: none; overflow: hidden; }
    .repl .prompt { padding: 0.25rem 0; }

    .code-viewer {
        width: 100%;
        height: 40vh;
        top: auto;
        bottom: 0;
        border-left: none;
        border-top: 1px solid #2a2230;
    }

    body:has(.code-viewer) .ide {
        margin-right: 0;
        margin-bottom: 40vh;
    }
}
