:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: #0d1017;
  --panel2: #11151e;
  --line: #202633;
  --text: #eef2f8;
  --muted: #8992a3;
  --accent: #ff8b5c;
  --green: #55d89b;
  --explorer-width: 245px;
  --agent-width: 470px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 18px 0 8px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .16em; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 25%, #202234 0, transparent 37%), var(--bg); }
.login-card { width: min(440px, 100%); padding: 38px; border: 1px solid #292f3e; border-radius: 18px; background: #0f121bee; box-shadow: 0 30px 80px #0009; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(135deg, #ff9c67, #da5e49); color: #1a0b08; font-weight: 800; }
.login-card h1 { margin: 0 0 10px; font-size: 30px; }
.login-card p:not(.eyebrow) { color: var(--muted); line-height: 1.5; }
.login-card label { display: block; margin: 25px 0 8px; color: #aeb6c5; font-size: 12px; }
.login-card input { width: 100%; padding: 13px; border: 1px solid #30384a; border-radius: 8px; outline: none; background: var(--bg); color: #fff; }
.login-card input:focus, .composer textarea:focus { border-color: var(--accent); }
.login-card button, .composer button { margin-top: 12px; padding: 13px; border: 0; border-radius: 8px; background: var(--accent); color: #1e0c06; font-weight: 750; }
.login-card button { width: 100%; }
.error { min-height: 20px; margin-top: 12px; color: #ff7d7d; font-size: 13px; }

.workspace { height: 100vh; display: grid; grid-template-rows: 48px 1fr; }
.topbar { display: grid; grid-template-columns: 260px minmax(200px, 1fr) 260px; align-items: center; gap: 16px; padding: 0 14px; border-bottom: 1px solid var(--line); background: #0c0f15; }
.wordmark, .status { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.brand-dot, .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px #55d89b88; }
.brand-dot { background: var(--accent); }
.muted, .status { color: var(--muted); }
.status { justify-self: end; font-size: 12px; }
select { padding: 7px 10px; border: 1px solid #2a3140; border-radius: 6px; outline: none; background: #111620; color: #dbe2ed; }
.repo-picker { width: min(680px, 100%); display: flex; justify-self: center; gap: 7px; }
.repo-picker select { min-width: 0; flex: 1; }
.repo-picker button { flex: 0 0 auto; padding: 7px 10px; border: 1px solid #343c4d; border-radius: 6px; background: #171c27; color: #d8dfeb; font-size: 11px; }
.repo-picker button:hover { border-color: var(--accent); color: #fff; }

.panels { min-height: 0; display: grid; grid-template-columns: var(--explorer-width) 5px minmax(260px, 1fr) 5px var(--agent-width); }
.panel { min-width: 0; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); }
.panel-resizer { position: relative; z-index: 3; cursor: col-resize; background: #11151d; touch-action: none; }
.panel-resizer::after { content: ""; position: absolute; inset: 0 1px; background: transparent; transition: background .15s; }
.panel-resizer:hover::after, .panel-resizer:active::after { background: var(--accent); }
.panel-title { height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--line); color: #9ba5b5; font-size: 10px; letter-spacing: .12em; }
.icon-button, .text-button { border: 0; background: transparent; color: #aab4c3; }
.icon-button { font-size: 18px; }
.text-button { padding: 5px; font-size: 10px; }
.text-button:hover { color: #fff; }
.text-button.danger:hover { color: #ff9393; }
.tree { height: calc(100% - 42px); overflow: auto; padding: 8px 6px; }
.tree.empty { padding: 20px; color: var(--muted); font-size: 13px; }
.file { width: 100%; display: flex; align-items: center; gap: 7px; overflow: hidden; padding: 5px 8px; border: 0; border-radius: 5px; background: transparent; color: #c4ccda; text-align: left; white-space: nowrap; text-overflow: ellipsis; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.file:hover, .file.active { background: #1b2130; color: #fff; }
.file span:first-child { color: #77859a; }

.editor { display: grid; grid-template-rows: 42px 1fr 28px; background: #0b0e14; }
.editor-head, .editor-foot { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--line); color: #adb6c5; font-size: 12px; }
.editor-head button { padding: 5px 9px; border: 1px solid #343c4d; border-radius: 6px; background: #171c27; color: #d8dfeb; }
.editor-head button:disabled { opacity: .35; cursor: default; }
.editor-actions { display: flex; gap: 6px; }
.editor-actions #close-file { min-width: 28px; font-size: 16px; line-height: 1; }
.changes-count { margin-left: 7px; padding: 2px 5px; border-radius: 5px; background: #4a2d1d; color: #ffc28f; font-size: 9px; }
kbd { color: #737e90; font-size: 10px; }
.dirty { margin-left: 6px; color: var(--accent); }
.editor textarea { resize: none; padding: 18px; border: 0; outline: 0; background: #0b0e14; color: #d9e1ed; white-space: pre; tab-size: 2; cursor: text; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, monospace; }
.editor-foot { border-top: 1px solid var(--line); border-bottom: 0; color: #6f7888; font-size: 10px; }

.agent-panel { display: grid; grid-template-rows: minmax(68px, auto) 1fr auto; border: 0; background: var(--panel2); }
.agent-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.agent-head .eyebrow { margin: 0 0 2px; font-size: 8px; }
.agent-head h2 { margin: 0; font-size: 19px; }
.agent-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.agent-actions #session-select { max-width: 145px; }
.agent-actions button:disabled { opacity: .35; cursor: default; }
.agent-head select { max-width: 220px; font-size: 11px; }
.jobs { overflow: auto; padding: 14px; }
.welcome { padding: 18vh 24px; color: var(--muted); text-align: center; }
.welcome span { color: var(--accent); font-size: 38px; }
.welcome h3 { margin: 12px 0 6px; color: #e8edf5; }
.welcome p { font-size: 13px; line-height: 1.5; }
.message { max-width: 94%; margin: 0 0 12px; overflow: hidden; border: 1px solid #232a38; border-radius: 10px; }
.message.user { margin-left: auto; border-color: #2b405f; background: #172030; }
.message.assistant { margin-right: auto; background: #0c1018; }
.message-head { padding: 7px 10px; border-bottom: 1px solid #273044; color: #94a2b6; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.message-content { padding: 11px; color: #d2dae6; white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.55; }
.citation-link { display: inline; padding: 0; border: 0; background: transparent; color: #8db9ff; text-decoration: underline; font: inherit; }
.citation-link:hover { color: #c5ddff; }
.job { max-width: 94%; margin-bottom: 12px; overflow: hidden; border: 1px solid #232a38; border-radius: 10px; background: #0c1018; }
.job-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 11px; border-bottom: 1px solid #202633; }
.badge { padding: 4px 6px; border-radius: 5px; background: #4a2d1d; color: #ffc28f; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.badge.failed, .badge.cancelled { background: #451f25; color: #ff9393; }
.job-output { max-height: 320px; overflow: auto; padding: 11px; background: #080b10; color: #b9c5d6; white-space: pre-wrap; word-break: break-word; font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.cancel { border: 0; background: transparent; color: #ff9d88; font-size: 11px; }
.composer { padding: 12px; border-top: 1px solid var(--line); background: #0e121a; }
.composer textarea { width: 100%; min-height: 62px; max-height: 40vh; resize: vertical; padding: 11px; border: 1px solid #2b3342; border-radius: 9px; outline: none; background: #090c12; color: #fff; line-height: 1.45; }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.composer-row > span { color: #737d8f; font-size: 10px; }
.composer button { width: auto; margin: 8px 0 0; padding: 8px 12px; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: #05070bcc; backdrop-filter: blur(5px); }
.dialog-card { width: min(620px, 100%); max-height: 90vh; overflow: auto; padding: 22px; border: 1px solid #30394a; border-radius: 14px; background: #111620; box-shadow: 0 24px 80px #000b; }
.dialog-card h2 { margin: 0 0 14px; }
.dialog-card .eyebrow { margin-top: 0; }
.dialog-card ol { padding-left: 22px; color: #c8d0dd; font-size: 13px; line-height: 1.55; }
.dialog-card li + li { margin-top: 8px; }
.dialog-card textarea { width: 100%; resize: vertical; padding: 11px; border: 1px solid #30394a; border-radius: 8px; background: #090c12; color: #fff; line-height: 1.45; }
.dialog-card label { display: block; margin: 13px 0 6px; color: #aeb6c5; font-size: 11px; }.manual-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; }.manual-tools button, .manual-tools a { padding: 7px 10px; border: 0; border-radius: 6px; background: #242b38; color: #d8dfeb; text-decoration: none; font-size: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.dialog-actions button { padding: 9px 12px; border: 0; border-radius: 7px; background: var(--accent); color: #1e0c06; font-weight: 700; }
.dialog-actions .secondary { background: #242b38; color: #d8dfeb; }
.privacy-note { padding: 12px; border: 1px solid #5a4227; border-radius: 8px; background: #2b2217; color: #e5c99e; font-size: 12px; line-height: 1.5; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 30; padding: 10px 14px; border: 1px solid #394357; border-radius: 8px; opacity: 0; pointer-events: none; transform: translate(-50%, 20px); transition: .2s; background: #1d2431; color: #fff; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mobile-tabs { display: none; }

@media (max-width: 900px) {
  body { overflow: auto; }
  .workspace { height: 100dvh; grid-template-rows: 48px 43px 1fr; }
  .topbar { grid-template-columns: 1fr auto; padding: 0 10px; }
  .topbar .muted, .status { display: none; }
  .repo-picker { grid-column: 2; width: min(250px, 62vw); }
  .repo-picker button { padding: 7px; font-size: 0; }
  #new-project::after { content: "+"; font-size: 15px; }
  #publish-project::after { content: "GH"; font-size: 10px; }
  .mobile-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); background: #0c0f15; }
  .mobile-tabs button { border: 0; background: transparent; color: var(--muted); font-size: 12px; }
  .mobile-tabs button.active { border-bottom: 2px solid var(--accent); color: #fff; }
  .panels { display: block; min-height: 0; }
  .panel-resizer { display: none; }
  .panel { display: none; height: calc(100dvh - 91px); border: 0; }
  .panel.mobile-active, .agent-panel.mobile-active { display: grid; }
  .explorer.mobile-active { display: block; }
  .welcome { padding-top: 14vh; }
  .agent-head { min-height: 68px; padding: 7px 10px; }
  .agent-actions .danger { display: none; }
  .agent-actions .text-button { display: inline-block; }
  .agent-head select { max-width: 210px; }
  .dialog-card { padding: 17px; }
}
