:root {
  color-scheme: light;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #fbf8f2;
  color: #3c3028;
  font-synthesis: none;
  --muted: #817264;
  --line: #e5d9c9;
  --accent: #8a6242;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
select,
.upload-button {
  cursor: pointer;
}
button {
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 10px 14px;
  transition: background 0.15s;
}
button:hover {
  background: #e9dfd2;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
select {
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 8px;
  max-width: 100%;
  font-size: 13px;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 22px;
  flex-shrink: 0;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: #eaddca;
  color: var(--accent);
  font-weight: 750;
  font-size: 20px;
}
.login-card {
  width: min(420px, calc(100% - 40px));
  margin: min(16vh, 140px) auto 40px;
  text-align: center;
}
.login-card > .brand-mark {
  width: 54px;
  height: 54px;
  font-size: 30px;
  border-radius: 18px;
}
.eyebrow {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 2px;
  margin-top: 24px;
}
.login-card h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -1px;
  margin: 16px 0;
}
.login-description {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 32px;
}
.login-card form {
  display: grid;
  gap: 12px;
  text-align: left;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 8px 32px #3c302805;
}
.login-card label {
  font-size: 13px;
  font-weight: 600;
}
#code {
  width: 100%;
  border: 1px solid #d9cbb8;
  border-radius: 10px;
  padding: 14px;
  font-size: 24px;
  letter-spacing: 8px;
  text-align: center;
}
.login-card button {
  background: var(--accent);
  color: white;
  padding: 13px;
  font-weight: 600;
}
.login-card button:hover {
  background: #6c4931;
}
#login-error {
  font-size: 13px;
  color: #b13c3c;
  margin: 0;
  line-height: 1.5;
}
#login-error:empty {
  display: none;
}
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #f1eadf;
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e9dfd2;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.4px;
  padding: 0 8px;
  margin-bottom: 28px;
}
#close-sidebar {
  display: none;
  margin-left: auto;
}
.new-chat {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 550;
  text-align: left;
  border: 1px solid #ddcebb;
  background: #fffdf9;
  padding: 12px;
  box-shadow: 0 2px 3px #49342403;
}
.new-chat span {
  font-size: 21px;
  line-height: 1;
}
.sidebar-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 26px 8px 4px;
  font-size: 11px;
  color: var(--muted);
}
#chat-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  gap: 3px;
}
#chat-list strong {
  font-size: 11px;
  font-weight: 550;
  color: var(--muted);
  padding: 16px 12px 6px;
}
#chat-list button,
#chat-list .chat-link {
  text-align: left;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 11px 12px;
  flex-shrink: 0;
}
#chat-list .chat-link.active {
  background: #e3d4bf;
  color: #6c4931;
  font-weight: 550;
}
.sidebar-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 16px 4px 0;
  margin-top: 16px;
}
.user-avatar {
  display: grid;
  place-items: center;
  background: #e2d3be;
  color: #755436;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 12px;
  flex-shrink: 0;
}
.sidebar-footer strong {
  display: block;
  font-size: 11px;
  font-weight: 600;
}
.sidebar-footer small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}
#logout {
  margin-left: auto;
  font-size: 19px;
}
.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  position: relative;
}
.chat-header {
  height: 76px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 32px;
}
.chat-heading {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
#chat-title {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-subtitle {
  color: var(--muted);
  font-size: 11px;
}
#toggle-sidebar {
  display: none;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
