:root {
  color-scheme: dark;
  --bg: #111211;
  --panel: #191b19;
  --line: #30342e;
  --muted: #9ca696;
  --accent: #d9edb9;
  font:
    15px/1.5 system-ui,
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: #edf2e8;
}
button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  background: #2c3327;
  color: var(--accent);
  border: 1px solid #445139;
  border-radius: 9px;
  padding: 10px 15px;
}
button:hover {
  background: #39462f;
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
input,
textarea {
  background: #10120f;
  border: 1px solid #3d4537;
  color: inherit;
  border-radius: 9px;
  padding: 12px;
  width: 100%;
}
textarea {
  resize: vertical;
  min-height: 54px;
  max-height: 220px;
}
label {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  color: #c6cfbd;
}
h1,
h2,
p {
  margin-top: 0;
}
h1 {
  font-size: 25px;
  letter-spacing: -0.8px;
}
h2 {
  font-size: 19px;
}
.muted,
small {
  color: var(--muted);
}
.auth {
  width: min(430px, calc(100vw - 32px));
  margin: 10vh auto;
  background: var(--panel);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.auth button {
  width: 100%;
  margin-top: 10px;
}
.brand {
  color: var(--accent);
}
.shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}
aside {
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow: auto;
  background: var(--panel);
}
aside h1 {
  padding: 0 8px;
  margin-bottom: 0;
}
.chat-list {
  flex: 1;
}
.chat-item {
  display: block;
  text-align: left;
  width: 100%;
  border-color: transparent;
  background: transparent;
  margin: 4px 0;
}
.chat-item.active {
  background: #30382a;
  border-color: #48543d;
}
.chat-item strong,
.chat-item small {
  display: block;
}
.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
header {
  padding: 20px 30px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
header h2 {
  margin: 0;
}
#messages {
  overflow: auto;
  flex: 1;
  padding: 24px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bubble {
  max-width: min(78%, 680px);
  padding: 12px 16px;
  border-radius: 16px;
  background: #242823;
  align-self: flex-start;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.mine {
  align-self: flex-end;
  background: #34412b;
}
.bubble small {
  display: block;
  text-align: right;
  margin-top: 5px;
  font-size: 11px;
}
.quote {
  border-left: 3px solid #8a9e74;
  padding-left: 10px;
  margin-bottom: 8px;
  opacity: 0.75;
}
.composer {
  padding: 16px 30px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: end;
}
.composer textarea {
  flex: 1;
}
.empty {
  margin: auto;
  text-align: center;
  max-width: 400px;
  padding: 25px;
}
.empty h2 {
  color: var(--accent);
}
.tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.settings {
  padding: 30px;
  max-width: 700px;
}
.settings section {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 20px;
}
dialog {
  max-width: min(580px, 90vw);
  background: var(--panel);
  color: inherit;
  border: 1px solid #637450;
  border-radius: 16px;
  padding: 25px;
}
dialog::backdrop {
  background: #000a;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 100%;
}
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #3b3024;
  color: #ffdeb8;
  border-radius: 10px;
  max-width: 90vw;
  padding: 0;
  z-index: 10;
}
#toast:not(:empty) {
  padding: 12px 18px;
}
.error {
  color: #ffc0b3;
  white-space: pre-wrap;
}
.loading {
  padding: 40px;
}
.older {
  align-self: center;
}
.mobile-back {
  display: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
@media (max-width: 700px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .shell.chat-open aside {
    display: none;
  }
  .shell:not(.chat-open) .workspace {
    display: none;
  }
  .mobile-back {
    display: block;
  }
  header {
    padding: 16px;
  }
  #messages {
    padding: 16px;
  }
  .composer {
    padding: 12px;
  }
  .bubble {
    max-width: 90%;
  }
  aside {
    height: 100dvh;
  }
  .settings {
    padding: 16px;
  }
}
