:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1f232f;
  --border: #2a2f3c;
  --text: #e6e8ee;
  --muted: #8b93a7;
  --accent: #6d8bff;
  --accent-2: #4f6ef0;
  --green: #46c08b;
  --red: #e5648a;
  --yellow: #e0b341;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
}
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
}
button.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
button.primary:hover { background: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.danger { color: var(--red); }
input, select, textarea {
  font: inherit;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}
textarea { resize: vertical; font-family: var(--mono); }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 5px; }

/* login */
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card {
  width: 340px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px;
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login-card .row { margin-bottom: 14px; }
.error { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 6px; }

/* app layout */
.app { display: grid; grid-template-columns: 280px 1fr; height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--border); padding: 18px; overflow-y: auto; }
.sidebar h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.brand { display: flex; align-items: center; justify-content: space-between; }
.brand strong { font-size: 16px; }
.proj { padding: 9px 11px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; font-size: 14px; }
.proj:hover { background: var(--panel-2); }
.proj.active { background: var(--panel-2); border-color: var(--accent-2); }
.proj small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; word-break: break-all; }

.main { display: flex; flex-direction: column; padding: 22px; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.topbar h1 { font-size: 18px; margin: 0; }
.who { color: var(--muted); font-size: 13px; }

.composer { display: flex; gap: 10px; margin-bottom: 14px; }
.composer textarea { flex: 1; min-height: 64px; }

.output {
  flex: 1; background: #0b0d13; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; overflow-y: auto; font-family: var(--mono); font-size: 13px;
  white-space: pre-wrap; line-height: 1.5;
}
.output .line-assistant { color: var(--text); }
.output .line-system, .output .line-result { color: var(--muted); }
.output .line-stderr, .output .line-error { color: var(--red); }
.output .line-tool_result { color: var(--yellow); }
.output .line-tool_use { color: var(--accent); }
.output .line-thinking { color: var(--muted); font-style: italic; }
.output .line-you { color: var(--accent, #6ea8fe); font-weight: 600; }

.status-pill { font-size: 12px; padding: 2px 9px; border-radius: 20px; border: 1px solid var(--border); }
.status-pill.running { color: var(--yellow); }
.status-pill.done { color: var(--green); }
.status-pill.error, .status-pill.killed { color: var(--red); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: 420px; }
.modal h3 { margin: 0 0 16px; }
.modal .row { margin-bottom: 12px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.hidden { display: none !important; }
.muted-link { background: none; border: none; color: var(--muted); padding: 4px; font-size: 12px; }
.history-item { font-size: 12px; padding: 7px 9px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.history-item:hover { background: var(--panel-2); color: var(--text); }

/* git workflow bar */
.git-bar { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.inline { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); margin: 0; }
.inline input { width: auto; }
.git-opts { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-top: 12px; }
.git-field { display: flex; flex-direction: column; gap: 4px; }
.git-field input { width: 180px; }
.branch-preview { font-size: 13px; color: var(--muted); flex-basis: 100%; }
.branch-preview code { color: var(--accent); background: var(--panel-2); padding: 2px 7px; border-radius: 6px; }

/* modal tabs + hints */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab { font-size: 13px; padding: 7px 12px; }
.tab.active { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; line-height: 1.5; }
.hint code, label code { color: var(--accent); }
