:root[data-theme="dark"] {
    --bg-chrome: #141518;
    --bg-sidebar: #181a1f;
    --bg-editor: #1c1e24;
    --bg-elevated: #22252d;
    --bg-hover: #262933;
    --bg-active: #2b2f3a;
    --border-subtle: #272a33;
    --border-strong: #353946;
    --text-primary: #d9dde6;
    --text-secondary: #98a0b3;
    --text-muted: #6c7386;
    --accent: #4c8bf5;
    --accent-hover: #5e97f7;
    --accent-fg: #ffffff;
    --accent-soft: rgba(76, 139, 245, 0.14);
    --error: #e5534b;
    --warn: #d29922;
    --success: #3fb950;
    --shadow-modal: 0 18px 42px rgba(0, 0, 0, 0.55);
    --stage-bg: #111216;
    --kbd-bg: #1c1e24;
    --focus-ring: rgba(76, 139, 245, 0.65);
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg-chrome: #f3f4f6;
    --bg-sidebar: #f7f8fa;
    --bg-editor: #ffffff;
    --bg-elevated: #ffffff;
    --bg-hover: #eaedf2;
    --bg-active: #e2e6ee;
    --border-subtle: #e1e4ea;
    --border-strong: #cfd5df;
    --text-primary: #1c2026;
    --text-secondary: #525965;
    --text-muted: #7a8291;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-fg: #ffffff;
    --accent-soft: rgba(37, 99, 235, 0.1);
    --error: #c9372c;
    --warn: #9f6b00;
    --success: #1a7f37;
    --shadow-modal: 0 16px 36px rgba(15, 23, 42, 0.14);
    --stage-bg: #eef0f4;
    --kbd-bg: #f3f4f6;
    --focus-ring: rgba(37, 99, 235, 0.5);
    color-scheme: light;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: var(--bg-chrome);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

button, input, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: -2px;
}

.hidden {
    display: none !important;
}

.tabular {
    font-variant-numeric: tabular-nums;
}

/* Webicon Baseline Alignment */
[class^="ri-"],
[class*=" ri-"],
[class^="devicon-"],
[class*=" devicon-"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-style: normal;
    flex-shrink: 0;
}

.chrome-btn i { font-size: 15px; }
.btn-run i { font-size: 13px; }
.activity-btn i { font-size: 18px; }
.panel-icon-btn i { font-size: 15px; }
.viewport-btn i { font-size: 13px; }
.icon-btn i { font-size: 16px; }
.brand-icon { font-size: 15px; }
.command-trigger i { font-size: 13px; }
.cmd-input-wrapper i { font-size: 15px; }
.breadcrumb-sep { font-size: 13px; color: var(--text-muted); }

/* Subtle Thin Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}
*:hover::-webkit-scrollbar-thumb {
    background: var(--border-strong);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================
   Shell Grid
   ========================================== */
.ide-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ==========================================
   Titlebar (38px crisp desktop IDE chrome)
   ========================================== */
.titlebar {
    height: 38px;
    background: var(--bg-chrome);
    border-bottom: 1px solid var(--border-subtle);
    display: grid;
    grid-template-columns: 1fr minmax(200px, 400px) 1fr;
    align-items: center;
    padding: 0 10px;
    gap: 12px;
    flex-shrink: 0;
    user-select: none;
}

.titlebar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 12.5px;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.brand-icon {
    color: var(--text-secondary);
}

.titlebar-center {
    display: flex;
    justify-content: center;
    min-width: 0;
}

