:root {
  color-scheme: light;
  --bg: #fdfcf9;
  --sidebar: #f2f3ee;
  --ink: #252e2b;
  --muted: #727a73;
  --line: #e4e7de;
  --green: #32664f;
  --pale: #e5eddf;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
select {
  cursor: pointer;
}
button {
  border: 0;
  background: none;
  color: inherit;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
button:not(:disabled):hover {
  filter: brightness(0.97);
}
button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
input,
textarea,
select {
  color: var(--ink);
}
[hidden] {
  display: none !important;
}
a {
  color: var(--green);
}
.primary {
  padding: 12px 20px;
  min-height: 44px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
}
.secondary {
  border: 1px solid var(--line);
  padding: 11px 18px;
  border-radius: 10px;
  min-height: 42px;
}
.danger {
  color: #a94035;
}
.muted,
small {
  color: var(--muted);
}
.small {
  font-size: 12px;
  line-height: 1.8;
}
.icon-button {
  height: 42px;
  min-width: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 23px;
  color: var(--muted);
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 276px;
  background: var(--sidebar);
  padding: 30px 20px 14px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 8px 32px;
  color: inherit;
  text-decoration: none;
}
.brand strong {
  font-size: 25px;
  letter-spacing: 3px;
}
.brand > span:last-child {
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--muted);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--green);
  border-radius: 12px;
  color: #e5eddf;
  font-size: 30px;
}
.workspace-picker {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0 0 18px;
  padding: 4px 6px 4px 12px;
}
.workspace-picker select {
  border: 0;
  background: transparent;
  min-width: 0;
  width: 100%;
  height: 42px;
}
.workspace-picker .icon-button {
  font-size: 20px;
  min-width: 30px;
}
.new-chat {
  text-align: center;
  margin-bottom: 16px;
}
.primary-nav {
  display: grid;
  gap: 8px;
}
.primary-nav button {
  text-align: left;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
}
.primary-nav button.selected {
  background: var(--pale);
  color: var(--green);
}
.recent-label {
  margin: 33px 12px 16px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
}
#chat-search {
  background: transparent;
  border: 0;
  width: 100%;
  padding: 10px 12px;
  font-size: 12px;
  outline-color: var(--green);
}
.conversation-list {
  overflow-y: auto;
  flex: 1;
  min-height: 60px;
  margin-top: 8px;
}
.chat-row {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 5px;
  border-radius: 10px;
  padding: 3px 6px;
}
.chat-row.active {
  background: #e6eade;
}
.chat-row > .chat-title {
  flex: 1;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 13px 7px;
  font-size: 12px;
}
.chat-menu {
  min-width: 28px;
  font-size: 20px;
  color: var(--muted);
  border-radius: 6px;
}
.empty-nav {
  padding: 16px 12px;
  font-size: 12px;
  color: var(--muted);
}
.account-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #d4d9ce;
  text-align: left;
  min-height: 70px;
  padding: 16px 4px 2px;
  margin-top: 15px;
}
.account-entry > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.account-entry strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-entry small {
  display: block;
  font-size: 10px;
  margin-top: 5px;
}
.account-symbol {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8ede3;
  font-size: 22px;
}
.main-shell {
  margin-left: 276px;
  height: 100dvh;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 79px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 30px;
}
.heading {
  flex: 1;
  min-width: 0;
}
.heading h1 {
  font-size: 14px;
  margin: 0 0 6px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.heading > span {
  font-size: 11px;
  color: var(--muted);
}
.credit-pill {
  font-size: 11px;
  padding: 11px 14px;
  border-radius: 30px;
  background: #f1f3ec;
  color: var(--green);
  white-space: nowrap;
}
.topbar .icon-button {
  font-size: 24px;
}
.mobile-only {
  display: none;
}
#main-content {
  flex: 1;
  min-height: 0;
  position: relative;
}
.view {
  height: 100%;
  overflow: auto;
}
.chat-view {
  display: flex;
  flex-direction: column;
  position: relative;
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px max(32px, calc((100% - 840px) / 2));
  scroll-behavior: smooth;
}
.messages:empty {
  display: none;
}
.message {
  margin-bottom: 24px;
}
.message-header {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}
.message-header strong {
  color: var(--ink);
  font-weight: 600;
}
.message-header .copy-message {
  margin-left: auto;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 11px;
}
.message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.9;
  user-select: text;
}
.message.user .message-body {
  background: #f1f2ed;
  border-radius: 12px;
  padding: 14px 17px;
}
.message.error .message-body {
  color: #a94035;
}
.message-files {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}
.typing {
  font-size: 13px;
  color: var(--muted);
  padding: 10px 0;
}
.welcome {
  max-width: 850px;
  width: 100%;
  padding: 80px 35px 30px;
  margin: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2.8px;
  color: #7d8779;
  font-weight: 500;
}
.welcome h2 {
  font-size: 42px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: -1.5px;
  margin: 20px 0 14px;
}
.welcome > p {
  font-size: 13px;
  line-height: 2;
  color: var(--muted);
  margin: 0;
}
.start-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 34px 0 16px;
}
.suggestions {
  display: flex;
  gap: 12px;
}
.suggestions button {
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  padding: 17px 15px;
  flex: 1;
  min-width: 0;
  background: #fffdfa;
}
.suggestions button > span {
  display: block;
  font-size: 22px;
  color: var(--green);
  margin-bottom: 16px;
}
.suggestions strong {
  font-size: 12px;
  display: block;
  font-weight: 500;
}
.suggestions small {
  font-size: 10px;
  display: block;
  margin-top: 7px;
}
.composer-area {
  padding: 15px max(32px, calc((100% - 860px) / 2)) 16px;
  flex-shrink: 0;
}
.composer {
  background: #fff;
  border: 1px solid #dce1d7;
  border-radius: 17px;
  padding: 15px 15px 10px;
  box-shadow: 0 3px 18px #25372a03;
}
#composer-text {
  width: 100%;
  resize: none;
  min-height: 54px;
  max-height: 180px;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 14px;
  line-height: 1.7;
  padding: 0 2px;
}
#composer-text::placeholder {
  color: #8c9389;
}
.composer-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}
.composer-tools select {
  border: 0;
  outline-color: var(--green);
  background: transparent;
  max-width: 160px;
  color: var(--green);
  font-size: 12px;
  padding: 8px 0;
}
.composer-tools select:disabled {
  appearance: none;
  opacity: 1;
}
.composer-tools .icon-button {
  font-size: 25px;
  min-width: 32px;
  height: 32px;
}
.send-hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}
.send-button {
  width: 43px;
  height: 43px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 26px;
  flex-shrink: 0;
}
.send-button:disabled {
  background: #edf0e8;
  color: #99a296;
  opacity: 1;
}
.send-button.stop {
  font-size: 20px;
  background: #e5eddf;
  color: var(--green);
}
.composer-note {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin: 12px 0 0;
  line-height: 1.5;
}
.draft-attachments {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  background: #f2f4ee;
  color: var(--green);
  font-size: 11px;
  padding: 5px 9px;
  margin-bottom: 10px;
  max-width: 100%;
}
.attachment > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment button {
  font-size: 17px;
}
.content-view {
  padding: 48px max(32px, calc((100% - 900px) / 2));
}
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 32px;
}
.section-heading h2 {
  font-size: 27px;
  line-height: 1.5;
  font-weight: 500;
  margin: 16px 0 10px;
}
.section-heading p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.list-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  padding: 17px 20px;
  gap: 15px;
  margin-bottom: 12px;
  background: #fffdfa;
}
.list-card .details {
  flex: 1;
  min-width: 0;
}
.list-card strong {
  font-size: 13px;
  display: block;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-card p {
  font-size: 11px;
  color: var(--muted);
  margin: 7px 0 0;
  line-height: 1.7;
}
.list-card .state {
  font-size: 11px;
  color: var(--green);
  white-space: nowrap;
}
.list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.text-button {
  font-size: 12px;
  padding: 10px 8px;
  color: var(--green);
  border-radius: 8px;
}
.empty-state {
  padding: 65px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 2;
}
.storage-warning {
  padding: 10px 20px;
  background: #fff1db;
  color: #805323;
  font-size: 12px;
  line-height: 1.8;
}
.storage-warning button {
  text-decoration: underline;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  width: min(520px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 18px 60px #192d1d22;
}
dialog::backdrop {
  background: #17221d66;
}
dialog h2 {
  font-size: 23px;
  margin: 0 0 20px;
  font-weight: 600;
}
dialog p {
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
}
dialog form {
  display: grid;
  gap: 16px;
}
dialog label {
  font-size: 12px;
  line-height: 1.7;
  display: block;
}
dialog label > input {
  display: block;
  width: 100%;
  margin-top: 7px;
  background: #fff;
  border: 1px solid #d9dfd4;
  border-radius: 9px;
  min-height: 45px;
  padding: 11px 12px;
  outline-color: var(--green);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.dialog-error {
  font-size: 12px;
  color: #a94035;
  line-height: 1.8;
  white-space: pre-wrap;
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dialog-heading h2 {
  margin-bottom: 15px;
}
.balances {
  display: flex;
  gap: 15px;
  margin: 24px 0;
}
.balances > div {
  flex: 1;
  min-width: 0;
}
.balances small {
  font-size: 10px;
  display: block;
}
.balances strong {
  display: block;
  font-size: 25px;
  color: var(--green);
  margin-top: 12px;
  overflow-wrap: anywhere;
}
.rate-card {
  background: var(--sidebar);
  padding: 13px 15px;
  border-radius: 11px;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.9;
  margin-bottom: 13px;
}
.ledger {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 16px;
}
.ledger h3 {
  font-size: 13px;
  margin: 0 0 10px;
}
.ledger-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 14px 0;
  font-size: 12px;
}
.ledger-row small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.6;
}
.ledger-amount {
  white-space: nowrap;
  color: var(--green);
}
.file-preview {
  max-height: 45dvh;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 15px;
  background: #f0f2eb;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.8;
}
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: #26362e;
  color: #fff;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 12px;
  max-width: calc(100% - 32px);
  line-height: 1.7;
  z-index: 100;
}
.boot-error {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100% - 32px));
  padding: 25px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 0 0 100vmax #fdfcf9ee;
  z-index: 90;
  font-size: 13px;
  line-height: 1.8;
}
.boot-error p {
  color: var(--muted);
}
@media (min-width: 1500px) {
  .sidebar {
    width: 292px;
  }
  .main-shell {
    margin-left: 292px;
  }
  .welcome {
    max-width: 900px;
  }
  .welcome h2 {
    font-size: 48px;
  }
}
@media (max-height: 780px) and (min-width: 761px) {
  .welcome {
    padding-top: 28px;
    padding-bottom: 10px;
  }
  .welcome h2 {
    font-size: 34px;
    margin: 14px 0 10px;
  }
  .start-label {
    margin-top: 23px;
  }
  .suggestions button {
    padding: 12px;
  }
  .suggestions button > span {
    margin-bottom: 10px;
  }
}
@media (max-width: 760px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    width: 280px;
    padding-top: 25px;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .nav-shade {
    position: fixed;
    inset: 0;
    background: #18251d66;
    z-index: 19;
  }
  .main-shell {
    margin-left: 0;
    height: 100dvh;
    min-height: 0;
  }
  .mobile-only {
    display: inline-grid;
  }
  .topbar {
    height: 77px;
    padding: 12px 14px;
    gap: 7px;
  }
  .topbar .icon-button {
    min-width: 34px;
    font-size: 23px;
  }
  .heading h1 {
    font-size: 14px;
    max-width: 180px;
  }
  .credit-pill {
    font-size: 10px;
    padding: 9px 11px;
  }
  .welcome {
    padding: 35px 24px 16px;
    justify-content: center;
    min-height: 350px;
  }
  .welcome h2 {
    font-size: 34px;
    margin: 19px 0 15px;
  }
  .welcome > p {
    font-size: 12px;
    line-height: 2;
  }
  .start-label {
    margin-top: 30px;
  }
  .suggestions {
    gap: 8px;
  }
  .suggestions button {
    padding: 14px 12px;
  }
  .suggestions button:last-child {
    display: none;
  }
  .suggestions button > span {
    font-size: 20px;
    margin-bottom: 12px;
  }
  .suggestions small {
    font-size: 10px;
  }
  .suggestions strong {
    font-size: 11px;
  }
  .composer-area {
    padding: 10px 14px max(14px, env(safe-area-inset-bottom));
  }
  .composer {
    padding: 13px 13px 8px;
    border-radius: 15px;
  }
  #composer-text {
    font-size: 16px;
    min-height: 50px;
  }
  .send-hint {
    display: none;
  }
  .send-button {
    margin-left: auto;
    width: 39px;
    height: 39px;
  }
  .composer-note {
    font-size: 9px;
    margin-top: 10px;
  }
  .messages {
    padding: 24px 21px;
  }
  .message-body {
    font-size: 14px;
  }
  .content-view {
    padding: 32px 20px;
  }
  .section-heading {
    align-items: flex-start;
    gap: 10px;
  }
  .section-heading h2 {
    font-size: 23px;
  }
  .section-heading > .primary {
    padding: 11px 13px;
    font-size: 12px;
    white-space: nowrap;
    margin-top: 28px;
  }
  .list-card {
    padding: 15px 13px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .list-actions {
    margin-left: auto;
  }
  .list-card strong {
    max-width: 200px;
  }
  .text-button {
    padding: 7px;
    font-size: 11px;
  }
  dialog {
    padding: 22px 20px;
    max-height: calc(100dvh - 32px);
  }
  dialog h2 {
    font-size: 22px;
  }
  .balances {
    gap: 8px;
  }
  .balances strong {
    font-size: 23px;
  }
  .toast {
    bottom: 20px;
    width: max-content;
  }
}
@media (max-width: 350px) {
  .credit-pill {
    max-width: 104px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .heading h1 {
    max-width: 120px;
  }
  .welcome {
    padding: 25px 20px 12px;
  }
  .welcome h2 {
    font-size: 30px;
  }
  .welcome > p {
    font-size: 11px;
  }
  .suggestions small {
    display: none;
  }
  .start-label {
    margin-top: 22px;
  }
  .suggestions button > span {
    margin-bottom: 7px;
  }
  .composer-area {
    padding-left: 12px;
    padding-right: 12px;
  }
  .list-card strong {
    max-width: 160px;
  }
}
@media (max-height: 680px) and (max-width: 760px) {
  .welcome {
    min-height: 0;
    padding: 20px 20px 10px;
    overflow: auto;
  }
  .welcome h2 {
    font-size: 27px;
    margin: 12px 0;
  }
  .welcome > p {
    display: none;
  }
  .start-label {
    margin: 16px 0 10px;
  }
  .suggestions button > span,
  .suggestions small {
    display: none;
  }
  .suggestions button {
    padding: 13px 10px;
  }
  .composer-note {
    margin-top: 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
.code-row {
  display: flex;
  gap: 10px;
  align-items: end;
}
.code-row label {
  flex: 1;
  min-width: 0;
}
.code-row button {
  flex-shrink: 0;
  margin-bottom: 14px;
}
.account-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}
.session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line, #e4e7df);
}
.session-row div {
  min-width: 0;
}
.session-row small {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 6px;
  color: #747c73;
}

.skill-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0;
}
.skill-filters input {
  flex: 1;
  min-width: 160px;
}
.skill-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
  margin: 22px 0;
}
.skill-card {
  border: 1px solid var(--line, #e8e8e2);
  background: white;
  border-radius: 14px;
  padding: 22px;
}
.skill-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
}
.skill-card p {
  line-height: 1.7;
}
.skill-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}
.skill-actions small {
  flex-basis: 100%;
}
.skill-installed {
  float: right;
  color: #3e6754;
  font-size: 11px;
  font-weight: 400;
}
.skill-instructions {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
  padding: 16px;
  background: #f7f8f4;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  line-height: 1.8;
}
.skill-active {
  color: #3e6754;
  font-size: 12px;
  margin: 0 0 8px;
}
.skill-active:empty {
  display: none;
}

#model-select {
  max-width: 170px;
}
@media (max-width: 480px) {
  #model-select {
    max-width: 110px;
  }
}
