:root {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #edf0ed;
  background: #121513;
  color-scheme: dark;
  --surface: #171b18;
  --surface-raised: #202621;
  --line: #323b34;
  --soft-line: #292f2a;
  --muted: #a0ada3;
  --green: #a9e6b3;
  --error: #ffb9a9;
  --warning: #f3cf8d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, select, input, textarea { font: inherit; }
button { cursor: pointer; min-height: 38px; }
button:disabled { opacity: .62; cursor: wait; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
h1, h2, p { margin: 0; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute; inline-size: 1px; block-size: 1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.auth { display: grid; place-items: center; min-block-size: 100dvh; padding: 22px; }
.auth-card {
  width: min(100%, 390px); border: 1px solid var(--line); border-radius: 22px;
  background: var(--surface); padding: 32px;
}
.auth h1 { font-size: 1.65rem; margin: 27px 0 9px; line-height: 1.15; letter-spacing: -.035em; }
.auth p { line-height: 1.5; }
.auth form { display: grid; gap: 12px; margin: 24px 0 0; }
.auth form label { font-size: .88rem; color: var(--muted); }
.auth input {
  min-height: 46px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #121513; color: inherit; width: 100%;
}
.auth .primary { margin-top: 4px; min-height: 46px; }
.auth .subtle-button { margin-top: 17px; }
.form-error { color: var(--error); padding: 8px 0 0; font-size: .87rem; overflow-wrap: anywhere; }
.workspace { display: grid; grid-template-columns: 278px minmax(0, 1fr); block-size: 100dvh; }
.sidebar {
  min-width: 0; background: var(--surface); border-right: 1px solid var(--soft-line);
  display: flex; flex-direction: column; padding: 23px 16px 15px;
}
.sidebar-head { display: flex; justify-content: space-between; align-items: center; padding: 0 9px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; letter-spacing: -.03em; }
.brand-mark {
  display: inline-block; width: 23px; aspect-ratio: 1; border-radius: 38% 38% 38% 12%;
  background: var(--green); position: relative; flex: none;
}
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 53%; height: 9%;
  border-radius: 8px; background: #29422e; transform: translate(-50%, -50%) rotate(45deg);
}
.brand-mark::after { transform: translate(-50%, -50%) rotate(-45deg); }
.new-button, .subtle-button, .icon-button, .history-item, .job-action {
  background: transparent; color: inherit; border: 1px solid transparent; border-radius: 9px;
}
.new-button {
  margin: 31px 0 23px; background: #232d25; border-color: #3b4a3d; min-height: 46px;
  text-align: left; padding: 9px 12px; color: #d9efdc; font-weight: 650;
}
.new-button span { margin-right: 6px; color: var(--green); }
.new-button:hover { background: #2c382e; }
.sidebar-label { padding: 0 10px; margin-bottom: 7px; font-size: .75rem; font-weight: 650; color: var(--muted); }
.conversations { flex: 1; overflow: auto; min-height: 0; }
.history-item {
  display: flex; align-items: center; text-align: left; width: 100%; gap: 9px;
  min-height: 43px; padding: 7px 10px; font-size: .9rem;
}
.history-item:hover, .history-item[aria-current="true"], .subtle-button:hover, .icon-button:hover, .job-action:hover {
  background: var(--surface-raised);
}
.history-item[aria-current="true"] { border-color: var(--line); }
.history-item span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-empty { font-size: .83rem; padding: 7px 10px; }
.history-status { color: var(--muted); font-size: .69rem; flex: none; }
.history-status[data-status="running"] { color: var(--green); }
.history-status[data-status="queued"], .history-status[data-status="interrupted"] { color: var(--warning); }
.history-status[data-status="failed"] { color: var(--error); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.connection[data-state="online"] .dot { background: var(--green); }
.connection[data-state="offline"] .dot { background: var(--error); }
.sidebar-footer { display: flex; flex-wrap: wrap; border-top: 1px solid var(--soft-line); margin-top: 10px; padding-top: 9px; }
.docs-link { display: grid; align-items: center; min-height: 38px; text-decoration: none; }
.subtle-button, .job-action { padding: 3px 9px; color: var(--muted); font-size: .85rem; }
.sidebar-close, .menu-button, .scrim { display: none; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  min-height: 70px; border-bottom: 1px solid var(--soft-line); padding: 12px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar-leading { min-width: 0; display: flex; align-items: center; gap: 11px; }
.chat-heading { min-width: 0; }
.topbar h1 { min-width: 0; font-size: 1rem; font-weight: 650; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-meta {
  display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .73rem;
}
.chat-project, .chat-provider { margin-top: 3px; }
.chat-project { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-provider { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-project:not([hidden]) + .chat-provider::before { content: "·"; margin-right: 6px; }
.connection { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .76rem; white-space: nowrap; }
.notice {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--warning); background: #262119; border-bottom: 1px solid #413624;
  padding: 4px 22px; font-size: .84rem;
}
.notice-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.notice .subtle-button { color: inherit; flex: none; }
.timeline { overflow: auto; flex: 1; overscroll-behavior: contain; min-height: 0; }
.welcome {
  display: grid; justify-items: center; align-content: center; text-align: center;
  min-height: 100%; padding: 30px 20px 50px;
}
.welcome .brand-mark { width: 45px; margin-bottom: 20px; }
.welcome h2 { font-size: clamp(1.6rem, 4vw, 2.15rem); line-height: 1.15; letter-spacing: -.055em; }
.welcome p { color: var(--muted); margin-top: 11px; line-height: 1.55; max-width: 34ch; font-size: .93rem; }
.messages { max-width: 780px; margin: 0 auto; padding: 27px 25px 13px; }
.welcome:not([hidden]) + .messages:empty { display: none; }
.job { display: grid; gap: 12px; padding-bottom: 28px; }
.message-prompt {
  justify-self: end; background: #242e26; border: 1px solid #354139; border-radius: 17px 17px 4px 17px;
  max-width: min(85%, 60ch); padding: 12px 15px; line-height: 1.5;
}
.message-prompt, .reply, .job-error { overflow-wrap: anywhere; white-space: pre-wrap; }
.job-status { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; }
.status-label { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 650; color: var(--muted); }
.status-label::before { content: ""; inline-size: 7px; block-size: 7px; border-radius: 50%; background: currentColor; }
.status-label[data-status="running"], .status-label[data-status="completed"] { color: var(--green); }
.status-label[data-status="queued"], .status-label[data-status="interrupted"] { color: var(--warning); }
.status-label[data-status="failed"] { color: var(--error); }
.job-time { color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.reply { line-height: 1.6; font-size: .98rem; }
.reply pre {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; overflow: auto; white-space: pre; max-width: 100%;
}
.generated-images { display: grid; gap: 10px; min-width: 0; }
.generated-images:empty { display: none; }
.generated-image {
  display: block; width: fit-content; max-width: 100%; color: var(--green);
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.generated-image:hover, .generated-image:focus-visible { border-color: var(--green); }
.generated-image img {
  display: block; max-width: 100%; max-height: min(60vh, 520px);
  object-fit: contain; border-radius: inherit;
}
.artifact-list { display: grid; gap: 6px; list-style: none; margin: 0; padding: 0; min-width: 0; }
.artifact-list:empty { display: none; }
.artifact-download {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px 12px;
  min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-raised); color: inherit; text-decoration: none; font-size: .85rem;
}
.artifact-download:hover, .artifact-download:focus-visible { border-color: var(--green); }
.artifact-name { overflow-wrap: anywhere; }
.artifact-size { color: var(--muted); white-space: nowrap; }
.artifact-action { grid-column: -2; color: var(--green); font-weight: 650; }
.job-error { color: var(--error); line-height: 1.5; font-size: .88rem; }
.activity { color: var(--muted); font-size: .85rem; }
.activity summary { width: fit-content; cursor: pointer; padding: 4px 0; }
.activity ol { list-style: none; margin: 7px 0 0; border-left: 1px solid var(--line); padding: 2px 0 2px 12px; }
.activity li { display: grid; gap: 3px; margin: 0 0 10px; }
.activity li:last-child { margin-bottom: 0; }
.activity li span { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; color: #c2cbc3; }
.job-actions { display: flex; gap: 8px; }
.job-action { border-color: var(--line); }
.composer-wrap { padding: 8px 22px max(17px, env(safe-area-inset-bottom)); }
.composer-inner { width: min(100%, 730px); margin: 0 auto; }
.composer-inner .form-error { padding: 0 3px 8px; }
.composer {
  background: var(--surface); border: 1px solid var(--line); border-radius: 17px; padding: 12px;
  box-shadow: 0 7px 24px #0002;
}
.composer:focus-within { border-color: #57745b; }
.composer textarea {
  display: block; border: 0; padding: 3px 4px; outline: 0; background: transparent; color: inherit;
  resize: none; field-sizing: content; width: 100%; min-height: 42px; max-height: min(192px, 25dvh); line-height: 1.4;
}
.composer textarea::placeholder { color: var(--muted); }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.attach { border-color: var(--line); flex: none; white-space: nowrap; }
.attach > span { color: var(--green); margin-right: 3px; }
.attachments {
  display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; min-width: 0;
}
.attachment-draft { margin: 3px 0 9px; }
.message-attachments { max-width: 100%; justify-content: flex-end; justify-self: end; }
.attachment {
  display: flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised);
  padding: 5px 8px; font-size: .8rem; line-height: 1.4;
}
.attachment span { min-width: 0; overflow-wrap: anywhere; }
.attachment button {
  flex: none; min-width: 30px; min-height: 30px; padding: 0; color: var(--muted);
  border: 0; border-radius: 5px; background: transparent; font-size: 1rem;
}
.attachment button:hover { background: var(--line); color: inherit; }
.composer-selects { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 0 0 8px; }
.composer-select { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: .78rem; }
.composer-select select {
  color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  min-width: 0; max-width: min(40vw, 220px); min-height: 33px; padding: 0 5px;
}
.primary {
  color: #172b1b; background: var(--green); border: 1px solid transparent;
  border-radius: 9px; font-size: .9rem; font-weight: 750; padding: 7px 13px;
}
.primary:hover { background: #c4efca; }
.stop-conversation {
  margin-left: auto; min-width: 0; color: var(--warning); border-color: var(--line);
}
.stop-conversation > span { margin-right: 3px; }
.send { margin-left: auto; white-space: nowrap; }
.stop-conversation:not([hidden]) + .send { margin-left: 0; }
.send span { margin-left: 3px; }
.icon-button { min-width: 42px; min-height: 42px; place-items: center; font-size: 1.5rem; padding: 0; }
.menu-icon { width: 17px; height: 12px; border-top: 2px solid currentColor; position: relative; }
.menu-icon::after { content: ""; width: 12px; height: 2px; background: currentColor; position: absolute; top: 5px; left: 0; }
.key-dialog {
  width: min(520px, calc(100% - 30px)); max-height: calc(100dvh - 30px);
  padding: 20px; border: 1px solid var(--line); border-radius: 17px;
  background: var(--surface); color: inherit;
}
.key-dialog::backdrop { background: #0009; }
.key-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.key-dialog h2 { font-size: 1rem; }
.key-form, .new-key { display: grid; gap: 7px; }
.key-form label, .new-key label { color: var(--muted); font-size: .84rem; }
.key-row { display: flex; gap: 8px; }
.key-row input {
  flex: 1; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px;
  background: #121513; color: inherit;
}
.key-row button { flex: none; }
.new-key { margin-top: 14px; }
.key-status { font-size: .83rem; margin-top: 12px; }
.key-status:empty { display: none; }
.key-list { list-style: none; margin: 10px 0 0; padding: 0; }
.key-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--soft-line); }
.key-list li button { color: var(--error); flex: none; }
.key-details { min-width: 0; display: grid; gap: 3px; font-size: .85rem; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .workspace { display: flex; flex-direction: column; }
  .main { flex: 1; }
  .sidebar {
    display: none; position: fixed; z-index: 4; inset: 0 auto 0 0; width: min(85vw, 310px);
    padding-top: max(15px, env(safe-area-inset-top));
  }
  .sidebar.open { display: flex; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 3; border: 0; background: #0009; }
  .menu-button, .sidebar-close { display: grid; }
  .topbar { min-height: 58px; padding: max(4px, env(safe-area-inset-top)) 11px 4px; }
  .topbar-leading { gap: 3px; }
  .connection { font-size: .72rem; }
  .notice { padding-inline: 12px; }
  .messages { padding: 20px 14px 8px; }
  .composer-wrap { padding: 7px 9px max(8px, env(safe-area-inset-bottom)); }
  .composer { padding: 10px; }
}
