:root {
  --bg: #0b0b0e;
  --panel: #111116;
  --panel-2: #17171d;
  --line: #26262e;
  --muted: #8b8b99;
  --text: #f4f3f8;
  --accent: #7c5cff;
  --accent-2: #a594ff;
  --success: #56d69a;
  --danger: #ff6d7a;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--bg); overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.shell { display: grid; grid-template-columns: 286px 1fr; height: 100vh; }
.sidebar { display: flex; flex-direction: column; min-width: 0; padding: 22px 16px 16px; background: #0e0e12; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-size: 13px; font-weight: 800; letter-spacing: .08em; background: linear-gradient(135deg, var(--accent), #4431a9); box-shadow: 0 8px 30px #7457ff3b; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; }
.brand span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.sidebar-section { margin-bottom: 22px; }
.sidebar-section.grow { flex: 1; }
.section-label { margin: 0 7px 9px; color: #6f6f7c; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.project-card, .account-button, .thread-card { display: flex; align-items: center; width: 100%; min-width: 0; gap: 10px; padding: 11px; border: 1px solid transparent; border-radius: 12px; background: transparent; text-align: left; }
.project-card, .account-button { cursor: pointer; }
.project-card:hover, .account-button:hover { background: var(--panel-2); border-color: var(--line); }
.project-icon { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 9px; background: #202029; color: var(--accent-2); }
.project-copy, .account-button > span:nth-child(2) { min-width: 0; flex: 1; }
.project-copy strong, .project-copy small, .account-button strong, .account-button small, .thread-card strong, .thread-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-copy strong, .account-button strong, .thread-card strong { font-size: 12px; font-weight: 600; }
.project-copy small, .account-button small, .thread-card small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.chevron { color: #686874; }
.thread-card.active { background: #17171e; border-color: #24242c; }
.thread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.thread-card div { min-width: 0; }
.sidebar-footer { padding-top: 12px; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: #25252e; color: var(--accent-2); font-size: 10px; font-weight: 700; }
.icon-button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { color: var(--text); background: #22222a; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 24px; border-bottom: 1px solid var(--line); background: #0d0d11cc; backdrop-filter: blur(16px); }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #d2a448; }
.connection.connected .status-dot { background: var(--success); box-shadow: 0 0 10px #56d69a8c; }
.connection.error .status-dot { background: var(--danger); }
.top-actions { display: flex; align-items: center; gap: 9px; }
select, .ghost-button, .primary-button, .danger-button { border: 1px solid var(--line); border-radius: 9px; }
select { max-width: 230px; padding: 7px 30px 7px 10px; color: #d8d7de; background: #17171d; font-size: 11px; }
.ghost-button, .primary-button, .danger-button { padding: 8px 12px; cursor: pointer; font-size: 11px; }
.ghost-button { background: transparent; color: var(--muted); }
.ghost-button:hover { background: var(--panel-2); color: var(--text); }
.primary-button { background: var(--accent); border-color: var(--accent); }
.danger-button { background: #2a1519; border-color: #54272e; color: #ff9ca5; }
.workspace { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(520px, 1fr) 360px; }
.conversation-panel { min-width: 0; display: flex; flex-direction: column; position: relative; }
.conversation { flex: 1; overflow: auto; padding: 30px max(24px, calc((100% - 820px) / 2)); scroll-behavior: smooth; }
.workspace-intro { display: flex; gap: 12px; max-width: 820px; margin: 12px auto 0; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #121217; }
.workspace-intro-body { min-width: 0; flex: 1; color: #dedde4; font-size: 13px; line-height: 1.55; }
.workspace-intro-body strong { display: block; margin: 2px 0 5px; font-size: 13px; }
.workspace-intro-body p { margin: 0 0 12px; color: var(--muted); }
.workspace-intro-body .primary-button { padding: 7px 11px; font-size: 11px; }
.welcome { max-width: 760px; margin: 11vh auto 0; text-align: center; }
.welcome-orb { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 22px; border: 1px solid #383543; border-radius: 18px; background: radial-gradient(circle at 30% 25%, #443a68, #17151e 70%); color: var(--accent-2); font-size: 23px; box-shadow: 0 22px 70px #6752ce24; }
.eyebrow { margin: 0 0 10px; color: var(--accent-2); font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.welcome h1 { margin: 0; font-size: clamp(25px, 3vw, 38px); letter-spacing: -.035em; }
.welcome > p:not(.eyebrow) { max-width: 590px; margin: 15px auto 29px; color: var(--muted); line-height: 1.65; font-size: 13px; }
.starter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.starter { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #121217; text-align: left; cursor: pointer; }
.starter:hover { border-color: #514869; background: #17161e; transform: translateY(-1px); }
.starter span, .starter small { display: block; }
.starter span { font-size: 12px; font-weight: 650; }
.starter small { margin-top: 7px; color: var(--muted); line-height: 1.4; font-size: 10px; }
.message { display: flex; gap: 12px; max-width: 820px; margin: 0 auto 24px; }
.message-avatar { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; background: #22222a; color: var(--accent-2); font-size: 9px; font-weight: 800; }
.message.user .message-avatar { background: #292231; color: #d5caff; }
.message-body { min-width: 0; flex: 1; padding-top: 4px; color: #dedde4; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .message-body { color: #f4f3f8; }
.message.streaming .message-body::after { content: ""; display: inline-block; width: 6px; height: 13px; margin-left: 3px; background: var(--accent-2); animation: blink .8s infinite; vertical-align: -2px; }
@keyframes blink { 50% { opacity: .2; } }
.composer-wrap { padding: 12px max(24px, calc((100% - 820px) / 2)) 15px; background: linear-gradient(transparent, var(--bg) 20%); }
.composer { border: 1px solid #32323b; border-radius: 15px; background: #16161c; box-shadow: 0 16px 50px #0007; }
.composer:focus-within { border-color: #5c5274; box-shadow: 0 16px 60px #0008, 0 0 0 1px #6e5dad33; }
textarea { display: block; width: 100%; max-height: 170px; min-height: 57px; padding: 17px 17px 7px; resize: none; border: 0; outline: 0; color: var(--text); background: transparent; line-height: 1.5; font-size: 13px; }
textarea::placeholder { color: #696975; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; padding: 7px 9px 9px 13px; }
.mode-chip { color: #777784; font-size: 10px; }
.send-button { display: grid; place-items: center; width: 31px; height: 31px; border: 0; border-radius: 9px; background: var(--accent); cursor: pointer; font-size: 17px; }
.send-button:disabled { background: #292932; color: #62626e; cursor: not-allowed; }
.composer-note { margin: 7px 0 0; color: #60606b; text-align: center; font-size: 9px; }
.activity-panel { min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: #0e0e12; }
.activity-tabs { display: flex; gap: 3px; padding: 13px; border-bottom: 1px solid var(--line); }
.activity-tab { padding: 7px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.activity-tab.active { background: #202027; color: var(--text); }
.activity-content { display: none; min-height: 0; flex: 1; overflow: auto; }
.activity-content.active { display: block; }
.empty-state { margin: 35% auto 0; max-width: 210px; color: #686873; text-align: center; font-size: 11px; line-height: 1.5; }
.empty-state span { font-size: 24px; color: #4e4e58; }
.activity-item { margin: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #141419; }
.activity-item header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.activity-item strong { font-size: 10px; }
.activity-item small { color: var(--muted); font-size: 9px; }
.activity-item pre, #diff-output, .approval-command { margin: 0; overflow: auto; color: #c9c7d0; font: 10px/1.55 "Cascadia Code", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
#diff-output { min-height: 100%; padding: 16px; color: #b8d6be; background: #0a0a0d; white-space: pre; }
dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid #34343d; border-radius: 16px; color: var(--text); background: #15151b; box-shadow: 0 24px 90px #000c; }
dialog::backdrop { background: #050508b5; backdrop-filter: blur(5px); }
.dialog-card { padding: 22px; }
.auth-card { width: min(430px, calc(100vw - 32px)); }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.auth-brand h2 { margin: 3px 0 0; }
.auth-submit { width: 100%; justify-content: center; margin-top: 18px; }
.auth-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; text-align: center; line-height: 1.5; }
#auth-dialog::backdrop { background: rgba(4, 5, 10, .84); backdrop-filter: blur(12px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; }
.dialog-head h2 { margin: 0; font-size: 20px; }
.dialog-copy { color: var(--muted); font-size: 11px; line-height: 1.6; }
.dialog-card label { display: block; margin-top: 18px; color: #b8b7c0; font-size: 11px; }
.dialog-card label[hidden] { display: none; }
.dialog-card input { width: 100%; margin-top: 7px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--text); background: #0d0d11; }
.dialog-card input:focus { border-color: #66588a; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 58px; }
.password-toggle { position: absolute; right: 8px; bottom: 8px; min-width: 42px; padding: 4px 7px; border: 0; border-radius: 6px; background: #24232c; color: #bcb7d5; cursor: pointer; font-size: 10px; }
.password-toggle:hover { background: #302e3b; color: #fff; }
.password-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.form-error { min-height: 16px; color: var(--danger); font-size: 10px; }
.form-success { min-height: 0; margin: 8px 0 0; color: #70d6a3; font-size: 10px; line-height: 1.5; }
.auth-links { display: flex; justify-content: center; gap: 16px; margin-top: 14px; }
.text-button { padding: 0; border: 0; background: transparent; color: #aaa0d8; cursor: pointer; font-size: 11px; }
.text-button:hover { color: #d5cff5; text-decoration: underline; }
.approval-command { max-height: 220px; margin-top: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #0b0b0e; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 360px; padding: 11px 14px; border: 1px solid #3b3b45; border-radius: 10px; background: #1b1b22; box-shadow: 0 15px 45px #0009; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; font-size: 11px; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1040px) {
  .workspace { grid-template-columns: 1fr; }
  .activity-panel { display: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .starter-grid { grid-template-columns: 1fr; }
  .conversation { padding-inline: 18px; }
  .composer-wrap { padding-inline: 18px; }
}