#project-select {
  max-width: 170px;
  color: var(--muted);
}
#toggle-files {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  white-space: nowrap;
}
#file-count {
  background: #eee4d6;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10px;
}
#app-status {
  margin: 0 24px;
  color: #a84635;
  font-size: 13px;
  line-height: 1.5;
}
#app-status:not(:empty) {
  background: #fceee4;
  border-radius: 10px;
  padding: 12px 16px;
}
.conversation {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 32px 28px;
  scroll-behavior: smooth;
}
.welcome {
  max-width: 720px;
  margin: clamp(24px, 12vh, 130px) auto 40px;
  text-align: center;
}
.welcome-badge {
  background: #f4ecdf;
  border: 1px solid #e5d5bf;
  color: var(--accent);
  padding: 7px 12px;
  font-size: 11px;
  border-radius: 30px;
}
.welcome h1 {
  margin: 26px 0 12px;
  font-size: clamp(30px, 4vw, 42px);
  letter-spacing: -1.5px;
  font-weight: 550;
}
.welcome > p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.suggestions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 38px;
}
.suggestions button {
  text-align: left;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf9;
}
.suggestions button:hover {
  background: #f6efe5;
  border-color: #d0b797;
}
.suggestions span {
  display: block;
  font-size: 23px;
  color: var(--accent);
  margin-bottom: 18px;
}
.suggestions strong {
  display: block;
  font-size: 13px;
  font-weight: 550;
}
.suggestions small {
  display: block;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 6px;
}
#messages {
  max-width: 760px;
  margin: auto;
}
article {
  margin: 0 0 32px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
article small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 8px;
}
article p {
  white-space: pre-wrap;
  margin: 0;
  font-size: 15px;
}
article.user-message {
  margin-left: auto;
  max-width: 85%;
  width: fit-content;
  background: #eee4d6;
  padding: 14px 20px;
  border-radius: 20px 20px 5px 20px;
}
article.assistant-message {
  padding: 6px 0;
}
article.assistant-message small {
  color: var(--accent);
}
article .copy-button {
  margin-top: 8px;
  font-size: 11px;
  padding: 5px 8px;
  color: var(--muted);
}
.progress {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid #dfccb2;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.message-error {
  color: #b13c3c;
}
.composer-area {
  flex-shrink: 0;
  padding: 0 32px 18px;
}
#message-form {
  max-width: 760px;
  margin: auto;
  padding: 16px 12px 10px;
  border: 1px solid #dfd0bd;
  border-radius: 24px;
  box-shadow: 0 4px 20px #49342405;
  background: #fffdf9;
}
#message-form:focus-within {
  border-color: #b79a79;
  box-shadow: 0 4px 20px #8a624208;
}
textarea {
  display: block;
  width: 100%;
  min-height: 36px;
  max-height: 180px;
  padding: 0 8px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  line-height: 1.6;
  font-size: 15px;
}
textarea:focus-visible {
  outline: none;
}
textarea::placeholder {
  color: #8c7b6c;
}
.composer-toolbar,
.composer-tools {
  display: flex;
  align-items: center;
  gap: 5px;
}
.composer-toolbar {
  justify-content: space-between;
  margin-top: 8px;
}
.composer-tools {
  min-width: 0;
}
#model-select {
  max-width: 260px;
  font-size: 12px;
  color: #796450;
}
#send-message {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: #79543a;
  color: #fff;
  font-size: 24px;
  flex-shrink: 0;
}
#send-message:hover {
  background: var(--accent);
}
.composer-hint {
  text-align: center;
  font-size: 10px;
  color: #8c7b6c;
  margin: 10px 0 0;
}
#files-panel {
  width: 300px;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  padding: 24px 20px;
  overflow-y: auto;
  background: #fffdf9;
}
.files-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}
.files-heading h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
}
.files-heading p,
.file-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  margin: 6px 0 0;
}
.upload-button {
  display: block;
  border: 1px dashed #ccb497;
  color: var(--accent);
  padding: 14px;
  text-align: center;
  border-radius: 12px;
  font-size: 12px;
  background: #f8f1e6;
  position: relative;
  overflow: hidden;
}
#file-upload {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.upload-button:focus-within {
  outline: 2px solid var(--accent);
}
.file-hint {
  margin: 12px 0 20px;
}
#file-list {
  display: grid;
  gap: 8px;
}
.file-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 40px 12px 12px;
  background: #fffdf9;
}
.file-row button {
  padding: 5px;
  font-size: 19px;
  color: #9d713d;
}
.file-row a {
  color: #654d39;
  text-decoration: none;
  font-size: 12px;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.file-row a:hover {
  text-decoration: underline;
}
.file-badge {
  position: absolute;
  left: 12px;
  top: 10px;
  border-radius: 6px;
  background: #eaddca;
  color: #6c4931;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.6;
}
.file-row .file-star {
  position: absolute;
  right: 8px;
  top: 5px;
  padding: 2px 6px;
}
.timeline-file {
  width: min(420px, 100%);
  margin: 0 0 24px;
  line-height: 1.5;
}
.timeline-file.uploaded-file {
  margin-left: auto;
}
.timeline-file .file-name {
  font-size: 14px;
  font-weight: 550;
}
.files-empty {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px;
  font-size: 12px;
  line-height: 1.8;
}
.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  border-radius: 0;
  background: #49342430;
}
.panel-backdrop:hover {
  background: #49342430;
}
@media (max-width: 1100px) {
  #files-panel {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(340px, 90vw);
    z-index: 30;
    box-shadow: -10px 0 40px #49342408;
  }
}
@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  #toggle-sidebar,
  #close-sidebar {
    display: inline-flex;
  }
  .chat-header {
    padding: 0 14px;
    height: 68px;
    gap: 10px;
  }
  .header-subtitle {
    display: none;
  }
  .header-actions {
    gap: 2px;
  }
  #project-select {
    max-width: 100px;
    font-size: 11px;
  }
  #toggle-files {
    padding: 8px;
  }
  .conversation {
    padding: 20px 18px;
  }
  .welcome {
    margin: 55px auto 20px;
  }
  .welcome h1 {
    font-size: 34px;
  }
  .suggestions {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 26px;
  }
  .suggestions button {
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 28px 1fr;
    column-gap: 10px;
  }
  .suggestions span {
    grid-row: span 2;
    margin: 0;
    align-self: center;
  }
  .suggestions small {
    margin-top: 3px;
  }
  .composer-area {
    padding: 0 12px 12px;
  }
  #message-form {
    border-radius: 20px;
  }
  article p {
    font-size: 14px;
  }
  article.user-message {
    max-width: 92%;
    padding: 12px 16px;
  }
  #model-select {
    max-width: 200px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
