:root {
  color-scheme: dark;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #111312;
  color: #e8ebe8;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: #111312;
}
button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid #2a2d2b;
  background: #171918;
}
.brand {
  font-weight: 680;
}
.connection-status {
  color: #9ca39e;
  font-size: 13px;
}
.connection-status.online {
  color: #63d296;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: calc(100vh - 52px);
}
.hosts-pane {
  border-right: 1px solid #2a2d2b;
  background: #151716;
  overflow-y: auto;
}
.pane-title {
  padding: 16px 16px 10px;
  color: #9ca39e;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.host-list {
  display: grid;
  gap: 2px;
  padding: 0 8px 16px;
}
.host-item {
  width: 100%;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 11px 10px;
  border: 0;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.host-item:hover,
.host-item.active {
  background: #242725;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666d68;
}
.status-dot.online {
  background: #48c985;
}
.host-primary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.host-secondary {
  margin-top: 3px;
  color: #858c87;
  font-size: 12px;
}

.session-pane {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.session-header {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid #2a2d2b;
}
.session-title {
  min-width: 0;
}
h1 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 650;
}
.host-meta {
  margin-top: 4px;
  color: #8f9691;
  font-size: 12px;
}
.session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.thread-picker {
  display: block;
}
.thread-picker select {
  width: min(320px, 32vw);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.timeline {
  overflow-y: auto;
  padding: 24px 24px 36px;
  scroll-behavior: smooth;
}
.empty-state {
  display: grid;
  height: 100%;
  place-items: center;
  color: #737a75;
}
.message {
  width: min(100%, 880px);
  margin: 0 auto 24px;
}
.message > header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #8d958f;
  font-size: 12px;
}
.message > header strong {
  color: #cdd2ce;
  font-weight: 650;
}
.message.user {
  width: fit-content;
  max-width: min(78%, 720px);
  margin-right: max(0px, calc((100% - 880px) / 2));
  margin-left: auto;
  padding: 12px 14px;
  border: 1px solid #39413d;
  border-radius: 8px 8px 2px 8px;
  background: #252a27;
}
.message.user > header {
  margin-bottom: 5px;
}
.message.assistant {
  padding-right: 32px;
}
.message.streaming .message-content::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -2px;
  background: #73c79a;
  animation: cursor-blink 1s steps(2, jump-none) infinite;
}
.message.plan-message {
  border-left: 2px solid #507b92;
  padding-left: 14px;
}
.message-content {
  color: #dce0dc;
  font-size: 14px;
  line-height: 1.65;
}
.rich-text > :first-child {
  margin-top: 0;
}
.rich-text > :last-child {
  margin-bottom: 0;
}
.rich-text p {
  margin: 0 0 12px;
}
.rich-text h3,
.rich-text h4,
.rich-text h5,
.rich-text h6 {
  margin: 22px 0 8px;
  color: #f0f2f0;
  font-size: 15px;
  line-height: 1.35;
}
.rich-text h3 {
  font-size: 17px;
}
.rich-text ul,
.rich-text ol {
  margin: 8px 0 14px;
  padding-left: 22px;
}
.rich-text li {
  margin: 4px 0;
}
.rich-text blockquote {
  margin: 12px 0;
  padding-left: 14px;
  border-left: 2px solid #59625c;
  color: #abb2ad;
}
.rich-text hr {
  margin: 20px 0;
  border: 0;
  border-top: 1px solid #303532;
}
.rich-text a {
  color: #7ec5e2;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.rich-text code:not(.code-block code) {
  border: 1px solid #353a37;
  border-radius: 4px;
  padding: 1px 5px;
  background: #1b1e1c;
  color: #e2d8b4;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}
.code-block {
  margin: 12px 0;
  overflow: auto;
  border: 1px solid #303532;
  border-radius: 6px;
  padding: 12px 14px;
  background: #0d0f0e;
  color: #d4d9d5;
  font-size: 12px;
  line-height: 1.55;
}
.code-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
}
.command-output {
  max-height: 320px;
  color: #bfc6c1;
}
.table-scroll {
  margin: 14px 0;
  overflow-x: auto;
  border: 1px solid #303532;
  border-radius: 6px;
}
.rich-text table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rich-text th,
.rich-text td {
  padding: 8px 10px;
  border-right: 1px solid #303532;
  border-bottom: 1px solid #303532;
  text-align: left;
  vertical-align: top;
}
.rich-text th:last-child,
.rich-text td:last-child {
  border-right: 0;
}
.rich-text tbody tr:last-child td {
  border-bottom: 0;
}
.rich-text th {
  background: #202421;
  color: #eef1ee;
}
.activity {
  width: min(100%, 880px);
  margin: 0 auto 10px;
  border: 1px solid #303532;
  border-radius: 6px;
  background: #171a18;
  color: #cfd4d0;
}
.activity > summary {
  min-height: 42px;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  list-style-position: outside;
}
.activity-title {
  color: #e1e5e2;
  font-size: 12px;
  font-weight: 650;
}
.activity-summary {
  min-width: 0;
  overflow: hidden;
  color: #8f9791;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-status {
  min-width: 42px;
  color: #8f9791;
  font-size: 11px;
  text-align: right;
}
.activity-status.completed {
  color: #66c992;
}
.activity-status.running {
  color: #e2bd69;
}
.activity-status.failed {
  color: #e1847f;
}
.activity-body {
  padding: 4px 12px 12px;
  border-top: 1px solid #2b302d;
  color: #c8ceca;
  font-size: 13px;
  line-height: 1.55;
}
.activity-body > p {
  margin: 10px 0 0;
}
.activity-meta {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  padding-top: 10px;
  color: #858d87;
  font-size: 11px;
}
.activity-meta code {
  overflow-wrap: anywhere;
  color: #c9cfcb;
}
.reasoning-activity {
  border-color: #363b38;
  background: transparent;
}
.reasoning-activity .activity-body {
  color: #aeb5b0;
}
.file-changes section + section {
  margin-top: 16px;
}
.file-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
}
.file-heading code {
  overflow-wrap: anywhere;
  color: #d7dcd8;
}
.change-kind {
  min-width: 50px;
  color: #76c89a;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.change-kind.delete {
  color: #dc817b;
}
.plan-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 24px;
}
.plan-list li::marker {
  color: #727a74;
}
.plan-list li.completed {
  color: #8f9791;
  text-decoration: line-through;
}
.plan-list li.inProgress {
  color: #edf0ed;
}
.notice {
  width: min(100%, 880px);
  display: flex;
  gap: 10px;
  margin: 12px auto;
  padding: 9px 12px;
  border-left: 2px solid #65706a;
  background: #191c1a;
  color: #aab1ac;
  font-size: 12px;
}
.notice strong {
  flex: 0 0 auto;
  color: #dce0dd;
}
.notice.error {
  border-left-color: #c66f69;
}
.load-older {
  display: block;
  min-height: 34px;
  margin: 0 auto 22px;
  border: 1px solid #393f3b;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: #aab1ac;
  cursor: pointer;
}
.load-older:hover {
  background: #202421;
}
.working-indicator {
  width: min(100%, 880px);
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 18px auto 4px;
  color: #929a94;
  font-size: 12px;
}
.working-dots {
  display: flex;
  gap: 3px;
}
.working-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #70bd91;
  animation: working-dot 1.2s ease-in-out infinite;
}
.working-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.working-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

