:root {
  color-scheme: dark;
  --bg: #111312;
  --panel: #181b19;
  --panel-2: #202421;
  --line: #2a302c;
  --text: #edf1ed;
  --muted: #929c95;
  --accent: #b6ed5c;
  --accent-ink: #17200b;
  --danger: #ff8177;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100dvh; }
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); line-height: 1.55; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: .16em; margin: 0 0 13px; }
.mark, .welcome-mark { display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; border-radius: 13px; }
.mark { width: 46px; height: 46px; font-size: 24px; }
.mark.small { width: 34px; height: 34px; font-size: 18px; border-radius: 10px; flex: none; }

.path-wrap label { display: block; font-size: 12px; color: #c1c9c3; margin: 0 0 8px; }
.path-wrap input, .path-wrap select { height: 46px; border: 1px solid #3a423b; background: #101210; color: var(--text); border-radius: 10px; width: 100%; padding: 0 13px; outline: none; }
.path-wrap input:focus, .path-wrap select:focus, textarea:focus { border-color: #a2d94e; box-shadow: 0 0 0 3px #b6ed5c1e; }
.primary, .secondary, .new-chat { border: 0; border-radius: 10px; height: 42px; padding: 0 17px; font-weight: 700; }
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:hover { background: #c6fa70; }
.secondary { background: #252a26; border: 1px solid #404740; }
.secondary:hover { background: #313833; }

.app-shell { min-height: 100dvh; display: flex; }
.sidebar { width: 278px; background: #151816; border-right: 1px solid var(--line); padding: 18px 13px 14px; display: flex; flex-direction: column; flex: none; }
.brand-row { display: flex; align-items: center; gap: 10px; padding: 0 6px 22px; }
.brand-row strong { display: block; font-size: 13px; font-weight: 690; }
.brand-caption { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.new-chat { width: 100%; text-align: left; color: var(--text); background: #202421; border: 1px solid #333a35; font-size: 13px; font-weight: 600; }
.new-chat:hover { background: #2a302c; }
.new-chat span { color: var(--accent); font-size: 18px; vertical-align: -1px; margin-right: 8px; }
.section-label { color: #79827b; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 24px 9px 9px; }
.project-list { overflow-y: auto; flex: none; max-height: 28vh; min-height: 0; }
.project-item { width: 100%; padding: 8px 10px; text-align: left; border: 0; border-radius: 8px; background: transparent; color: #c6cec8; margin: 1px 0; }
.project-item:hover { background: #202421; }
.project-item.selected { background: #272d28; color: var(--text); }
.project-title, .project-root { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.project-title { font-size: 11px; line-height: 1.4; }
.project-root { font-size: 9px; line-height: 1.4; color: #7f8981; margin-top: 3px; }
.thread-list { overflow-y: auto; flex: 1; min-height: 0; }
.thread-item { width: 100%; padding: 10px 11px; text-align: left; border: 0; border-radius: 9px; background: transparent; color: #c6cec8; margin: 1px 0; }
.thread-item:hover { background: #202421; }
.thread-item.selected { background: #272d28; color: var(--text); }
.thread-title { font-size: 12px; line-height: 1.4; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: block; }
.thread-preview { font-size: 10px; line-height: 1.4; color: #7f8981; display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin-top: 4px; }
.empty-list { padding: 9px; font-size: 11px; line-height: 1.5; color: #6f7971; }
.sidebar-bottom { border-top: 1px solid #292f2b; padding: 13px 7px 0; }
.connection-line { display: flex; align-items: center; gap: 8px; color: #929b94; font-size: 11px; }
.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: #d4a752; box-shadow: 0 0 9px #d4a75270; }
.connection-dot.online { background: var(--accent); box-shadow: 0 0 9px #b6ed5c77; }
.connection-dot.offline { background: var(--danger); box-shadow: 0 0 9px #ff817766; }

.main-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; height: 100dvh; }
.topbar { display: flex; align-items: center; height: 58px; padding: 0 24px; border-bottom: 1px solid #252b27; flex: none; }
.crumb { display: flex; gap: 12px; align-items: baseline; min-width: 0; }
.crumb-name { font-size: 12px; color: #dce3dd; font-weight: 650; }
.workspace-label { font-size: 10px; color: #79827b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-indicator { margin-left: auto; color: var(--accent); font-size: 11px; display: flex; align-items: center; gap: 7px; }
.run-indicator span { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .28; } }
.welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; margin-top: -30px; }
.welcome-mark { width: 58px; height: 58px; border-radius: 17px; font-size: 30px; margin-bottom: 25px; }
.welcome h1 { font-size: clamp(27px, 4vw, 38px); letter-spacing: -.045em; margin: 0 0 12px; }
.welcome > p:not(.eyebrow) { color: #9aa49d; font-size: 14px; max-width: 380px; line-height: 1.65; margin: 0 0 25px; }
.conversation { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages { flex: 1; overflow-y: auto; padding: 30px max(24px, calc((100% - 780px) / 2)); scroll-behavior: smooth; }
.message { max-width: 780px; margin: 0 auto 25px; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; }
.avatar { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: #293029; color: var(--accent); }
.message.user .avatar { background: #26313a; color: #91c8f2; }
.message-body { padding-top: 4px; min-width: 0; }
.message-role { font-size: 10px; color: #7c867f; font-weight: 650; margin-bottom: 7px; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; font-size: 13px; color: #dce2dd; }
.message.user .message-text { color: #f0f3ef; }
.message-tool { max-width: 780px; margin: 0 auto 14px 42px; border-left: 2px solid #464e48; padding: 4px 12px; color: #8e9991; font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-tool summary { cursor: pointer; color: #abb4ad; }
.message-tool pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 2px; }
.composer-wrap { width: min(100% - 32px, 780px); margin: 0 auto; padding: 0 0 max(18px, env(safe-area-inset-bottom)); flex: none; }
.path-wrap { margin-bottom: 11px; padding: 12px 13px; border: 1px solid #303732; background: #171b18; border-radius: 12px; }
.path-wrap input { height: 38px; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.path-wrap select { height: 38px; font-size: 12px; margin-bottom: 10px; }
.composer { border: 1px solid #353d37; background: #1a1e1b; border-radius: 16px; padding: 12px 13px 9px; box-shadow: 0 8px 30px #0002; }
.composer:focus-within { border-color: #59674a; }
.composer textarea { width: 100%; color: var(--text); border: 0; outline: 0; resize: none; background: transparent; min-height: 27px; max-height: 180px; line-height: 1.45; padding: 2px 1px 7px; font-size: 13px; }
.composer textarea::placeholder { color: #747e76; }
.composer-bottom { display: flex; justify-content: space-between; align-items: center; }
.composer-note, .composer-footnote { font-size: 9px; color: #707a72; }
.composer-footnote { text-align: center; margin: 8px 0 0; }
.send-button { width: 30px; height: 30px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 20px; font-weight: 750; line-height: 1; }
.send-button:disabled { opacity: .35; cursor: default; }
.icon-button { border: 0; background: transparent; color: #aeb7b0; width: 34px; height: 34px; border-radius: 9px; font-size: 18px; }
.icon-button:hover { background: #252b27; }
.mobile-only { display: none; }

.approval-backdrop { position: fixed; inset: 0; background: #060807bb; backdrop-filter: blur(5px); display: grid; place-items: center; padding: 20px; z-index: 20; }
.approval-card { width: min(100%, 520px); border: 1px solid #424a43; background: #1a1e1b; border-radius: 17px; padding: 25px; box-shadow: 0 20px 80px #0009; }
.approval-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #504127; color: #ffe0a1; font-weight: 800; margin-bottom: 20px; }
.approval-card h2 { margin: 0 0 8px; font-size: 21px; letter-spacing: -.02em; }
.approval-card .muted { font-size: 12px; }
.approval-details { background: #101210; border: 1px solid #303732; border-radius: 10px; padding: 13px; font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow: auto; color: #dce3dc; }
.approval-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; border: 1px solid #48534a; background: #252c26; color: #e5ebe5; padding: 10px 14px; border-radius: 10px; font-size: 11px; transition: .2s ease; z-index: 30; max-width: calc(100vw - 30px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 700px) {
  .sidebar { position: fixed; z-index: 10; inset: 0 auto 0 0; width: min(84vw, 310px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 12px 0 40px #0008; }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-grid; place-items: center; }
  .brand-row { padding-top: max(0px, env(safe-area-inset-top)); }
  .topbar { height: 54px; padding: 0 12px; gap: 7px; }
  .crumb-name { font-size: 11px; }
  .workspace-label { display: none; }
  .welcome { margin-top: -15px; padding: 22px; }
  .welcome > p:not(.eyebrow) { font-size: 13px; }
  .messages { padding: 22px 14px; }
  .message { grid-template-columns: 26px minmax(0,1fr); gap: 9px; margin-bottom: 21px; }
  .avatar { width: 25px; height: 25px; border-radius: 8px; }
  .message-tool { margin-left: 34px; }
  .composer-wrap { width: calc(100% - 20px); }
  .composer-footnote { padding-bottom: 2px; }
  .approval-card { padding: 21px; }
}