.command-trigger {
    width: 100%;
    max-width: 380px;
    height: 26px;
    padding: 0 8px 0 10px;
    border-radius: 5px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.command-trigger:hover {
    border-color: var(--border-strong);
    background: var(--bg-editor);
    color: var(--text-primary);
}

.command-trigger-label {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-trigger kbd,
.cmd-esc,
.cmd-shortcut {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: var(--text-muted);
    background: var(--kbd-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 1px 5px;
    white-space: nowrap;
    line-height: 1.4;
}

.titlebar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.chrome-btn {
    height: 26px;
    min-width: 26px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 120ms ease, color 120ms ease;
}

.chrome-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chrome-btn.active {
    background: var(--bg-active);
    color: var(--text-primary);
}

.btn-run {
    height: 26px;
    padding: 0 10px;
    margin-left: 4px;
    border-radius: 5px;
    border: 1px solid transparent;
    background: var(--accent);
    color: var(--accent-fg);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 120ms ease;
}

.btn-run:hover {
    background: var(--accent-hover);
}

/* ==========================================
   Workbench
   ========================================== */
.workbench {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

/* Activity Bar (44px) */
.activity-bar {
    width: 44px;
    background: var(--bg-chrome);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    flex-shrink: 0;
    user-select: none;
}

.activity-top,
.activity-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.activity-btn {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: color 120ms ease, background-color 120ms ease;
}

.activity-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.activity-btn.active {
    color: var(--text-primary);
    background: var(--bg-active);
}

/* Side Panel (Explorer & Search) */
.side-panel {
    width: 224px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-width: 0;
    user-select: none;
}

.side-panel.collapsed {
    display: none;
}

.panel-view {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.panel-view.active {
    display: flex;
}

.panel-header {
    height: 35px;
    padding: 0 10px 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.panel-title {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.panel-icon-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

.panel-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.folder-row {
    width: 100%;
    height: 26px;
    padding: 0 10px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    transition: background-color 100ms ease;
}

.folder-row:hover {
    background: var(--bg-hover);
}

.chevron-icon {
    color: var(--text-muted);
    font-size: 14px;
    transition: transform 140ms ease;
    flex-shrink: 0;
}

.folder-icon {
    color: var(--text-muted);
    font-size: 14px;
}

.folder-row[aria-expanded="false"] .chevron-icon {
    transform: rotate(-90deg);
}

.new-file-row {
    padding: 4px 10px 4px 26px;
}

#new-file-input {
    width: 100%;
    height: 26px;
    padding: 0 8px;
    border-radius: 4px;
    border: 1px solid var(--accent);
    background: var(--bg-editor);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.file-list {
    list-style: none;
}

.file-list.collapsed {
    display: none;
}

.file-item {
    height: 27px;
    padding: 0 8px 0 26px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12.5px;
    position: relative;
    transition: background-color 100ms ease, color 100ms ease;
}

.file-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.file-item.active {
    background: var(--bg-active);
    color: var(--text-primary);
    font-weight: 500;
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-icon {
    font-size: 14px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.file-icon.ext-html { color: #e44d26; }
.file-icon.ext-css { color: #4299e1; }
.file-icon.ext-scss { color: #cd6799; }
.file-icon.ext-js { color: #e8c547; }
.file-icon.ext-ts { color: #3b82f6; }
.file-icon.ext-jsx { color: #56c2e6; }
.file-icon.ext-json { color: #7ec482; }
.file-icon.ext-md { color: var(--text-secondary); }
.file-icon.ext-xml { color: #e09145; }
.file-icon.ext-default { color: var(--text-muted); }

:root[data-theme="light"] .file-icon.ext-html { color: #d84315; }
:root[data-theme="light"] .file-icon.ext-css { color: #1d63dc; }
:root[data-theme="light"] .file-icon.ext-js { color: #b88b00; }
:root[data-theme="light"] .file-icon.ext-jsx { color: #087ea4; }
:root[data-theme="light"] .file-icon.ext-json { color: #2b7a42; }

.dirty-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-secondary);
    flex-shrink: 0;
}

.file-delete-btn {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 13px;
}

.file-item:hover .file-delete-btn,
.file-item:focus-within .file-delete-btn {
    display: inline-flex;
}

.file-delete-btn:hover {
    background: var(--bg-editor);
    color: var(--error);
}

/* Search Panel */
.search-controls {
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-editor);
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    padding: 0 4px 0 8px;
    height: 28px;
}

.search-input-wrap:focus-within {
    border-color: var(--accent);
}

#search-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    font-size: 12px;
    color: var(--text-primary);
}

.case-btn {
    height: 20px;
    padding: 0 5px;
    border-radius: 3px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    cursor: pointer;
}

.case-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.case-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.search-meta {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.search-file-group {
    margin-bottom: 6px;
}

.search-file-header {
    padding: 4px 12px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-file-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.search-file-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 400;
}

.search-match {
    width: 100%;
    border: none;
    background: transparent;
    padding: 4px 12px 4px 18px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    cursor: pointer;
    text-align: left;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: var(--text-secondary);
}

.search-match:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.search-line-num {
    color: var(--text-muted);
    min-width: 22px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.search-line-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-highlight {
    background: var(--accent-soft);
    color: var(--text-primary);
    border-radius: 2px;
    padding: 0 1px;
}

/* ==========================================
   Hairline Splitters (1px visual, 7px hit area)
   ========================================== */
.splitter {
    width: 1px;
    background: var(--border-subtle);
    cursor: col-resize;
    position: relative;
    flex-shrink: 0;
    z-index: 20;
    transition: background-color 120ms ease;
}

.splitter::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -3px;
    right: -3px;
}

.splitter:hover,
.splitter.dragging {
    background: var(--accent);
}

.splitter:hover::before,
.splitter.dragging::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -1px;
    right: -1px;
    background: var(--accent);
    opacity: 0.7;
}

/* ==========================================
   Main Stage (Editor + Preview Split)
   ========================================== */
.main-stage {
    flex: 1;
    display: flex;
    min-width: 0;
    min-height: 0;
    background: var(--bg-editor);
}

.split-view {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.editor-pane,
.preview-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.editor-pane {
    flex: 1 1 54%;
    background: var(--bg-editor);
}

.preview-pane {
    flex: 1 1 46%;
    background: var(--bg-sidebar);
}

.editor-pane.maximized {
    flex-basis: 100% !important;
}

/* Editor Tabs */
.tab-bar {
    height: 35px;
    background: var(--bg-chrome);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    user-select: none;
}

.tab-bar::-webkit-scrollbar {
    height: 3px;
}

.editor-tab {
    height: 100%;
    padding: 0 10px 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-subtle);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 100ms ease, background-color 100ms ease;
}

.editor-tab:hover {
    color: var(--text-primary);
    background: var(--bg-sidebar);
}

.editor-tab.active {
    background: var(--bg-editor);
    color: var(--text-primary);
    font-weight: 500;
}

.editor-tab.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.5px;
    background: var(--accent);
}

.tab-close {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 100ms ease, background-color 100ms ease, color 100ms ease;
}

.editor-tab:hover .tab-close,
.editor-tab.active .tab-close {
    opacity: 1;
}

.tab-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Breadcrumb Bar */
.breadcrumb-bar {
    height: 24px;
    padding: 0 14px;
    background: var(--bg-editor);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-muted);
    flex-shrink: 0;
    user-select: none;
}

.breadcrumb-path {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.breadcrumb-current {
    color: var(--text-secondary);
    font-weight: 500;
}

.breadcrumb-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.editor-container {
    flex: 1;
    position: relative;
    min-height: 0;
    background: var(--bg-editor);
}

.editor-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-editor);
    z-index: 2;
}

/* Preview & Console Pane Header */
.pane-header {
    height: 35px;
    background: var(--bg-chrome);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 8px;
    flex-shrink: 0;
    user-select: none;
}

.pane-tabs {
    display: flex;
    align-items: stretch;
    height: 100%;
}

.pane-tab {
    height: 100%;
    padding: 0 14px;
    border: none;
    border-right: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color 100ms ease, background-color 100ms ease;
}

.pane-tab:hover {
    color: var(--text-primary);
}

.pane-tab.active {
    color: var(--text-primary);
    background: var(--bg-sidebar);
}

.pane-tab.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.5px;
    background: var(--accent);
}

.console-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.console-count.has-errors {
    color: var(--error);
}

.pane-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
}

.viewport-group,
.console-filter-group {
    display: inline-flex;
    align-items: center;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    padding: 2px;
    gap: 1px;
}

.viewport-btn,
.filter-btn {
    height: 20px;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 100ms ease, color 100ms ease;
}

.viewport-btn {
    width: 24px;
}

.filter-btn {
    padding: 0 7px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.viewport-btn:hover,
.filter-btn:hover {
    color: var(--text-primary);
}

.viewport-btn.active,
.filter-btn.active {
    background: var(--bg-active);
    color: var(--text-primary);
}

/* Preview Stage */
.preview-stage {
    flex: 1;
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: var(--stage-bg);
    min-height: 0;
    overflow: auto;
}

.drag-shield {
    position: absolute;
    inset: 0;
    z-index: 50;
    cursor: col-resize;
}

.device-frame {
    width: 100%;
    height: 100%;
    display: flex;
    background: #ffffff;
    transition: max-width 160ms ease;
}

.device-frame.device-tablet {
    max-width: 768px;
    margin: 16px auto;
    height: calc(100% - 32px);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    overflow: hidden;
}

.device-frame.device-mobile {
    max-width: 375px;
    margin: 16px auto;
    height: calc(100% - 32px);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    overflow: hidden;
}

#preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

/* Console */
#console-wrapper {
    position: absolute;
    inset: 0;
    background: var(--bg-editor);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.console-output {
    flex: 1;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.55;
}

.console-empty {
    padding: 20px 14px;
    color: var(--text-muted);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12px;
}

.console-entry {
    display: grid;
    grid-template-columns: 62px 42px 1fr;
    gap: 8px;
    padding: 5px 12px;
    border-bottom: 1px solid var(--border-subtle);
    align-items: baseline;
    word-break: break-word;
}

.console-entry.log-error {
    background: rgba(229, 83, 75, 0.08);
}

.console-entry.log-warn {
    background: rgba(210, 153, 34, 0.08);
}

.console-time {
    color: var(--text-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    user-select: none;
}

.console-level {
    font-size: 10.5px;
    font-weight: 600;
    user-select: none;
}

.log-log .console-level { color: var(--text-muted); }
.log-result .console-level { color: var(--accent); }
.log-error .console-level { color: var(--error); }
.log-warn .console-level { color: var(--warn); }

.console-msg {
    color: var(--text-primary);
    white-space: pre-wrap;
}

.log-error .console-msg { color: var(--error); }
.log-warn .console-msg { color: var(--warn); }

.console-repl {
    height: 34px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    flex-shrink: 0;
}

.repl-prompt {
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    user-select: none;
}

#console-repl-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-primary);
}

/* ==========================================
   Bottom Status Bar (24px quiet IDE footer)
   ========================================== */
.statusbar {
    height: 24px;
    background: var(--bg-chrome);
    border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    font-size: 11.5px;
    flex-shrink: 0;
    user-select: none;
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.status-btn {
    height: 20px;
    padding: 0 5px;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 11.5px;
    white-space: nowrap;
    transition: background-color 100ms ease, color 100ms ease;
}

.status-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.status-text {
    color: var(--text-muted);
    white-space: nowrap;
}

.status-sep {
    color: var(--text-muted);
}

.diag-item.has-error {
    color: var(--error);
    font-weight: 500;
}

.diag-item.has-warn {
    color: var(--warn);
    font-weight: 500;
}

/* ==========================================
   Modals & Command Palette
   ========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 10, 14, 0.56);
    z-index: 7000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-box,
.cmd-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    width: 92%;
    max-width: 480px;
    box-shadow: var(--shadow-modal);
    overflow: hidden;
}

/* Command Palette */
#command-palette {
    align-items: flex-start;
    padding-top: 11vh;
}

.cmd-box {
    max-width: 540px;
}

.cmd-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

#cmd-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
}

.cmd-list {
    max-height: 310px;
    overflow-y: auto;
    padding: 4px;
}

.cmd-item {
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font-size: 12.5px;
    text-align: left;
}

.cmd-item:hover,
.cmd-item.selected {
    background: var(--bg-active);
}

.cmd-item-cat {
    color: var(--text-muted);
    margin-right: 6px;
}

.cmd-empty {
    padding: 16px 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* Settings Modal */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 12px 18px 18px;
    max-height: 68vh;
    overflow-y: auto;
}

.settings-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    padding: 2px 0 6px;
    border-bottom: 1px solid var(--border-subtle);
}

.owner-section-label {
    margin-top: 16px;
}

.owner-block {
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.owner-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.owner-avatar {
    width: 36px;
    height: 36px;
    border-radius: 7px;
    border: 1px solid var(--border-subtle);
    object-fit: cover;
    flex-shrink: 0;
}

.owner-identity {
    min-width: 0;
}

.owner-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.owner-handle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 400;
    color: var(--text-muted);
}

.owner-bio {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.45;
}

.owner-meta-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-subtle);
}

.owner-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
}

.owner-meta-row:last-child {
    border-bottom: none;
    padding-bottom: 2px;
}

.owner-meta-key {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    white-space: nowrap;
}

.owner-meta-key i {
    font-size: 13px;
}

.owner-meta-val {
    color: var(--text-primary);
    text-align: right;
}

.owner-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
}

.owner-link:hover {
    text-decoration: underline;
}

.owner-link i {
    font-size: 12px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-title {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-primary);
}

.setting-desc {
    display: block;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.setting-select {
    height: 28px;
    padding: 0 8px;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: var(--bg-editor);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}

.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.btn-danger-ghost {
    height: 28px;
    padding: 0 10px;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.btn-danger-ghost:hover,
.btn-danger-ghost.confirming {
    border-color: var(--error);
    color: var(--error);
    background: rgba(229, 83, 75, 0.08);
}

/* Compact Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

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

.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: var(--border-strong);
    border-radius: 20px;
    transition: background-color 140ms ease;
}

.slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 140ms ease;
}

.toggle-switch input:checked + .slider {
    background: var(--accent);
}

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

.toggle-switch input:focus-visible + .slider {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Notifications */
#notification-container {
    position: fixed;
    bottom: 34px;
    right: 14px;
    z-index: 6000;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.notification {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 150ms ease, transform 150ms ease;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   Responsive Layout (Tablet & Mobile)
   ========================================== */
@media (max-width: 900px) {
    .titlebar {
        grid-template-columns: auto 1fr auto;
    }

    .command-trigger kbd {
        display: none;
    }

    .side-panel {
        position: fixed;
        top: 38px;
        bottom: 24px;
        left: 44px;
        z-index: 40;
        border-right: 1px solid var(--border-strong);
        box-shadow: 10px 0 24px rgba(0, 0, 0, 0.35);
    }

    #resizer-1 {
        display: none;
    }

    .split-view {
        flex-direction: column;
    }

    .core-resizer {
        width: 100%;
        height: 1px;
        cursor: row-resize;
    }

    .core-resizer::after {
        left: 0;
        right: 0;
        top: -4px;
        bottom: -4px;
    }

    .status-right .status-text:nth-child(5),
    #status-indent {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
