﻿/* Vibe Coder — a terminal-adjacent look, because that is what this kind of agent feels like to use. */

:root {
  --bg: #0d1117;
  --bg-panel: #12181f;
  --bg-raised: #171e26;
  --bg-input: #0a0e13;
  --border: #232c37;
  --border-bright: #33404f;

  --text: #d6dee8;
  --text-dim: #8494a6;
  --text-faint: #5d6b7c;

  --accent: #58a6ff;
  --accent-dim: #1f6feb;
  --good: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --tool: #bc8cff;
  --think: #6e7f95;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  overflow: hidden;
}

button {
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--border-bright);
  background: var(--bg-raised);
  color: var(--text);
  padding: 6px 12px;
  transition: background 120ms, border-color 120ms;
}
button:hover:not(:disabled) { background: #1f2833; border-color: var(--accent-dim); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

button.primary { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #2b7de9; }
button.danger { border-color: #6e2822; color: #ff9c95; }
button.danger:hover:not(:disabled) { background: #3d1a17; }
button.good { border-color: #23703a; color: #7ee68f; }
button.good:hover:not(:disabled) { background: #16351f; }
button.mini { padding: 2px 7px; font-size: 12px; line-height: 1.4; }

/* ------------------------------------------------------------------ top bar */

.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}

.brand { display: flex; align-items: center; gap: 10px; }
.logo { color: var(--accent); font-size: 22px; }
.brand-title { font-weight: 650; letter-spacing: 0.2px; }
.brand-sub { font-size: 11px; color: var(--text-faint); }

.topbar-controls { display: flex; align-items: center; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 2px; }
.field > span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-faint); }
.field select {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 4px 6px;
  font-family: var(--mono);
  font-size: 12px;
  max-width: 230px;
}

/* ------------------------------------------------------------------- layout */

.layout {
  height: calc(100% - 52px);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--bg-panel);
  overflow-y: auto;
  min-height: 0;
}
.rail.left { border-right: 1px solid var(--border); }
.rail.right { border-left: 1px solid var(--border); }

.panel { padding: 12px; border-bottom: 1px solid var(--border); min-height: 0; }
.panel.grow { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.panel h2 {
  margin: 0 0 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-faint);
  font-weight: 600;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { margin-bottom: 8px; }
.head-actions { display: flex; align-items: center; gap: 5px; margin-bottom: 8px; }

.badge {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  background: var(--bg-raised);
  border-radius: 10px;
  padding: 1px 7px;
}

.footnote { font-size: 10.5px; color: var(--text-faint); line-height: 1.5; margin: 8px 0 0; }
.footnote code, .hint code { font-family: var(--mono); color: var(--text-dim); }

/* ----------------------------------------------------------------- sessions */

.session-list, .file-list, .tool-list, .tree-list, .diagnostics {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto;
  min-height: 0;
}
.session-list { max-height: 190px; }

.session-item {
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  border: 1px solid transparent;
}
.session-item:hover { background: var(--bg-raised); }
.session-item.active { background: var(--bg-raised); border-color: var(--accent-dim); }
.session-item .title { font-weight: 600; }
.session-item .meta { font-size: 10px; color: var(--text-faint); font-family: var(--mono); }

.path-crumb {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 0 8px;
  word-break: break-all;
}

.file-item {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11.5px;
}
.file-item:hover { background: var(--bg-raised); }
.file-item .size { color: var(--text-faint); font-size: 10px; }
.file-item.dir { color: var(--accent); }

/* -------------------------------------------------------------------- tools */

.tool-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  cursor: pointer;
}
.tool-item:hover { background: var(--bg-raised); }
.tool-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: none; }
.tool-item.active .dot { background: var(--good); }
.tool-item .ro { color: var(--text-faint); font-size: 10px; margin-left: auto; }

.diagnostics li {
  font-size: 11px; line-height: 1.5;
  padding: 5px 7px; margin-top: 5px;
  border-radius: 4px;
  border-left: 2px solid var(--warn);
  background: rgba(210, 153, 34, 0.08);
  color: #e3c169;
}
.diagnostics li.error { border-left-color: var(--bad); background: rgba(248, 81, 73, 0.08); color: #ffa19b; }

/* --------------------------------------------------------------- tree + meter */

.tree-item {
  display: flex; align-items: baseline; gap: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.45;
  font-family: var(--mono);
}
.tree-item.on-branch { opacity: 1; }
.tree-item:hover { background: var(--bg-raised); }
.tree-item.leaf { border-left: 2px solid var(--accent); }
.tree-item .kind {
  flex: none; width: 62px;
  color: var(--text-faint);
  text-transform: lowercase;
  font-size: 10px;
}
.tree-item .preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.meter {
  height: 6px; border-radius: 3px;
  background: var(--bg-input);
  overflow: hidden;
  border: 1px solid var(--border);
}
.meter-fill { height: 100%; width: 0; background: var(--good); transition: width 300ms, background 300ms; }
.meter-fill.warn { background: var(--warn); }
.meter-fill.bad { background: var(--bad); }

.stat-line { font-family: var(--mono); font-size: 11px; margin-top: 6px; }
.stat-line.dim { color: var(--text-faint); }

/* ---------------------------------------------------------------- transcript */

.center { display: flex; flex-direction: column; min-height: 0; min-width: 0; }

.banner {
  padding: 10px 16px;
  background: rgba(210, 153, 34, 0.1);
  border-bottom: 1px solid #4a3a12;
  font-size: 12px;
  display: flex; align-items: center; gap: 12px;
  color: #e3c169;
}
.banner button { flex: none; }

.transcript { flex: 1; overflow-y: auto; padding: 18px 20px 8px; min-height: 0; }

.empty-state { max-width: 620px; margin: 8vh auto; color: var(--text-dim); }
.empty-state h3 { color: var(--text); font-size: 17px; margin: 0 0 10px; }
.empty-state p { line-height: 1.65; margin: 0 0 12px; }
.empty-state .hint { font-size: 12.5px; color: var(--text-faint); }

.turn { margin-bottom: 16px; max-width: 900px; }

.turn-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-faint);
  margin-bottom: 5px;
}
.turn-head .who { font-weight: 700; }
.turn.user .turn-head .who { color: var(--accent); }
.turn.assistant .turn-head .who { color: var(--good); }
.turn.system .turn-head .who { color: var(--text-dim); }