dialog {
  width: min(420px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 80px #49342415;
}
dialog::backdrop {
  background: #49342445;
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dialog-heading h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}
dialog p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
dialog label {
  display: block;
  font-size: 12px;
  font-weight: 550;
  margin: 22px 0 10px;
}
dialog input {
  width: 100%;
  padding: 12px;
  border: 1px solid #d9cbb8;
  border-radius: 10px;
  font-size: 14px;
}
.primary-button {
  width: 100%;
  background: var(--accent);
  color: white;
  margin-top: 16px;
}
.primary-button:hover {
  background: #6c4931;
}
#project-error {
  color: #b13c3c;
}
#project-error:empty {
  display: none;
}
.chat-list-row {
  display: flex;
  align-items: center;
  border-radius: 10px;
}
.chat-list-row:hover,
.chat-list-row:focus-within {
  background: #e9dfd2;
}
#chat-list .chat-link {
  flex: 1;
  min-width: 0;
}
#chat-list .chat-rename {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 17px;
  color: var(--muted);
  opacity: 0;
}
.chat-list-row:hover .chat-rename,
.chat-list-row:focus-within .chat-rename {
  opacity: 1 !important;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}
.dialog-actions .primary-button {
  margin: 0;
  width: auto;
  padding-inline: 24px;
}
.dialog-error {
  color: #b13c3c;
}
.dialog-error:empty {
  display: none;
}
.file-info {
  min-width: 0;
  flex: 1;
}
.file-details {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.file-source {
  color: var(--muted);
  font-size: 10px;
}
.ai-source {
  color: var(--accent);
  background: #f4ecdf;
  border-radius: 5px;
  padding: 2px 5px;
}
.file-row .file-download {
  font-size: 11px;
  color: var(--accent);
  margin-left: auto;
}
.sidebar-logo {
  object-fit: contain;
  flex-shrink: 0;
}
.chat-link {
  display: block;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}
.markdown-body {
  font-size: 15px;
  line-height: 1.75;
}
.markdown-body p {
  white-space: normal;
  margin: 0 0 14px;
}
.markdown-body > :first-child {
  margin-top: 0;
}
.markdown-body > :last-child {
  margin-bottom: 0;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  line-height: 1.35;
  margin: 26px 0 12px;
  font-weight: 650;
}
.markdown-body h1 {
  font-size: 26px;
}
.markdown-body h2 {
  font-size: 22px;
}
.markdown-body h3 {
  font-size: 18px;
}
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-size: 16px;
}
.markdown-body ul,
.markdown-body ol {
  padding-left: 24px;
  margin: 12px 0 18px;
}
.markdown-body li {
  padding-left: 3px;
  margin: 5px 0;
}
.markdown-body li > p {
  margin-bottom: 6px;
}
.markdown-body blockquote {
  border-left: 3px solid #cbb294;
  padding: 4px 18px;
  color: #796450;
  margin: 18px 0;
  background: #f5eee4;
  border-radius: 0 8px 8px 0;
}
.markdown-body a {
  color: #79543a;
  text-underline-offset: 3px;
}
.markdown-body code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.88em;
  background: #eee4d6;
  border-radius: 5px;
  padding: 2px 5px;
}
.markdown-body pre {
  max-width: 100%;
  overflow-x: auto;
  background: #f1eadf;
  border: 1px solid #e5d9c9;
  border-radius: 12px;
  padding: 16px 18px;
  margin: 16px 0;
  line-height: 1.6;
  white-space: pre;
  overflow-wrap: normal;
}
.markdown-body pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 13px;
}
.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
.markdown-table {
  max-width: 100%;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.markdown-body th,
.markdown-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.markdown-body th {
  background: #f1eadf;
  font-weight: 600;
}
.markdown-body tr:last-child td {
  border-bottom: 0;
}
.markdown-body input[type="checkbox"] {
  accent-color: var(--accent);
  margin-right: 6px;
}
.markdown-fallback {
  white-space: pre-wrap;
}
@media (max-width: 760px) {
  .markdown-body,
  .markdown-body p {
    font-size: 14px;
  }
}
@media (hover: none) {
  #chat-list .chat-rename {
    opacity: 1;
  }
}
