:root {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    sans-serif;
  color: #292720;
  background: #f7f6f2;
  font-synthesis: none;
  line-height: 1.6;
  font-size: 16px;
  --accent: #ac472b;
  --line: #e2dfd7;
  --muted: #706b61;
  --paper: #fffefa;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  padding: 10px 18px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s;
}
button:hover {
  background: #933e26;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
button.secondary {
  background: transparent;
  border-color: var(--line);
  color: #514b40;
}
button.secondary:hover {
  background: #eeece6;
}
button.small {
  padding: 5px 11px;
  font-size: 0.875rem;
}
button.danger {
  color: #a83131;
}
button.icon {
  background: none;
  color: var(--muted);
  padding: 4px 10px;
}
input,
textarea,
select {
  width: 100%;
  background: var(--paper);
  border: 1px solid #cac5bb;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.5;
  color: inherit;
  min-width: 0;
}
input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #d69b72;
  outline-offset: 3px;
}
textarea {
  resize: vertical;
}
input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 550;
  margin: 16px 0 6px;
}
label input,
label select,
label textarea {
  margin-top: 6px;
  font-weight: 400;
}
.muted,
small {
  color: var(--muted);
}
small {
  font-size: 0.8125rem;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 2rem;
  line-height: 1.3;
  font-weight: 550;
  letter-spacing: -0.04em;
  margin-bottom: 12px;
}
h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 4px;
}
h3 {
  font-size: 1rem;
  font-weight: 550;
}
p {
  margin-bottom: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.brand img {
  width: 28px;
  height: 28px;
}
.brand span {
  color: var(--muted);
  font-weight: 400;
}
.brand:hover {
  text-decoration: none;
}
.shell {
  max-width: 1320px;
  margin: auto;
  padding: 0 44px;
}
.topbar {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 20px;
}
.topright {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.875rem;
}
.layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 48px;
  padding: 42px 0 64px;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.nav button {
  text-align: left;
  background: none;
  color: var(--muted);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 0.9375rem;
  font-weight: 450;
}
.nav button.active {
  background: #eae7de;
  color: #30291f;
  font-weight: 600;
}
.nav button:hover {
  background: #eeece5;
}
.nav-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: #8a8376;
  margin: 0 14px 10px;
}
.nav-footer {
  margin: 30px 14px;
  font-size: 0.8125rem;
  color: var(--muted);
}
.workspace {
  min-width: 0;
  max-width: 900px;
}
.layout > aside {
  min-width: 0;
}
.panel-head > * {
  min-width: 0;
}
.panel-head > button {
  flex-shrink: 0;
}
.model-select {
  flex: 1;
  margin: 0;
}
.pagehead {
  margin-bottom: 30px;
}
.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--accent);
  margin-bottom: 12px;
}
.pagehead p {
  color: var(--muted);
  margin-bottom: 0;
}
.panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  margin-bottom: 22px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.panel-head p {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 2px 0 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #efede6;
  color: #6f6759;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge.good {
  background: #e7eee1;
  color: #3a5c2d;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.help {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 7px 0 0;
  line-height: 1.6;
}
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.actions .push {
  margin-left: auto;
}
.notice {
  background: #f0eee7;
  border: 1px solid var(--line);
  padding: 14px 16px;
  border-radius: 9px;
  font-size: 0.875rem;
  margin: 18px 0;
  overflow-wrap: anywhere;
}
.notice.success {
  background: #ecf0e7;
  color: #405536;
  border-color: #d4deca;
}
.code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
}
.endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 16px;
  background: #f7f6f2;
}
.endpoint code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
}
.model-row {
  display: grid;
  grid-template-columns: 1fr 1fr 42px;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}
