:root {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color-scheme: dark;
  color: #ccc9c0;
  background: #1c1e1c;
  font-size: 14px;
  --line: #393d37;
  --muted: #a09f94;
  --paper: #222520;
  --soft: #2c3029;
  --accent: #92aa88;
  --error: #d69a8c;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}
button:hover {
  background: var(--soft);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
input,
textarea {
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
}
button.primary {
  color: #1c241a;
  background: var(--accent);
  border-color: var(--accent);
}
[hidden] {
  display: none !important;
}
.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100dvh;
}
.rail {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.brand {
  padding: 27px 22px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand h1 {
  font-size: 16px;
  letter-spacing: -0.4px;
  margin: 0;
  font-weight: 600;
}
.status {
  font-size: 11px;
  color: var(--muted);
}
.search {
  margin: 0 16px 14px;
  width: calc(100% - 32px);
}
.sessions {
  overflow: auto;
  padding: 0 9px;
  flex: 1;
}
.session {
  border: 0;
  border-radius: 8px;
  text-align: left;
  width: 100%;
  padding: 14px 12px;
  margin: 2px 0;
  display: block;
}
.session[aria-current="true"] {
  background: var(--soft);
  box-shadow: inset 3px 0 var(--accent);
}
.session .meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.session .title {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session .path {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail footer {
  padding: 16px 22px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.rail footer button {
  float: right;
  padding: 0;
  border: 0;
  font-size: 11px;
}
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  padding: 30px;
  max-width: 450px;
  line-height: 1.7;
}
.empty h2 {
  color: inherit;
  font-size: 21px;
  font-weight: 450;
  letter-spacing: -0.5px;
}
.conversation {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.head {
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 15px;
  align-items: center;
}
.heading {
  min-width: 0;
  flex: 1;
}
.heading h2 {
  font-size: 16px;
  font-weight: 550;
  margin: 0 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.heading p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tabs button {
  font-size: 12px;
  border-color: transparent;
}
.tabs button[aria-pressed="true"] {
  background: var(--soft);
  border-color: var(--line);
}
.back {
  display: none;
}
.scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  scroll-behavior: auto;
  padding: 30px max(24px, calc((100% - 800px) / 2));
}
.message {
  line-height: 1.65;
  margin: 0 0 30px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.user {
  padding: 15px 18px;
  background: var(--soft);
  border-radius: 10px;
}
.by {
  display: block;
  font-size: 10px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 12px 0;
}
.terminal {
  padding: 16px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.terminal img {
  width: 100%;
  height: auto;
  display: block;
}
.terminal pre {
  font:
    12px/1.5 ui-monospace,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.keys {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 0;
}
.keys button {
  font-size: 12px;
}
.compose {
  border-top: 1px solid var(--line);
  padding: 16px max(24px, calc((100% - 800px) / 2))
    max(16px, env(safe-area-inset-bottom));
  background: var(--paper);
}
textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 78px;
  max-height: 220px;
  border: 0;
  background: transparent;
  padding: 0;
  line-height: 1.5;
}
.compose-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.feedback {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
.feedback.error {
  color: var(--error);
}
.login {
  max-width: 370px;
  margin: 18vh auto;
  padding: 24px;
}
.login h1 {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.8px;
}
.login p {
  color: var(--muted);
  line-height: 1.6;
}
.login input {
  width: 100%;
  margin: 12px 0;
}
.login button {
  width: 100%;
}
.jump {
  position: absolute;
  bottom: 190px;
  right: 30px;
  background: var(--paper);
  box-shadow: 0 2px 10px #0001;
  font-size: 12px;
}
body.offline .status {
  color: var(--error);
}
@media (max-width: 700px) {
  .shell {
    display: block;
  }
  .rail {
    height: 100dvh;
    border: 0;
  }
  .main {
    display: none;
  }
  body.open .rail {
    display: none;
  }
  body.open .main {
    display: flex;
  }
  .back {
    display: block;
    padding: 7px 10px;
  }
  .head {
    padding: 14px 16px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .heading {
    width: calc(100% - 60px);
  }
  .tabs {
    margin-left: 46px;
  }
  .scroll {
    padding: 22px 18px;
  }
  .compose {
    padding: 14px 18px max(14px, env(safe-area-inset-bottom));
  }
  .brand {
    padding-top: 24px;
  }
  .login {
    margin-top: 12vh;
  }
  .jump {
    bottom: 195px;
    right: 18px;
  }
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
::selection {
  color: #dedbd2;
  background: #43523e;
}
@media (max-width: 700px) {
  input,
  textarea {
    font-size: 16px;
  }
  .head button,
  .keys button,
  #send {
    min-height: 44px;
    min-width: 44px;
  }
}
@media (max-width: 700px) {
  .head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
  }
  .heading {
    width: auto;
  }
  .tabs {
    grid-column: 2;
    margin-left: 0;
  }
}

.new-session { margin: 0 16px 12px; }
.new-session > button { width: 100%; }
.new-session form { display: grid; gap: 8px; margin-top: 12px; }
.new-session input, .new-session select { width: 100%; min-width: 0; }
.new-session select { font: inherit; color: inherit; background: var(--paper); padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
#createStatus { font-size: 12px; margin: 8px 0 0; }

[data-harness] { --harness-color: #b7c4d4; }
[data-harness="codex"] { --harness-color: #7edab5; }
[data-harness="claude"] { --harness-color: #efa37f; }
[data-harness="glm"] { --harness-color: #c3a3f5; }
[data-harness="whale"] { --harness-color: #78cce8; }
[data-harness="opencode"] { --harness-color: #9cb6ff; }
[data-harness="aider"] { --harness-color: #e5cc7b; }
[data-harness="kimi"] { --harness-color: #ed9cc9; }
[data-harness="gemini"] { --harness-color: #8db8ff; }
[data-harness="pi"] { --harness-color: #c1d885; }
.harness { color: var(--harness-color); font-size: 11px; font-weight: 650; border: 1px solid currentColor; border-radius: 5px; padding: 2px 6px; display: inline-block; }
.session .dot { background: var(--harness-color); }
.session[aria-current="true"] { box-shadow: inset 3px 0 var(--harness-color); }
.heading .harness { margin-bottom: 5px; }
.tabs { flex-wrap: wrap; }
button.danger { color: #f0a39e; border-color: #84514e; }

/* Native per-thread goal inspector. */
.shell.goals-open { grid-template-columns: 270px minmax(0, 1fr) 370px; }
.goal-drawer { min-width: 0; overflow-y: auto; padding: 24px; border-left: 1px solid var(--line); background: var(--paper); }
.goal-drawer header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.goal-drawer h2 { margin: 5px 0 0; font-size: 19px; font-weight: 500; }
.goal-drawer .eyebrow { font-size: 10px; letter-spacing: 1.4px; color: var(--accent); }
.goal-thread { font-family: monospace; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.goal-drawer form { display: flex; flex-direction: column; gap: 10px; }
.goal-drawer textarea { width: 100%; resize: vertical; min-height: 130px; }
.goal-drawer select { width: 100%; font: inherit; color: inherit; background: var(--paper); padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.goal-drawer label { margin-top: 6px; font-size: 12px; color: var(--muted); }
.goal-drawer .note { line-height: 1.6; margin: 8px 0 16px; }
.goal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.goal-usage { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 12px; }
.goal-usage dt { color: var(--muted); }
.goal-usage dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
#goalMessage { line-height: 1.5; }
#goalMessage.error { color: var(--error); }
@media (max-width: 1150px) {
  .shell.goals-open { grid-template-columns: 300px minmax(0, 1fr); }
  .goal-drawer { position: fixed; inset: 0 0 0 auto; width: min(420px, 100%); z-index: 10; box-shadow: -16px 0 40px #0005; }
}
@media (max-width: 700px) {
  .shell.goals-open { grid-template-columns: minmax(0, 1fr); }
}