@keyframes working-dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.composer {
  padding: 12px 16px 16px;
  border-top: 1px solid #2a2d2b;
  background: #171918;
}
label {
  display: grid;
  gap: 5px;
  color: #979e99;
  font-size: 12px;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #353936;
  border-radius: 6px;
  outline: none;
  background: #101211;
  color: #edf0ed;
}
input,
select {
  height: 36px;
  padding: 0 10px;
}
textarea {
  min-height: 52px;
  resize: vertical;
  padding: 10px 12px;
  line-height: 1.45;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #6cae8a;
  box-shadow: 0 0 0 2px #244232;
}
.prompt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 10px;
  align-items: stretch;
}
.button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  color: #edf0ed;
  cursor: pointer;
}
.button:disabled {
  opacity: 0.42;
  cursor: default;
}
.button.primary {
  background: #2f8058;
}
.button.primary:hover {
  background: #389467;
}
.button.secondary {
  border-color: #414642;
  background: transparent;
}
.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid #414642;
  border-radius: 6px;
  padding: 0;
  background: transparent;
  color: #edf0ed;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.icon-button:hover {
  background: #242725;
}
.icon-button:disabled {
  opacity: 0.42;
  cursor: default;
}

dialog {
  width: 380px;
  max-width: calc(100vw - 32px);
  border: 1px solid #383c39;
  border-radius: 8px;
  padding: 0;
  background: #191c1a;
  color: inherit;
}
dialog::backdrop {
  background: rgb(5 7 6 / 72%);
}
.login-form {
  display: grid;
  gap: 18px;
  padding: 22px;
}
.login-form h2 {
  margin: 0;
  font-size: 18px;
}

@media (max-width: 720px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 112px minmax(0, 1fr);
  }
  .hosts-pane {
    border-right: 0;
    border-bottom: 1px solid #2a2d2b;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .pane-title {
    padding: 9px 12px 5px;
  }
  .host-list {
    display: flex;
    gap: 6px;
    padding: 0 10px 10px;
  }
  .host-item {
    flex: 0 0 180px;
  }
  .session-header {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 10px 12px;
  }
  .session-actions {
    width: 100%;
  }
  .thread-picker {
    min-width: 0;
    flex: 1;
  }
  .thread-picker select {
    width: 100%;
  }
  .timeline {
    padding: 16px 12px 24px;
  }
  .message {
    margin-bottom: 20px;
  }
  .message.user {
    max-width: 88%;
    margin-right: 0;
  }
  .message.assistant {
    padding-right: 0;
  }
  .activity > summary {
    grid-template-columns: max-content minmax(0, 1fr);
  }
  .activity-status {
    display: none;
  }
  .notice {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .composer {
    padding: 10px 10px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .timeline {
    scroll-behavior: auto;
  }
  .message.streaming .message-content::after,
  .working-dots i {
    animation: none;
  }
}
