:root {
  color-scheme: dark;
  --bg: #101419;
  --surface: #171d25;
  --raised: #202936;
  --border: #63748b;
  --line: #2a3442;
  --text: #f1f5f9;
  --muted: #b0bdcd;
  --accent: #8dbbff;
  --warning: #f2cf86;
  --danger: #ffacaf;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  grid-template-rows: 72px 1fr;
  min-height: 100dvh;
}
a {
  color: var(--accent);
  text-underline-offset: 4px;
}
button,
input,
select,
textarea {
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  min-height: 40px;
}
button {
  cursor: pointer;
  font-weight: 600;
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:hover,
a:hover {
  background: var(--raised);
}
button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: var(--bg);
}
button.primary {
  background: #a8caff;
  color: var(--bg);
  border-color: #a8caff;
}
button.primary:disabled {
  background: var(--raised);
  border-color: var(--border);
  color: var(--muted);
}
:focus-visible {
  outline: 2px solid #c2d9ff;
  outline-offset: 3px;
}
::selection {
  background: #a8caff;
  color: var(--bg);
}
input,
textarea {
  caret-color: var(--accent);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
}
* {
  scrollbar-color: var(--border) var(--bg);
}
h1,
h2,
p {
  margin: 0 0 12px;
}
h1 {
  font-size: 20px;
}
h2 {
  font-size: 18px;
}
label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}
.muted {
  color: var(--muted);
}
.top {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
}
.pause {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pause span {
  color: var(--warning);
}
nav {
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  gap: 8px;
  border-right: 1px solid var(--line);
}
nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 6px;
}
nav a[aria-current] {
  background: var(--raised);
  color: var(--accent);
  font-weight: 650;
}
.quiet {
  border-color: transparent;
  background: none;
}
nav button {
  margin-top: auto;
  text-align: left;
}
main {
  min-width: 0;
}
.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: calc(100dvh - 72px);
}
.chat-list {
  border-right: 1px solid var(--line);
  padding: 24px 16px;
}
.chat-list form {
  display: grid;
  gap: 8px;
  margin: 20px 0;
}
.chat-list label {
  margin: 0;
}
.chat-row {
  display: block;
  padding: 16px 12px;
  margin: 0 -4px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.chat-row.active {
  background: var(--raised);
  box-shadow: inset 3px 0 var(--accent);
}
.chat-row small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}
.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}
.pager span {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.conversation {
  min-width: 0;
}
.conversation-head {
  padding: 24px;
  border-bottom: 1px solid var(--line);
}
.conversation-head button {
  margin: 0 0 10px;
}
.history-note {
  padding: 16px 24px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.messages {
  padding: 8px 24px 24px;
  min-height: 220px;
}
.message {
  max-width: 72ch;
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 6px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 16px;
  line-height: 1.6;
}
.message.outgoing {
  margin-left: auto;
  background: #202d3e;
}
.message small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.empty {
  padding: 56px 24px;
  color: var(--muted);
}
.empty h2 {
  color: var(--text);
}
.chat-list .empty {
  padding: 24px 0;
}
#older {
  margin: 0 24px;
}
#composer {
  padding: 20px 24px;
  border-top: 1px solid var(--line);
}
textarea {
  width: 100%;
  resize: vertical;
  font-size: 16px;
}
.compose-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 12px;
}
.diagnostics {
  padding: 16px 24px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.diagnostics p {
  overflow-wrap: anywhere;
  margin: 8px 0;
}
.document {
  max-width: 900px;
  padding: 32px;
}
.document > p {
  max-width: 72ch;
  margin-bottom: 28px;
}
.form-section {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.document input {
  width: 100%;
  max-width: 560px;
  margin-bottom: 20px;
  font-size: 16px;
}
.document textarea {
  margin-bottom: 20px;
}
.document form > p {
  max-width: 72ch;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.tabs button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.login {
  width: min(100% - 32px, 420px);
  margin: 14vh auto;
}
.login form {
  margin-top: 28px;
  display: grid;
  gap: 12px;
}
.login input {
  width: 100%;
  font-size: 16px;
}
.login .check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
.check input {
  width: auto;
  min-height: 24px;
}
.login button {
  margin-top: 12px;
}
body[data-page="login"] {
  display: block;
}
#error {
  position: fixed;
  bottom: 16px;
  left: 204px;
  right: 16px;
  background: #38262d;
  border: 1px solid var(--danger);
  padding: 12px 16px;
  z-index: 4;
}
#notice:not(:empty) {
  padding: 12px 24px;
  background: var(--raised);
  grid-column: 2;
}
#error-text {
  overflow-wrap: anywhere;
}
.skip {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 10;
  background: var(--surface);
  padding: 12px;
}
.skip:focus {
  top: 10px;
}
.back {
  display: none;
}
.noscript {
  padding: 24px;
  color: var(--warning);
}
[hidden] {
  display: none !important;
}
@media (max-width: 1099px) {
  body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
  }
  .top {
    flex-wrap: wrap;
    gap: 12px;
  }
  nav {
    flex-direction: row;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 16px;
  }
  nav button {
    margin: 0 0 0 auto;
  }
  .workspace {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  #error {
    left: 16px;
  }
  #notice:not(:empty) {
    grid-column: 1;
  }
}
@media (max-width: 767px) {
  .top {
    padding: 16px;
  }
  .top .muted {
    width: 100%;
  }
  .pause {
    margin: 0;
    flex-wrap: wrap;
  }
  .workspace {
    display: block;
  }
  .chat-list {
    border: 0;
  }
  .conversation {
    display: none;
  }
  body.has-chat .chat-list {
    display: none;
  }
  body.has-chat .conversation {
    display: block;
  }
  .back {
    display: block;
    margin-bottom: 16px;
  }
  .document {
    padding: 24px 16px;
  }
  button,
  input,
  select {
    min-height: 44px;
    font-size: 16px;
  }
  .conversation-head,
  #composer {
    padding: 20px 16px;
  }
  .messages {
    padding: 8px 16px 20px;
  }
  .history-note {
    padding: 16px;
  }
  .compose-actions {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  nav {
    gap: 0;
    padding: 8px;
  }
  nav a {
    padding: 10px 8px;
  }
  nav button {
    padding: 8px;
  }
  #error {
    position: static;
    margin: 16px;
  }
  .login {
    margin-top: 10vh;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
