:root {
    --bg: #202123;
    --panel: #2b2c2f;
    --panel-2: #171717;
    --border: #3b3c40;
    --text: #ececf1;
    --muted: #a9a9b3;
    --accent: #10a37f;
    --accent-hover: #0e8f70;
    --bubble-user: #343541;
    --bubble-nova: #444654;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Arial, sans-serif; height: 100vh; overflow: hidden; }
#appShell { display: grid; grid-template-columns: 292px 1fr; height: 100vh; }
#sidebar { background: var(--panel-2); border-right: 1px solid #111; padding: 14px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.brandRow { display: flex; align-items: center; gap: 12px; padding: 4px 4px 10px; }
.logoMark { width: 42px; height: 42px; border-radius: 13px; display: block; box-shadow: 0 8px 28px rgba(99,215,255,.18), 0 0 0 1px rgba(255,255,255,.06); }
.brandName { font-weight: 700; letter-spacing: .2px; }
.brandVersion { color: var(--muted); font-size: 12px; margin-top: 2px; }
.navTabs { display: grid; gap: 8px; }
.navTab { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 10px; text-align: left; padding: 12px; cursor: pointer; font-size: 14px; }
.navTab:hover, .navTab.active { background: #2a2b2f; border-color: #595a60; }
.sideTitle { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }
.chatList { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.chatItem { background: transparent; color: var(--text); border: none; border-radius: 9px; text-align: left; padding: 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatItem:hover, .chatItem.active { background: #2a2b2f; }
#mainPanel { min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.topBar { min-height: 66px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 22px; background: #2f3035; }
#viewTitle { font-weight: 700; font-size: 16px; }
#statusLine { color: var(--muted); font-size: 12px; margin-top: 3px; }
.topActions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; min-width: 0; }
.modelPicker { position: relative; color: var(--muted); font-size: 12px; }
.auxModelPicker { display: none; }
.modelMenuButton { min-width: 150px; max-width: 240px; background: #40414f; color: var(--text); border: 1px solid #565869; border-radius: 9px; padding: 9px 10px; outline: none; cursor: pointer; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modelMenu { position: absolute; right: 0; top: calc(100% + 6px); width: min(360px, 80vw); max-height: 360px; overflow-y: auto; background: #202123; border: 1px solid var(--border); border-radius: 8px; padding: 8px; z-index: 20; box-shadow: 0 18px 40px rgba(0,0,0,.34); }
.modelMenuSectionTitle { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 7px 6px 5px; }
.modelOptionList { display: grid; gap: 4px; }
.modelOptionRow { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; gap: 4px; border-radius: 7px; }
.modelOptionRow:hover, .modelOptionRow.active { background: #2a2b2f; }
.modelPickButton, .modelRemoveButton, .modelAddButton, .modelAddInlineButton { height: 30px; border: 0; border-radius: 7px; cursor: pointer; }
.modelPickButton { grid-column: 1 / span 2; background: transparent; color: var(--text); text-align: left; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modelPickButton.addable { grid-column: 2 / span 2; }
.modelPickButton.installed { grid-column: 2; }
.modelRemoveButton { background: transparent; color: var(--muted); font-size: 17px; }
.modelRemoveButton:hover { background: #4b242b; color: #ffd2d8; }
.modelAddInlineButton { background: transparent; color: #cfe3ff; font-size: 18px; font-weight: 800; }
.modelAddInlineButton:hover { background: #23384f; color: white; }
.modelAddInlineButton:disabled { color: #5f6570; cursor: default; }
.modelAddInlineButton:disabled:hover { background: transparent; color: #5f6570; }
.modelEmptyRow { color: var(--muted); font-size: 12px; padding: 7px 8px; }
.modelAddRow { display: grid; grid-template-columns: 32px 1fr; gap: 6px; padding: 4px; }
.modelAddButton { background: var(--accent); color: white; font-weight: 800; }
.modelAddRow input { min-width: 0; background: #40414f; color: var(--text); border: 1px solid #565869; border-radius: 8px; padding: 8px; outline: none; }
.primaryButton, .sendButton { background: var(--accent); color: white; border: none; border-radius: 10px; padding: 10px 14px; cursor: pointer; font-weight: 650; }
.primaryButton:hover, .sendButton:hover { background: var(--accent-hover); }
.view { display: none; min-height: 0; flex: 1; }
.activeView { display: flex; flex-direction: column; }
.messages { flex: 1; overflow-y: auto; padding: 22px 0 120px; }
.messageRow { display: flex; justify-content: center; border-bottom: 1px solid rgba(255,255,255,.06); }
.messageRow.user { background: var(--bubble-user); }
.messageRow.assistant { background: var(--bubble-nova); }
.messageInner { width: min(820px, calc(100% - 36px)); padding: 22px 0; line-height: 1.55; white-space: pre-wrap; }
.roleLabel { color: var(--muted); font-size: 12px; margin-bottom: 8px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.composer { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: flex-end; padding: 18px; background: linear-gradient(180deg, rgba(32,33,35,0), var(--bg) 24%); }
textarea { flex: 1; max-height: 180px; resize: none; background: #40414f; color: var(--text); border: 1px solid #565869; border-radius: 14px; padding: 14px 16px; outline: none; font-size: 16px; line-height: 1.35; }
textarea:focus { border-color: #7c7d89; }
#monitorFrame { width: 100%; height: calc(100vh - 66px); border: 0; background: #111; }
.deepHeader { padding: 26px 26px 0; max-width: 900px; margin: 0 auto; color: var(--muted); }
.deepHeader h2 { margin: 0 0 8px; color: var(--text); }
.voiceControls { position: fixed; left: 14px; bottom: 14px; z-index: 35; display: flex; gap: 8px; }
.voiceButton { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: #26272c; color: var(--muted); cursor: pointer; box-shadow: 0 10px 24px rgba(0,0,0,.24); }
.voiceButton:hover { background: #343541; color: var(--text); border-color: #5d5f68; }
.voiceButton.active { background: #0f5f4d; color: white; border-color: var(--accent); }
.voiceButton.listening { background: #7a2633; color: white; border-color: #d15c6d; }
.voiceButton.error { background: #46343a; color: #ffd2d8; border-color: #8d4651; }
.voiceButton svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 820px) {
    #appShell { grid-template-columns: 1fr; }
    #sidebar { display: none; }
    .topBar { padding: 0 12px; }
    .messageInner { width: calc(100% - 24px); }
    .voiceControls { left: 10px; bottom: 10px; }
    .voiceButton { width: 38px; height: 38px; }
}

/* Alpha 2.0 additions */
.chatItemRow { display: grid; grid-template-columns: 1fr 30px; align-items: center; border-radius: 9px; }
.chatItemRow:hover, .chatItemRow.active { background: #2a2b2f; }
.chatItemRow .chatItem { background: transparent; border-radius: 9px 0 0 9px; }
.chatItemRow .chatItem:hover { background: transparent; }
.chatDelete { width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.chatDelete:hover { background: #3a1f24; color: #ffb4bf; }
.secondaryButton { background: #343541; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; cursor: pointer; font-weight: 650; }
.secondaryButton:hover { background: #3e404a; }
.dangerButton { background: #4b242b; color: #ffd2d8; border: 1px solid #73333e; border-radius: 10px; padding: 10px 14px; cursor: pointer; font-weight: 650; }
.dangerButton:hover { background: #64303a; }
.memoryPanel { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 22px; gap: 16px; }
.memoryHeader { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; max-width: 1180px; width: 100%; margin: 0 auto; }
.memoryHeader h2 { margin: 0 0 6px; }
.memoryHeader p { margin: 0; color: var(--muted); }
.memoryGrid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; min-height: 0; flex: 1; max-width: 1180px; width: 100%; margin: 0 auto; }
.memoryFileList { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 10px; overflow-y: auto; min-height: 0; }
.memoryFile { width: 100%; display: grid; gap: 5px; background: transparent; color: var(--text); border: 0; border-radius: 10px; text-align: left; padding: 10px; cursor: pointer; }
.memoryFile:hover, .memoryFile.active { background: #2a2b2f; }
.memoryFile span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.memoryEditor { display: flex; flex-direction: column; min-height: 0; background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.memoryEditorTop { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--border); }
#memoryFileName { font-weight: 700; color: var(--text); }
.memoryActions { display: flex; gap: 8px; }
#memoryTextarea { flex: 1; width: 100%; min-height: 0; height: 100%; border: 0; border-radius: 0; background: #2f3035; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; line-height: 1.5; }
.codePanel { display: flex; flex-direction: column; min-height: 0; flex: 1; height: calc(100vh - 66px); padding: 8px; gap: 8px; }
.codeToolbar { display: flex; align-items: center; gap: 10px; min-height: 42px; }
#codeFolderInput { flex: 1; min-width: 180px; background: #40414f; color: var(--text); border: 1px solid #565869; border-radius: 10px; padding: 11px 12px; outline: none; }
.codeToggle { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.codeGrid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(190px, 280px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(210px, 28vh); gap: 8px; }
.codeFileList { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; overflow-y: auto; min-height: 0; }
.codeFileButton { width: 100%; display: block; background: transparent; color: var(--text); border: 0; border-radius: 7px; text-align: left; padding: 8px; cursor: pointer; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codeFileButton:hover, .codeFileButton.active { background: #2a2b2f; }
.codeEditor, .codeAssistant { display: flex; flex-direction: column; min-height: 0; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.codeAssistant { grid-column: 1 / -1; }
.codeEditorTop { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border-bottom: 1px solid var(--border); }
#codeFileName { min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#codeTextarea { flex: 1; width: 100%; min-height: 0; height: 100%; border: 0; border-radius: 0; background: #25262b; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; line-height: 1.45; }
.codeMessages { flex: 1; overflow-y: auto; padding: 12px; white-space: pre-wrap; font-size: 13px; line-height: 1.45; min-height: 0; }
.codeMsg { padding: 10px; border-radius: 8px; margin-bottom: 8px; background: #2f3035; }
.codeMsg.user { background: #343541; }
.codeMsg.assistant { background: #444654; }
.codeComposer { border-top: 1px solid var(--border); padding: 10px; display: flex; gap: 8px; align-items: flex-end; background: #202123; }
#codeInput { min-height: 92px; max-height: 180px; font-size: 14px; border-radius: 10px; }
@media (max-width: 900px) {
    .memoryGrid { grid-template-columns: 1fr; }
    .memoryFileList { max-height: 200px; }
    .topBar { height: auto; min-height: 66px; gap: 10px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
    .codeToolbar { flex-wrap: wrap; }
    .codePanel { height: calc(100vh - 86px); }
    .codeGrid { grid-template-columns: 1fr; grid-template-rows: auto minmax(420px, 1fr) minmax(220px, 32vh); }
    .codeFileList { max-height: 180px; }
    .codeAssistant { grid-column: auto; }
    #codeInput { min-height: 80px; }
}
