:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #22201f;
  background: #e8ece9;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(236, 240, 237, 0.94), rgba(236, 240, 237, 0.94)),
    repeating-linear-gradient(45deg, #dce3de 0, #dce3de 1px, transparent 1px, transparent 14px);
}

button, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 760px);
  height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background: #f4f1ec;
  border-inline: 1px solid #d7d2ca;
  box-shadow: 0 0 32px rgba(45, 52, 47, 0.12);
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  color: #fff;
  background: #29493d;
  border-bottom: 3px solid #c86346;
}

.identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 18px;
}
.identity h1 { margin: 0; font-family: Georgia, serif; font-size: 21px; font-weight: 500; letter-spacing: 0; }
.identity p { margin: 3px 0 0; font-size: 12px; color: #dce8e2; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: #7ed39d; }

.icon-button, .send-button {
  border: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
}
.icon-button { color: #fff; background: rgba(255,255,255,.1); font-size: 24px; }
.icon-button:hover { background: rgba(255,255,255,.18); }

.chat {
  min-height: 0;
  overflow-y: auto;
  padding: 24px clamp(14px, 4vw, 30px);
  background-color: #eeeae3;
  background-image: radial-gradient(#d6d0c6 0.75px, transparent 0.75px);
  background-size: 18px 18px;
}

.message {
  width: fit-content;
  max-width: min(84%, 540px);
  margin-bottom: 12px;
  padding: 10px 12px 7px;
  border-radius: 7px;
  box-shadow: 0 1px 2px rgba(50, 45, 40, .12);
  overflow-wrap: anywhere;
}
.message p { margin: 0; white-space: pre-wrap; line-height: 1.42; font-size: 15px; }
.message a { color: #1769aa; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.message a:hover { color: #0d4d80; }
.message time { display: block; margin-top: 4px; text-align: right; font-size: 10px; color: #77736d; }
.assistant-message { background: #fff; border-top-left-radius: 2px; }
.user-message { margin-left: auto; background: #d9eedb; border-top-right-radius: 2px; }
.message.loading p { color: #77736d; letter-spacing: 0; }
.message.error { border-left: 3px solid #b74636; }

.quick-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px;
  border-top: 1px solid #ddd7cf;
  background: #faf8f4;
}
.quick-actions button {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 6px 11px;
  border: 1px solid #9eaa9f;
  border-radius: 5px;
  color: #29493d;
  background: #fff;
  font-size: 12px;
}
.quick-actions button:hover { border-color: #c86346; color: #9e3e29; }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 70px;
  padding: 12px 14px;
  background: #f7f5f1;
  border-top: 1px solid #ddd7cf;
}
.composer textarea {
  width: 100%;
  max-height: 120px;
  min-height: 44px;
  resize: none;
  padding: 11px 13px;
  border: 1px solid #cec8bf;
  border-radius: 6px;
  color: #22201f;
  background: #fff;
  outline: none;
  line-height: 1.4;
}
.composer textarea:focus { border-color: #477464; box-shadow: 0 0 0 3px rgba(71,116,100,.12); }
.send-button { color: #fff; background: #c4553b; font-size: 22px; }
.send-button:hover { background: #ab452f; }
.send-button:disabled, .quick-actions button:disabled { opacity: .5; cursor: default; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 600px) {
  .app-shell { border: 0; }
  .topbar { min-height: 68px; padding: 9px 12px; }
  .brand-mark { width: 42px; height: 42px; flex-basis: 42px; }
  .identity h1 { font-size: 18px; }
  .message { max-width: 90%; }
}
