:root { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #272622; background: #f7f5f1; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, textarea, input { font: inherit; }
button { cursor: pointer; border: 1px solid #d6d2c9; border-radius: 12px; background: #fff; color: #272622; padding: 10px 15px; }
button:hover { background: #f0ede7; }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid #b95b58; outline-offset: 2px; }
button:disabled { opacity: .55; cursor: default; }
.shell { height: 100dvh; display: flex; }
.sidebar { width: 280px; flex: none; display: flex; flex-direction: column; gap: 12px; padding: 20px 12px; border-right: 1px solid #e5e1d9; background: #f0ede7; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px; font-size: 18px; font-weight: 700; }
.sidebar-heading button { padding: 8px 10px; border-color: #a94440; background: #a94440; color: #fff; font-size: 14px; }
.sessions { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.session-item { width: 100%; border: 0; background: transparent; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-item.active { background: #fff; font-weight: 700; }
.sessions-empty { padding: 8px; color: #77736c; font-size: 14px; }
.more-sessions { margin-top: auto; }
.chat-area { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.topbar { height: 78px; padding: 0 24px; border-bottom: 1px solid #e5e1d9; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.chats-button, .sidebar-backdrop { display: none; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 750; letter-spacing: -.04em; }
.brand img, .dialog-heading img { object-fit: contain; }
.actions, .dialog-actions { display: flex; gap: 10px; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 30px max(24px, calc((100% - 760px) / 2)) 40px; display: flex; flex-direction: column; gap: 22px; }
.empty { margin: auto; text-align: center; color: #77736c; font-size: 20px; }
.message { max-width: min(82%, 720px); line-height: 1.55; }
.message.user { align-self: flex-end; background: #e9e5dc; border-radius: 18px 18px 4px 18px; padding: 12px 16px; }
.message.assistant { align-self: flex-start; }
.message-label { color: #77736c; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.message-content { white-space: pre-wrap; overflow-wrap: anywhere; }
.composer-wrap { width: min(100%, 808px); margin: 0 auto; padding: 0 24px 18px; background: #f7f5f1; }
.status { height: 24px; margin: 0 0 4px; color: #756f67; font-size: 14px; }
.status.error { color: #a33d38; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 10px; border: 1px solid #d6d2c9; background: #fff; border-radius: 18px; box-shadow: 0 6px 24px #2726220b; }
.composer textarea { flex: 1; min-height: 52px; max-height: 180px; resize: vertical; border: 0; padding: 10px; outline: none; background: transparent; }
.composer button, .dialog-actions button[type="submit"] { background: #a94440; border-color: #a94440; color: #fff; font-weight: 650; }
.composer button:hover, .dialog-actions button[type="submit"]:hover { background: #8f3633; }
.hint { margin: 8px 2px 0; color: #827d75; font-size: 12px; }
dialog { width: min(440px, calc(100vw - 32px)); border: 1px solid #e5e1d9; border-radius: 20px; padding: 24px; box-shadow: 0 22px 60px #17130f33; }
dialog::backdrop { background: #17130f88; }
.connection-form { display: flex; flex-direction: column; gap: 12px; }
.dialog-heading { display: flex; align-items: center; gap: 10px; }
.dialog-heading h1 { margin: 0; font-size: 22px; }
.connection-form p { margin: 0 0 8px; color: #655f57; line-height: 1.4; }
.connection-form > label { font-weight: 650; }
.connection-form > input { width: 100%; border: 1px solid #c9c4ba; border-radius: 10px; padding: 11px; }
.connection-error { color: #a33d38 !important; margin: 0 !important; }
.connection-error:empty { display: none; }
.remember { display: flex; align-items: center; gap: 8px; font-weight: 400 !important; }
.dialog-actions { justify-content: flex-end; margin-top: 12px; }
.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; }
@media (max-width: 700px) {
  .sidebar { position: fixed; z-index: 3; inset: 0 auto 0 0; width: min(320px, 86vw); padding-top: max(20px, env(safe-area-inset-top)); transform: translateX(-100%); transition: transform .2s; box-shadow: 8px 0 25px #17130f22; }
  .chats-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 2; inset: 0; border: 0; border-radius: 0; background: #17130f88; }
  .chats-open .sidebar-backdrop { display: block; }
  .chats-button { display: block; }
  .topbar { height: 64px; padding: 0 14px; }
  .topbar button { padding: 8px 10px; }
  .brand { font-size: 20px; }
  .brand img { width: 34px; height: 34px; }
  .messages { padding: 20px 14px; }
  .message { max-width: 94%; }
  .composer-wrap { padding: 0 14px max(12px, env(safe-area-inset-bottom)); }
  .hint { display: none; }
}