.bubble {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.turn.user .bubble { background: #131c27; border-color: #1d3350; }
.turn.streaming .bubble { border-color: var(--accent-dim); }

.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h1, .bubble h2, .bubble h3 { font-size: 14px; margin: 14px 0 8px; }
.bubble ul, .bubble ol { margin: 0 0 10px; padding-left: 22px; }
.bubble li { margin-bottom: 4px; }
.bubble code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 4px;
}
.bubble pre {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px; margin: 0 0 10px;
  overflow-x: auto;
}
.bubble pre code { background: none; border: none; padding: 0; font-size: 12px; line-height: 1.55; }
.bubble a { color: var(--accent); }

.reasoning {
  border-left: 2px solid var(--think);
  padding: 6px 0 6px 11px;
  margin-bottom: 9px;
  color: var(--think);
  font-size: 12.5px;
  font-style: italic;
  white-space: pre-wrap;
}

.cursor {
  display: inline-block; width: 7px; height: 14px;
  background: var(--accent); vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* --------------------------------------------------------------- tool cards */

.tool-card {
  border: 1px solid var(--border);
  border-left: 2px solid var(--tool);
  border-radius: var(--radius);
  background: var(--bg-panel);
  margin-bottom: 8px;
  max-width: 900px;
  overflow: hidden;
}
.tool-card.error { border-left-color: var(--bad); }
.tool-card.done { border-left-color: var(--good); }
.tool-card.waiting { border-left-color: var(--warn); }

.tool-card-head {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 11px;
  cursor: pointer;
  font-family: var(--mono); font-size: 12px;
  user-select: none;
}
.tool-card-head:hover { background: var(--bg-raised); }
.tool-card-head .chev { color: var(--text-faint); flex: none; width: 10px; }
.tool-card-head .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-card-head .status { flex: none; font-size: 10px; color: var(--text-faint); }
.tool-card-head .spin { color: var(--warn); }

.tool-card-body {
  border-top: 1px solid var(--border);
  padding: 9px 11px;
  font-family: var(--mono); font-size: 11.5px;
  line-height: 1.55;
  max-height: 380px; overflow: auto;
  white-space: pre-wrap;
  color: var(--text-dim);
}
.tool-card-body .args { color: var(--text-faint); margin-bottom: 8px; }
.tool-card-body.hidden { display: none; }

/* diff colouring inside tool output */
.tool-card-body .add { color: #7ee68f; }
.tool-card-body .del { color: #ff9c95; }
.tool-card-body .hunk { color: var(--accent); }

/* ------------------------------------------------------------------ notices */

.notice {
  font-family: var(--mono); font-size: 11px;
  color: var(--text-faint);
  padding: 4px 0 4px 11px;
  border-left: 2px solid var(--border-bright);
  margin-bottom: 7px;
  max-width: 900px;
  white-space: pre-wrap;
}
.notice.retry, .notice.warning { color: var(--warn); border-left-color: var(--warn); }
.notice.error { color: #ffa19b; border-left-color: var(--bad); }
.notice.compaction { color: var(--tool); border-left-color: var(--tool); }
.notice.steering, .notice.followup { color: var(--accent); border-left-color: var(--accent-dim); }

/* ---------------------------------------------------------------- approvals */

.approvals { padding: 0 20px; }

.approval-card {
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  background: rgba(210, 153, 34, 0.07);
  padding: 11px 13px;
  margin-bottom: 9px;
}
.approval-card h4 {
  margin: 0 0 7px; font-size: 12px;
  font-family: var(--mono); color: #e3c169;
}
.approval-card pre {
  margin: 0 0 10px;
  font-family: var(--mono); font-size: 11.5px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  max-height: 200px; overflow: auto;
  white-space: pre-wrap;
  color: var(--text-dim);
}
.approval-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- composer */

.composer { border-top: 1px solid var(--border); background: var(--bg-panel); padding: 10px 20px 12px; }
.composer-row { display: flex; }

.composer textarea {
  flex: 1;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-family: var(--sans); font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}
.composer textarea:focus, .composer input:focus { outline: none; border-color: var(--accent-dim); }

.composer-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.composer-actions .spacer { flex: 1; }

.composer-row.shell { margin-top: 8px; align-items: center; gap: 7px; }
.shell-prompt { font-family: var(--mono); color: var(--good); font-size: 13px; }
.composer input#shell-input {
  flex: 1;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-family: var(--mono); font-size: 12px;
}

/* ------------------------------------------------------------- attachments */

.composer.dropping { outline: 1px dashed var(--accent); outline-offset: -4px; background: #121b26; }

.attachment-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.attachment-strip .chip {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 6px 4px 7px;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  background: var(--bg-input);
  font-family: var(--mono); font-size: 11px;
  max-width: 320px;
}
.attachment-strip .chip img {
  width: 26px; height: 26px; object-fit: cover;
  border-radius: 3px; border: 1px solid var(--border);
  flex: none;
}
.attachment-strip .chip .glyph { color: var(--tool); flex: none; }
.attachment-strip .chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-strip .chip-size { color: var(--text-faint); font-size: 10px; flex: none; }
.attachment-strip .chip button { padding: 0 5px; border-color: transparent; background: none; color: var(--text-faint); }
.attachment-strip .chip button:hover { color: var(--bad); background: none; border-color: transparent; }

.attachment-strip .chip-warning {
  flex-basis: 100%;
  font-size: 11px; color: var(--warn);
  border-left: 2px solid var(--warn);
  padding: 3px 0 3px 9px;
}

/* attachments as rendered inside a message bubble */
.attached { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 9px; }

.attached .attached-image { margin: 0; }
.attached .attached-image img {
  display: block;
  max-width: 320px; max-height: 260px;
  border: 1px solid var(--border-bright); border-radius: var(--radius);
}
.attached .attached-image figcaption {
  font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-top: 4px;
}

.attached .attached-file {
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-input);
  padding: 4px 8px;
}

/* ------------------------------------------------------------ folder picker */

/* The modal body is pre-wrap for the system-prompt view; the picker is a form, so it opts back out. */
.picker { display: flex; flex-direction: column; gap: 10px; white-space: normal; font-family: var(--sans); }
.picker .dim { color: var(--text-faint); font-size: 11.5px; line-height: 1.5; }
.picker-error { color: #ffa19b; font-size: 12px; }

.picker-path { display: flex; gap: 6px; align-items: center; }
.picker-path input { margin: 0; flex: 1; }

/* The [hidden] rule has to follow the display, or the flex box wins and the row never collapses. */
.picker-new { display: flex; flex-direction: column; gap: 6px; }
.picker-new[hidden] { display: none; }
.picker-new-controls { display: flex; gap: 6px; align-items: center; }
.picker-new-controls input { margin: 0; flex: 1; }
.picker-new .picker-error:empty { display: none; }

.picker-shortcuts { display: flex; flex-wrap: wrap; gap: 5px; }

.picker-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 320px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-input);
}
.picker-list .dim { padding: 8px 10px; }

.picker-item {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 5px 10px;
  cursor: pointer;
  font-family: var(--mono); font-size: 11.5px;
}
.picker-item:hover { background: var(--bg-raised); }
.picker-item.dir { color: var(--accent); }
.picker-item .tag { color: var(--good); font-size: 10px; }

.picker-footer { display: flex; align-items: center; gap: 12px; }
.picker-footer .dim { flex: 1; }
.picker-footer button { flex: none; }

/* -------------------------------------------------------------------- modal */

.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal.hidden, .hidden { display: none; }

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  width: min(760px, 92vw);
  max-height: 84vh;
  display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 13px; }
.modal-body {
  padding: 14px;
  overflow: auto;
  font-family: var(--mono); font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-dim);
}
.modal-body input {
  width: 100%;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border-bright); border-radius: var(--radius);
  padding: 8px 10px; font-family: var(--mono); font-size: 12px;
  margin: 6px 0 12px;
}
.modal-body label { display: block; font-family: var(--sans); font-size: 12px; color: var(--text); margin-top: 10px; }
.modal-body select {
  width: 100%;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border-bright); border-radius: var(--radius);
  padding: 7px 9px; font-family: var(--mono); font-size: 12px;
  margin: 6px 0 4px;
}

/* --------------------------------------------------------------- scrollbars */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3542; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3a4757; }

@media (max-width: 1200px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); }
  .rail.right { display: none; }
}
