:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #183b34;
  background: #fcfbf7;
  font-synthesis: none;
  --orange: #eb742f;
  --green: #173e35;
  --line: #e5e7df;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea {
  font: inherit;
}
button,
a,
input,
textarea {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 10px 14px;
  color: inherit;
}
button:hover {
  background: #edf2e9;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid #eb742f;
  outline-offset: 3px;
}
a {
  color: inherit;
}
button[hidden],
[hidden] {
  display: none !important;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.primary:hover {
  background: #29584a;
}
.chat-shell {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}
aside {
  width: 285px;
  flex-shrink: 0;
  background: #f0f2e9;
  border-right: 1px solid var(--line);
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
}
.brand img {
  height: 54px;
  width: 48px;
  object-fit: contain;
}
.brand small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  margin-top: 5px;
  color: #63786a;
}
input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  min-width: 0;
  width: 100%;
}
#search {
  background: #ffffff90;
}
#history {
  overflow: auto;
  flex: 1;
  min-height: 40px;
}
.history-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  margin: 3px 0;
  font-size: 14px;
}
.history-item.selected {
  background: #dee6d7;
}
footer {
  display: grid;
  gap: 12px;
  font-size: 13px;
}
footer a {
  text-decoration: none;
  padding-left: 10px;
}
footer small {
  line-height: 1.6;
  color: #62776b;
}
#account {
  overflow-wrap: anywhere;
}
main {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}
.chat-header {
  height: 79px;
  padding: 18px 30px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
}
.chat-header strong {
  font-size: 18px;
}
.chat-header small {
  display: block;
  color: #6a7f73;
  font-size: 12px;
  margin-top: 4px;
}
.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.header-actions button {
  border: 0;
  background: transparent;
}
#menu {
  display: none;
}
#notice {
  padding: 14px 24px;
  background: #fff0dd;
  color: #764316;
  font-size: 14px;
}
#messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: auto;
  overscroll-behavior: contain;
  padding: 28px max(24px, calc((100% - 800px) / 2)) 35px;
}
#welcome {
  margin: clamp(15px, 7vh, 90px) auto 15px;
  max-width: 650px;
  text-align: center;
}
#welcome > img {
  height: 108px;
  object-fit: contain;
}
#welcome > span {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  color: #8b6737;
  margin: 14px;
}
h1 {
  font-family: Georgia, serif;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 400;
  line-height: 1.15;
  margin: 20px 0;
}
#welcome p {
  max-width: 450px;
  margin: 0 auto;
  color: #6a7f73;
  line-height: 1.7;
  font-size: 15px;
}
.suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 30px;
}
.suggestions button {
  text-align: left;
  padding: 18px;
  background: #fffdf8;
  border-color: #e5e4d7;
  font-size: 14px;
}
.message {
  max-width: 800px;
  line-height: 1.8;
  margin: 0 auto 30px;
  overflow-wrap: anywhere;
}
.message.user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.message.user .message-content {
  background: #eaf0e3;
  border-radius: 20px 20px 4px 20px;
  padding: 12px 20px;
  max-width: 90%;
  white-space: pre-wrap;
}
.message.assistant .message-label {
  font-size: 12px;
  font-weight: 700;
  color: #5c7161;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.message-label img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.message-content > *:first-child {
  margin-top: 0;
}
.message-content > *:last-child {
  margin-bottom: 0;
}
.message-content pre {
  background: #172e29;
  color: #eef3ed;
  padding: 18px;
  border-radius: 12px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.6;
}
.message-content code {
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
}
.message-content table {
  display: block;
  overflow: auto;
  border-collapse: collapse;
  font-size: 14px;
}
.message-content th,
.message-content td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
}
.message-content blockquote {
  border-left: 3px solid #bdcbb6;
  margin-left: 0;
  padding-left: 16px;
  color: #5d7267;
}
.message-content a {
  color: #13715d;
  text-decoration: underline;
}
.message-tools {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  align-items: center;
}
.message-tools button {
  border: 0;
  background: transparent;
  font-size: 12px;
  padding: 4px 8px;
  color: #6a7f73;
}
.message-state {
  font-size: 12px;
  color: #9c622e;
}
.sources {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.sources a,
.file-chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  text-decoration: none;
  background: #fff;
}
.composer-wrap {
  padding: 12px max(24px, calc((100% - 800px) / 2))
    max(14px, env(safe-area-inset-bottom));
  background: #fcfbf7;
}
#composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: white;
  border: 1px solid #d8dfd1;
  border-radius: 22px;
  padding: 12px;
  box-shadow: 0 6px 30px #173e3508;
}
#message {
  resize: none;
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  max-height: 200px;
  line-height: 1.6;
  padding: 6px 0;
  color: var(--green);
}
#send,
#stop {
  background: var(--green);
  color: white;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 23px;
  flex-shrink: 0;
}
#stop {
  font-size: 15px;
}
.attach {
  cursor: pointer;
  font-size: 27px;
  padding: 0 8px;
  line-height: 38px;
}
#attachments {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 8px;
}
.file-chip button {
  border: 0;
  padding: 0 4px;
}
.composer-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  color: #7e8b7d;
  margin: 10px 8px 0;
}
.composer-meta span:first-child {
  font-weight: 500;
}
#scroll-bottom {
  position: absolute;
  bottom: 140px;
  left: 50%;
  border-radius: 50%;
  box-shadow: 0 2px 10px #0001;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  width: min(440px, calc(100% - 32px));
  color: var(--green);
  box-shadow: 0 20px 100px #0003;
}
dialog::backdrop {
  background: #10281f66;
}
dialog h2 {
  margin-top: 0;
}
dialog p {
  font-size: 14px;
  line-height: 1.7;
  color: #667d6f;
}
dialog label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}
dialog .primary {
  margin-top: 16px;
  width: 100%;
}
.dialog-x {
  float: right;
  border: 0;
  font-size: 22px;
  padding: 0 8px;
}
.dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.dialog-actions .primary {
  margin: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.typing:after {
  content: "●";
  animation: pulse 1s infinite;
  color: #73956b;
}
@keyframes pulse {
  50% {
    opacity: 0.2;
  }
}
.admin-content {
  max-width: 800px;
  margin: 50px auto;
  padding: 24px;
}
.admin-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.admin-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  background: white;
}
.admin-card strong {
  display: block;
  font-size: 30px;
  margin: 10px 0;
}
@media (max-width: 760px) {
  aside {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 5;
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: 20px 0 80px #173e3522;
  }
  body.sidebar-open aside {
    transform: translateX(0);
  }
  #menu {
    display: block;
    border: 0;
  }
  .chat-header {
    height: 67px;
    padding: 12px;
  }
  .chat-header small {
    font-size: 10px;
  }
  .header-actions {
    gap: 0;
  }
  .header-actions button {
    padding: 9px;
  }
  #export {
    font-size: 12px;
  }
  #messages {
    padding: 20px 18px;
  }
  .composer-wrap {
    padding: 8px 12px max(12px, env(safe-area-inset-bottom));
  }
  .composer-meta {
    font-size: 9px;
  }
  .composer-meta span:last-child {
    max-width: 145px;
    text-align: right;
  }
  #welcome {
    margin-top: 15px;
  }
  .suggestions {
    gap: 8px;
  }
  .suggestions button {
    padding: 14px 12px;
    font-size: 12px;
  }
  #welcome > img {
    height: 90px;
  }
  .message {
    font-size: 15px;
  }
  dialog {
    padding: 24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.suggestions button {
  display: flex;
  align-items: center;
  gap: 10px;
}
.suggestions svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
#welcome > img {
  border-radius: 24px;
}
.brand img {
  border-radius: 12px;
}

#sidebar-dismiss {
  display: none;
}
@media (max-width: 760px) {
  body.sidebar-open #sidebar-dismiss {
    display: block;
    position: fixed;
    inset: 0 0 0 285px;
    z-index: 4;
    border: 0;
    border-radius: 0;
    background: #173e3540;
  }
}
