:root {
  color-scheme: light;
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  color: #343b35;
  background: #f7f0e8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: radial-gradient(ellipse at 50% 0, #fffaf2 0, #f7f0e8 70%); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.chat-page { padding: 2.5rem 1.25rem 1.5rem; }
.chat-shell { width: min(100%, 820px); margin: 0 auto; }
.chat-header { display: flex; align-items: center; gap: 1rem; padding: .5rem .25rem 1.8rem; }
.brand-mark { display: grid; width: 3rem; height: 3rem; flex: 0 0 auto; place-items: center; border: 1px solid #e5d7c8; border-radius: 50%; color: #bd8267; font-size: 1.3rem; }
.heading-copy { flex: 1; }
.eyebrow { margin: 0 0 .3rem; color: #71816d; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .2rem; font: 500 2rem/1.1 Georgia, serif; letter-spacing: -.035em; }
.welcome-line { margin: .4rem 0 0; color: #797c73; font-size: .9rem; }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.user-name { color: #71816d; font-size: .88rem; }
.quiet-button { border: 0; background: transparent; color: #77766e; padding: .5rem; }
.quiet-button:hover { color: #343b35; }

.conversation { overflow: hidden; border: 1px solid #e9ded2; border-radius: 1.25rem; background: rgb(255 253 248 / 88%); box-shadow: 0 18px 55px rgb(89 74 56 / 8%); }
.conversation-heading { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem .85rem; border-bottom: 1px solid #f0e8df; }
.conversation-heading h2 { margin: 0 0 .2rem; font: 500 1.2rem Georgia, serif; }
.conversation-heading p { margin: 0; color: #99948a; font-size: .82rem; }
.unread-indicator { border-radius: 99px; background: #75866f; color: white; padding: .3rem .65rem; font-size: .75rem; }
.status { margin: 0; padding: 1rem 1.5rem 0; color: #9a9389; font-size: .9rem; }
.status.error { color: #a14f43; }
.load-older { display: block; margin: .8rem auto 0; padding: .35rem .65rem; border: 0; background: transparent; color: #7a8a74; font-size: .82rem; }
.messages { display: flex; flex-direction: column; gap: .65rem; min-height: 300px; max-height: min(58vh, 620px); overflow-y: auto; margin: 0; padding: 1rem 1.25rem 1.25rem; list-style: none; scroll-behavior: smooth; }
.empty-state { display: grid; flex: 1; min-height: 250px; place-content: center; text-align: center; color: #8e9185; }
.empty-state span { margin-bottom: .6rem; color: #c18a70; font-size: 1.6rem; }
.empty-state p { margin: 0; font: 1.05rem Georgia, serif; }
.message-row { display: flex; width: 100%; }
.message-row.own { justify-content: flex-end; }
.message-bubble { max-width: min(78%, 520px); padding: .72rem .9rem .55rem; border: 1px solid #eee6dc; border-radius: 1rem 1rem 1rem .3rem; background: #f5f1e9; overflow-wrap: anywhere; }
.message-row.own .message-bubble { border-color: #dce5d7; border-radius: 1rem 1rem .3rem 1rem; background: #e9f0e4; }
.message-sender { margin: 0 0 .3rem; color: #71816d; font-size: .75rem; font-weight: 600; }
.message-body { margin: 0; white-space: pre-wrap; line-height: 1.5; }
.message-time { display: block; margin-top: .35rem; color: #a19a90; text-align: right; font-size: .68rem; }
.composer { display: flex; align-items: flex-end; gap: .7rem; margin: 0 1rem; padding: .75rem; border: 1px solid #e9ded2; border-radius: 1rem; background: #fffdfa; }
.composer textarea { flex: 1; resize: none; max-height: 9rem; border: 0; outline: 0; background: transparent; padding: .45rem; line-height: 1.45; }
.composer textarea::placeholder { color: #aaa398; }
.send-button { flex: 0 0 auto; border: 0; border-radius: .75rem; background: #75866f; color: white; padding: .7rem 1rem; transition: background .15s; }
.send-button:hover:not(:disabled) { background: #5f705a; }
.send-button:disabled { cursor: default; opacity: .5; }
.composer-note { margin: .55rem 1.5rem .8rem; color: #aaa398; font-size: .7rem; }
.chat-footer { padding: 1rem; color: #a19a90; text-align: center; font-size: .78rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.login-page { display: grid; place-items: center; padding: 1.25rem; }
.login-card { width: min(100%, 390px); padding: 2.5rem; border: 1px solid #e9ded2; border-radius: 1.25rem; background: rgb(255 253 248 / 90%); box-shadow: 0 18px 55px rgb(89 74 56 / 8%); }
.login-ornament { display: block; margin-bottom: 1.1rem; color: #c4866a; font-size: 1.6rem; text-align: center; }
.login-card h1 { margin-bottom: .6rem; font-size: 2.5rem; text-align: center; }
.login-card > .eyebrow { text-align: center; }
.login-intro { margin-bottom: 1.5rem; color: #797c73; text-align: center; }
.login-card form { display: flex; flex-direction: column; gap: .55rem; }
.login-card label { margin-top: .45rem; color: #686d63; font-size: .85rem; }
.login-card input { width: 100%; border: 1px solid #e5dacf; border-radius: .7rem; background: #fffdfa; padding: .75rem; outline-color: #9cad95; }
.login-submit { margin-top: .75rem; }
.form-error { min-height: 1.2rem; margin: .2rem 0 0; color: #a14f43; font-size: .85rem; }

@media (max-width: 600px) {
  .chat-page { padding: 1rem .65rem .75rem; }
  .chat-header { align-items: flex-start; gap: .7rem; padding-bottom: 1rem; }
  .brand-mark { width: 2.45rem; height: 2.45rem; }
  h1 { font-size: 1.65rem; }
  .eyebrow { font-size: .62rem; }
  .welcome-line { max-width: 14rem; font-size: .78rem; }
  .header-actions { flex-direction: column; align-items: flex-end; gap: .15rem; }
  .user-name { max-width: 6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; }
  .quiet-button { padding: .3rem; font-size: .8rem; }
  .conversation { border-radius: 1rem; }
  .conversation-heading { padding: 1rem 1rem .75rem; }
  .messages { min-height: 240px; max-height: 58vh; padding: .85rem .7rem 1rem; }
  .message-bubble { max-width: 88%; }
  .composer { gap: .35rem; margin: 0 .55rem; padding: .45rem; }
  .send-button { padding: .68rem .75rem; font-size: .85rem; }
  .composer-note { margin-left: .8rem; }
  .login-card { padding: 2rem 1.35rem; }
}
