:root {
  color-scheme: light dark;
  font: 16px/1.6 system-ui, sans-serif;
  --bg: light-dark(#f8f9fc, #11131b);
  --surface: light-dark(#fff, #1b1e2a);
  --text: light-dark(#202438, #ecedf6);
  --muted: light-dark(#62677b, #adb2c8);
  --line: light-dark(#e0e3ef, #363b50);
  --accent: light-dark(#5745c4, #b6a7ff);
  --tint: light-dark(#eeebff, #2c254b);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
main {
  margin: 0 auto;
  padding: 0 .75rem .75rem;
}
header,
.brand,
.chat-toolbar,
.composer-tools,
.history-tools {
  display: flex;
  align-items: center;
  gap: .75rem;
}
header {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 4.75rem;
  padding: .5rem 0;
  background: var(--bg);
  justify-content: space-between;
  margin-bottom: .75rem;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
}
.welcome-mark {
  width: 3.5rem;
  height: 3.5rem;
}
.preview-badge {
  padding: .2rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
}
h1 {
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: -.03em;
}
h2 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.25;
  letter-spacing: -.04em;
}
.brand p {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  padding: .6rem 1rem;
  border: 1px solid transparent;
  border-radius: .8rem;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  font-weight: 600;
}
button:hover {
  filter: brightness(.92);
}
button.secondary {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--line);
}
.icon-button {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: .5rem;
  border-radius: 50%;
}
.icon-button svg {
  width: 1.25rem;
  height: 1.25rem;
}
button:disabled {
  opacity: .55;
  cursor: not-allowed;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
input:not([type="checkbox"]),
textarea,
select {
  max-width: 100%;
  padding: .7rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--surface);
  color: var(--text);
}
input:not([type="checkbox"]),
textarea {
  width: 100%;
}
input[type="checkbox"] {
  accent-color: var(--accent);
}
label {
  display: block;
}
#login {
  margin: 4rem auto;
  max-width: 560px;
}
.eyebrow {
  color: var(--accent);
  font-weight: 600;
}
#auth-providers {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.5rem;
}
.chat-toolbar {
  flex-wrap: wrap;
  font-size: .8rem;
}
#key-status {
  flex: 1 1 200px;
}
#model {
  max-width: 240px;
  padding: .45rem;
}
.key-setup,
.privacy {
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
  margin: 1rem 0;
  background: var(--surface);
}
#settings,
#upcoming {
  position: static;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
}
#settings > summary,
#upcoming > summary {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.35rem;
  list-style: none;
}
#settings > summary::-webkit-details-marker,
#upcoming > summary::-webkit-details-marker {
  display: none;
}
#settings > summary::marker,
#upcoming > summary::marker {
  content: "";
}
#settings > summary:hover,
#upcoming > summary:hover {
  background: var(--tint);
}
.settings-panel,
.upcoming-panel {
  position: absolute;
  z-index: 2;
  top: calc(100% + .5rem);
  right: 0;
  width: min(34rem, 100%);
  max-height: min(75vh, 48rem);
  overflow: auto;
  padding: .5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 12px 36px #00000024;
}
#upcoming > summary {
  position: relative;
}
#upcoming-badge {
  position: absolute;
  top: -.35rem;
  right: -.35rem;
  min-width: 1.25rem;
  padding: 0 .25rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-size: .65rem;
  font-weight: 700;
}
.pane-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.pane-heading h2 {
  margin: .5rem 0;
  font-size: 1.2rem;
}
.pane-heading button {
  padding: .25rem .6rem;
}
.upcoming-panel h3 {
  font-size: .85rem;
  color: var(--accent);
  margin-bottom: .5rem;
}
.upcoming-items {
  list-style: none;
  padding: 0;
  margin: .5rem 0;
}
.upcoming-item {
  display: grid;
  gap: .1rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.upcoming-item:last-child {
  border-bottom: 0;
}
.upcoming-title {
  font-weight: 600;
  font-size: .9rem;
}
#upcoming-pane {
  position: sticky;
  top: 5rem;
  z-index: 1;
  max-height: 30vh;
  overflow: auto;
  padding: .65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 8px 30px #0000000d;
}
#upcoming-pane > button {
  padding: .25rem .6rem;
  font-size: .8rem;
}
#upcoming-preview .upcoming-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#settings .chat-toolbar {
  margin-top: .75rem;
}
.key-setup button {
  margin-top: .75rem;
}
.privacy {
  font-size: .85rem;
}
summary {
  cursor: pointer;
  color: var(--muted);
}
.consent {
  margin-top: .75rem;
}
#empty-chat {
  text-align: center;
  padding: 3rem 0 2rem;
}
.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
}
#messages {
  min-height: 10vh;
}
article {
  padding: 1.2rem;
  margin: 1rem 0;
  border-radius: 1.25rem;
}
article.assistant {
  padding-left: .25rem;
}
article.user {
  background: var(--tint);
  margin-left: 15%;
}
article strong {
  color: var(--accent);
  font-size: .8rem;
}
.message-content {
  overflow-wrap: anywhere;
}
.message-content > :first-child {
  margin-top: .5rem;
}
.message-content p,
.message-content ul,
.message-content ol,
.message-content blockquote,
.message-content pre {
  margin: .5rem 0;
}
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin: .75rem 0 .25rem;
  line-height: 1.3;
}
.message-content pre {
  overflow-x: auto;
  padding: .75rem;
  border-radius: .6rem;
  background: var(--surface);
}
.message-content code {
  padding: .1rem .25rem;
  border-radius: .25rem;
  background: var(--surface);
  font-family: ui-monospace, monospace;
}
.message-content pre code {
  padding: 0;
  background: none;
}
.message-content blockquote {
  padding-left: .75rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
article button {
  margin: .75rem .5rem 0 0;
}
article button + button {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--line);
}
.message-state {
  font-size: .8rem;
  color: var(--muted);
}
.thinking p::after {
  content: " …";
  animation: pulse 1.2s ease-in-out infinite;
}
dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: .35rem .75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  font-size: .85rem;
}
dt {
  font-weight: 600;
  overflow-wrap: anywhere;
}
dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.history-tools {
  flex-wrap: wrap;
  margin: 1.5rem 0 .75rem;
}
.history-tools button {
  font-size: .8rem;
}
#chat-form {
  position: sticky;
  bottom: .5rem;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  padding: .35rem;
  box-shadow: 0 8px 30px #0000000d;
}
.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: .35rem;
}
.composer-input-row textarea {
  flex: 1;
  min-width: 0;
  resize: vertical;
  min-height: 80px;
  max-height: 240px;
  border: 0;
}
.composer-toggle {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  padding: .5rem;
}
#send {
  flex: 0 0 auto;
}
#chat-form.compact .composer-input-row textarea {
  height: 2.75rem;
  min-height: 2.75rem;
  max-height: 2.75rem;
  padding: .45rem .5rem;
  resize: none;
}
#chat-form.compact #composer-details {
  display: none;
}
.composer-tools {
  justify-content: space-between;
  margin-top: .5rem;
}
.composer-tools label {
  font-size: .8rem;
}
.composer-hint {
  margin: .5rem 0 0;
  text-align: center;
  font-size: .75rem;
}
.hint {
  color: var(--muted);
  font-size: .85rem;
}
#notice:empty {
  display: none;
}
#notice,
#send-status,
#send-error {
  padding: .75rem 1rem;
  border-radius: .75rem;
  background: var(--tint);
  font-size: .85rem;
  overflow-wrap: anywhere;
}
#send-status {
  margin: .5rem 0 0;
}
#send-error {
  margin-top: .5rem;
}
#send-error summary {
  color: inherit;
  font-weight: 600;
}
#send-error p {
  margin: .5rem 0 0;
  white-space: pre-wrap;
}
[data-tone="error"] {
  color: light-dark(#9d2336, #ffadb9);
  border: 1px solid light-dark(#e9b5bd, #75414b);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
[hidden] {
  display: none !important;
}
@keyframes pulse {
  50% {
    opacity: .35;
  }
}
@media (prefers-reduced-motion: reduce) {
  .thinking p::after {
    animation: none;
  }
}
@media (max-width: 600px) {
  main {
    padding: 0 .5rem .5rem;
  }
  .brand .hint {
    display: none;
  }
  #model {
    flex: 1;
    max-width: none;
    min-width: 0;
  }
  article.user {
    margin-left: 8%;
  }
  #empty-chat {
    padding-top: 2rem;
  }
  .composer-tools .hint {
    display: none;
  }
}