.model-labels {
  display: grid;
  grid-template-columns: 1fr 1fr 42px;
  gap: 10px;
  font-size: 0.8125rem;
  color: var(--muted);
}
.model-capacity {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
}
.model-capacity input {
  margin-top: 5px;
}
@media (max-width: 600px) {
  .model-row .model-capacity {
    grid-column: 1;
  }
}
.empty {
  text-align: center;
  padding: 26px 16px;
  color: var(--muted);
  border: 1px dashed #d9d4c8;
  border-radius: 9px;
  margin-top: 14px;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th,
td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}
td .limit-input {
  width: 86px;
  padding: 5px 8px;
}
td .actions {
  margin: 0;
  gap: 7px;
}
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}
.auth-card {
  max-width: 460px;
  width: 100%;
  padding: 36px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.auth-card .brand {
  margin-bottom: 36px;
}
.auth-card h1 {
  font-size: 1.7rem;
}
.auth-card form button {
  margin-top: 20px;
  width: 100%;
}
.auth-card form button + button {
  margin-top: 10px;
}
.auth-card .muted {
  font-size: 0.875rem;
}
.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  font-size: 0.8125rem;
}
.loading {
  text-align: center;
  margin: 15vh auto;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #302c25;
  color: #fff;
  padding: 12px 22px;
  border-radius: 10px;
  box-shadow: 0 8px 30px #0002;
  z-index: 20;
  max-width: calc(100% - 32px);
  font-size: 0.875rem;
}
#toast.error {
  background: #973d2d;
}
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 160px;
  max-height: 520px;
  overflow: auto;
  padding: 0 0 22px;
}
.chat-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.9375rem;
  line-height: 1.8;
}
.chat-message.user {
  padding: 14px 18px;
  border-radius: 12px;
  background: #f0eee7;
  align-self: flex-end;
  max-width: 90%;
}
.chat-message.assistant {
  padding: 8px 0;
}
.message-meta {
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 6px;
  white-space: normal;
}
.chat-compose textarea {
  min-height: 100px;
}
.chat-compose .actions {
  margin-top: 12px;
}
.steps {
  counter-reset: step;
  display: grid;
  gap: 24px;
  margin: 24px 0;
}
.step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 16px;
}
.step:before {
  counter-increment: step;
  content: counter(step);
  border: 1px solid #d5cec1;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  text-align: center;
  color: var(--accent);
  font-size: 0.875rem;
  line-height: 28px;
}
.step p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}
.prose {
  max-width: 720px;
}
.prose h2 {
  margin-top: 28px;
}
.prose p,
.prose li {
  color: #605a50;
}
.secret-result {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #edf1e8;
  border: 1px solid #d6dfcc;
  border-radius: 9px;
  padding: 18px;
}
.tabular {
  font-variant-numeric: tabular-nums;
}
.footer {
  font-size: 0.75rem;
  color: #827a6e;
  line-height: 1.8;
  margin-top: 28px;
}
button[type="submit"] {
  white-space: nowrap;
}
@media (max-width: 800px) {
  .shell {
    padding: 0 22px;
  }
  .topbar {
    height: 76px;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding-top: 22px;
  }
  .nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
  }
  .nav button {
    white-space: nowrap;
    padding: 9px 13px;
  }
  .nav-label,
  .nav-footer {
    display: none;
  }
  .workspace {
    max-width: none;
  }
  .topright .username {
    display: none;
  }
  .panel {
    padding: 22px;
  }
  .pagehead {
    margin-bottom: 22px;
  }
  h1 {
    font-size: 1.8rem;
  }
}
@media (max-width: 480px) {
  .shell {
    padding: 0 16px;
  }
  .brand {
    font-size: 1rem;
  }
  .brand img {
    width: 24px;
    height: 24px;
  }
  .grid2 {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .panel {
    padding: 20px 16px;
  }
  .panel-head {
    gap: 10px;
  }
  .panel-head .badge {
    font-size: 0.7rem;
  }
  .auth-card {
    padding: 28px 23px;
  }
  .model-row {
    grid-template-columns: 1fr 36px;
    gap: 7px;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
  }
  .model-row input:first-child {
    grid-column: 1;
  }
  .model-row input:nth-child(2) {
    grid-row: 2;
    grid-column: 1;
  }
  .model-row button {
    grid-column: 2;
    grid-row: 1/3;
  }
  .model-labels {
    display: none;
  }
  .endpoint {
    padding: 11px;
  }
  .endpoint button {
    padding: 5px 8px;
  }
  .actions .push {
    margin-left: 0;
  }
  .topright {
    gap: 6px;
  }
  .auth-page {
    padding: 16px;
  }
}
