:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --paper: #fff;
  --ink: #242722;
  --muted: #777b72;
  --line: #e5e6df;
  --accent: #ae4a2c;
  --soft: #f6ece7;
  --sidebar: #20251f;
  --danger: #a63025;
  --green: #48633c;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
[hidden] {
  display: none !important;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 17px;
  border-radius: 5px;
  font-weight: 500;
}
button:hover {
  border-color: #b5b8ad;
  background: #fafaf8;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
button.primary:hover {
  background: #973e23;
}
button.text-button {
  border: 0;
  background: transparent;
  padding: 4px 0;
  color: var(--muted);
}
button.danger {
  color: var(--danger);
}
button.icon-button {
  border: 0;
  background: none;
  font-size: 25px;
  padding: 2px 7px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
input,
textarea,
select {
  border: 1px solid #d9dcd2;
  border-radius: 5px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  cursor: pointer;
}
textarea {
  resize: vertical;
  line-height: 1.9;
}
label {
  display: block;
  font-weight: 500;
  margin-bottom: 9px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.6px;
  margin-bottom: 9px;
}
h2 {
  font-size: 21px;
  font-weight: 600;
}
h3 {
  font-size: 15px;
  font-weight: 600;
}
p {
  line-height: 1.8;
}
code,
pre,
.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
code {
  font-size: 12px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--bg);
  padding: 18px;
  line-height: 1.7;
  font-size: 12px;
  border-radius: 4px;
  max-height: 400px;
  overflow: auto;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.error {
  color: var(--danger);
  font-size: 13px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 15px;
}
.wordmark {
  font-size: 23px;
  letter-spacing: 2px;
  font-weight: 600;
}
.wordmark span {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 1px;
  margin-left: 8px;
  opacity: 0.6;
}
.auth-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
}
.auth-intro {
  padding: 55px 12%;
  background: #e9ece2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 600px;
}
.auth-intro h1 {
  font-size: 44px;
  line-height: 1.5;
  font-weight: 500;
}
.intro-copy {
  color: #666e5f;
  font-size: 15px;
  line-height: 2;
}
.auth-form-wrap {
  display: grid;
  place-items: center;
  padding: 36px;
}
.auth-form {
  width: 100%;
  max-width: 350px;
}
.auth-form h2 {
  font-size: 28px;
  margin-bottom: 14px;
}
.auth-form input {
  width: 100%;
  margin-bottom: 20px;
}
.auth-form .primary {
  width: 100%;
  margin: 7px 0 18px;
}
.workspace {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  color: #f2f3ec;
  padding: 32px 22px;
  display: flex;
  flex-direction: column;
}
.sidebar .wordmark {
  margin: 0 9px 48px;
}
.sidebar-label {
  font-size: 11px;
  color: #9aa393;
  margin: 0 12px 12px;
  letter-spacing: 1px;
}
.sidebar nav {
  display: grid;
  gap: 7px;
}
.sidebar nav a {
  padding: 13px 14px;
  border-radius: 5px;
  color: #bec7b8;
  display: flex;
  gap: 15px;
  align-items: center;
}
.sidebar nav a span {
  font-size: 20px;
  line-height: 1;
  width: 20px;
}
.sidebar nav a.active {
  background: #394134;
  color: #fff;
}
.sidebar nav a:hover {
  background: #30372c;
}
.sidebar-bottom {
  margin-top: auto;
  font-size: 12px;
  color: #a7b19f;
  padding: 24px 10px 0;
}
.sidebar-bottom p {
  margin-bottom: 12px;
}
.connection-row {
  display: flex;
  justify-content: space-between;
  margin: 12px 0;
  font-size: 11px;
}
.connection-row span:last-child {
  color: #e1e5dc;
}
.sidebar-bottom .text-button {
  color: #a7b19f;
  font-size: 11px;
  margin-top: 8px;
}
.account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #3c4436;
  margin-top: 27px;
  padding-top: 18px;
}
.account .text-button {
  margin: 0;
}
.main-area {
  min-width: 0;
}
.topbar {
  height: 72px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 36px;
  background: #ffffff80;
  font-size: 12px;
  color: var(--muted);
}
.topbar strong {
  font-weight: 500;
  color: var(--ink);
}
.slash {
  margin: 0 12px;
  color: #c5c8bf;
}
#page {
  padding: 34px 36px;
  max-width: 1600px;
  margin: 0 auto;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 29px;
}
.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.page-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.panel-title {
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.panel-title h3 {
  margin: 0;
}
.panel-body {
  padding: 26px;
}
.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 27px;
}
.settings-aside {
  padding: 5px 0;
}
.settings-aside section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.settings-aside p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.9;
}
.settings-aside h3 {
  margin-bottom: 9px;
}
.persona-editor {
  width: 100%;
  min-height: 350px;
  font-size: 15px;
  padding: 21px;
  background: #fcfcfa;
  border-color: var(--line);
  line-height: 2;
}
.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  font-size: 12px;
  color: var(--muted);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 25px;
}
.form-grid input {
  width: 100%;
}
.form-grid p {
  margin: 9px 0 0;
}
.form-footer {
  border-top: 1px solid var(--line);
  padding: 18px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hint {
  padding: 15px 18px;
  background: #f0f1eb;
  font-size: 12px;
  line-height: 1.9;
  color: #68705f;
  border-radius: 4px;
}
.models-table {
  width: 100%;
  border-collapse: collapse;
}
.models-table th {
  text-align: left;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  background: #fafbf8;
}
.models-table th,
.models-table td {
  padding: 17px 23px;
  border-bottom: 1px solid var(--line);
}
.models-table td {
  font-size: 13px;
}
.models-table label {
  display: inline;
  cursor: pointer;
}
.models-table code {
  font-size: 13px;
}
.model-name {
  font-size: 14px;
  margin-bottom: 7px;
}
.model-note {
  font-size: 11px;
  color: var(--muted);
}
.add-model {
  display: flex;
  gap: 10px;
  padding: 23px;
}
.add-model input {
  flex: 1;
  min-width: 0;
}
.model-intro {
  padding: 20px 25px;
  border-top: 1px solid var(--line);
}
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}
.toolbar input {
  width: 300px;
}
.toolbar select {
  width: 140px;
}
.toolbar .summary {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
.conversation-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 580px;
  height: calc(100vh - 278px);
}
.conversation-list {
  min-width: 0;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.list-scroll {
  overflow: auto;
  flex: 1;
}
.conversation-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 22px;
  background: white;
}
.conversation-item.selected {
  background: #f0f2eb;
  box-shadow: inset 3px 0 #68765b;
}
.conversation-item:hover {
  background: #f7f8f3;
}
.conversation-item .item-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.conversation-item strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.conversation-item time {
  color: var(--muted);
  font-size: 10px;
  flex-shrink: 0;
}
.conversation-item p {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 12px;
}
.item-meta {
  font-size: 10px;
  color: #8b9082;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.pagination {
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  border-top: 1px solid var(--line);
}
.pagination button {
  padding: 5px 10px;
  font-size: 11px;
}
.conversation-detail {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.conversation-detail .panel-title {
  padding: 18px 23px;
}
.detail-heading h3 {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
.detail-heading p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}
.message-scroll {
  overflow: auto;
  flex: 1;
  padding: 26px 30px;
}
.message {
  margin-bottom: 27px;
}
.message-label {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
}
.message-label strong {
  font-weight: 600;
}
.message-label time {
  font-size: 10px;
  color: var(--muted);
}
.message-text {
  font-size: 13px;
  line-height: 1.95;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
}
.message.assistant {
  padding: 19px 21px;
  background: #f5f6f1;
  border-radius: 5px;
}
.message-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 9px;
  font-size: 10px;
  color: var(--muted);
}
.message-meta button {
  font-size: 10px;
  padding: 0;
  color: var(--accent);
}
.run-state {
  overflow-wrap: anywhere;
  padding: 12px 15px;
  margin: 14px 0;
  background: #faf4ef;
  font-size: 12px;
  line-height: 1.7;
}
.run-state button {
  color: var(--accent);
  font-size: 11px;
}
.compose {
  padding: 18px 23px;
  border-top: 1px solid var(--line);
}
.compose textarea {
  width: 100%;
  min-height: 75px;
  max-height: 200px;
  font-size: 13px;
}
.compose-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 10px;
}
.compose select {
  font-size: 11px;
  padding: 7px;
  max-width: 65%;
}
.compose button {
  padding: 8px 16px;
  font-size: 12px;
}
.read-only {
  padding: 16px 23px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
}
.empty-state {
  display: flex;
  flex: 1;
  min-height: 250px;
  padding: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.empty-state .symbol {
  font-size: 40px;
  font-weight: 300;
  color: #a6af9d;
  margin-bottom: 20px;
}
.empty-state h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
}
.empty-state p {
  color: var(--muted);
  font-size: 12px;
  max-width: 330px;
}
.empty-list {
  padding: 35px 25px;
  color: var(--muted);
  line-height: 1.9;
  font-size: 12px;
}
.connection-warning {
  margin-bottom: 22px;
  font-size: 12px;
  color: #77614c;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid #e7dacb;
  background: #fcfaf6;
  padding: 12px 17px;
  border-radius: 4px;
}
.connection-warning .text-button {
  color: var(--accent);
  flex-shrink: 0;
}
#notice {
  position: fixed;
  z-index: 100;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 13px 22px;
  background: #262d22;
  color: white;
  border-radius: 5px;
  box-shadow: 0 4px 20px #0002;
  font-size: 13px;
  line-height: 1.6;
}
#notice.error-notice {
  background: #913c2d;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 9px;
  max-width: 750px;
  width: calc(100% - 40px);
  max-height: 85vh;
  padding: 26px 30px;
  box-shadow: 0 20px 80px #0003;
}
dialog::backdrop {
  background: #1a211b66;
}
.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-top h2 {
  margin: 0;
}
.modal-body p,
#modal-body p {
  line-height: 1.9;
}
.modal-form input {
  width: 100%;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  font-size: 12px;
  margin-bottom: 24px;
}
.facts span {
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}
.run-details section {
  margin-top: 24px;
}
.run-details h3 {
  margin-bottom: 12px;
}
.loading {
  padding: 70px;
  text-align: center;
  color: var(--muted);
}
.link {
  color: var(--accent);
  text-decoration: underline;
}
.history-mark {
  border-bottom: 1px dashed #c6ccbd;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  padding-bottom: 12px;
  margin: 15px 0;
}
.more-messages {
  text-align: center;
  margin-bottom: 20px;
}
.more-messages button {
  font-size: 11px;
  padding: 7px 12px;
}
.available-list {
  max-height: 240px;
  overflow: auto;
  padding: 12px 15px;
  background: var(--bg);
  font:
    12px/2 ui-monospace,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (min-width: 1500px) {
  #page {
    padding-top: 42px;
  }
  .conversation-layout {
    height: calc(100vh - 296px);
  }
}
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .sidebar {
    padding: 28px 14px;
  }
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-aside {
    display: none;
  }
  #page {
    padding: 28px 24px;
  }
  .topbar {
    padding: 0 24px;
  }
  .conversation-layout {
    grid-template-columns: 270px minmax(0, 1fr);
  }
  .toolbar .summary {
    display: none;
  }
  .models-table th,
  .models-table td {
    padding: 15px;
  }
}
@media (max-width: 760px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .auth-intro {
    min-height: 260px;
    padding: 26px;
  }
  .auth-intro h1 {
    font-size: 29px;
    margin-top: 25px;
  }
  .auth-intro .intro-copy,
  .auth-intro > .muted {
    display: none;
  }
  .auth-form-wrap {
    padding: 35px 25px;
  }
  .workspace {
    display: block;
  }
  .sidebar {
    position: relative;
    height: auto;
    padding: 19px 20px;
  }
  .sidebar .wordmark {
    margin: 0 0 20px;
  }
  .sidebar-label,
  .sidebar-bottom {
    display: none;
  }
  .sidebar nav {
    display: flex;
    gap: 3px;
  }
  .sidebar nav a {
    font-size: 12px;
    padding: 10px;
  }
  .sidebar nav a span {
    display: none;
  }
  .topbar {
    height: 50px;
    padding: 0 20px;
  }
  .topbar > .small {
    display: none;
  }
  #page {
    padding: 24px 16px;
  }
  .page-heading {
    align-items: flex-start;
    margin-bottom: 20px;
  }
  .page-heading h1 {
    font-size: 24px;
  }
  .page-heading p {
    font-size: 12px;
    max-width: 250px;
  }
  .page-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }
  .page-actions button {
    padding: 9px 12px;
    font-size: 12px;
  }
  .toolbar {
    flex-wrap: wrap;
  }
  .toolbar input {
    width: auto;
    flex: 1;
    min-width: 150px;
  }
  .toolbar select {
    width: 115px;
  }
  .conversation-layout {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 450px;
  }
  .conversation-list {
    max-height: 280px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .conversation-detail {
    min-height: 420px;
    max-height: 800px;
  }
  .message-scroll {
    padding: 20px;
  }
  .panel-title,
  .panel-body {
    padding: 20px;
  }
  .form-footer {
    padding: 16px 20px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .models-table th,
  .models-table td {
    padding: 12px 8px;
    font-size: 11px;
  }
  .models-table code {
    font-size: 10px;
  }
  .model-name {
    font-size: 12px;
  }
  .model-note {
    display: none;
  }
  .add-model {
    padding: 18px 12px;
  }
  .add-model input {
    font-size: 11px;
  }
  .add-model button {
    padding: 9px;
  }
  .connection-warning {
    align-items: flex-start;
  }
  .facts {
    grid-template-columns: 1fr;
  }
  .persona-editor {
    min-height: 370px;
  }
}
