:root {
  color-scheme: light;
  --forest: #163b32;
  --forest-deep: #0f2b25;
  --mint: #dcebe5;
  --paper: #f7f8f5;
  --white: #ffffff;
  --ink: #1d2825;
  --muted: #66726e;
  --line: #dce2de;
  --accent: #b3483f;
  --gold: #d8b153;
  --shadow: 0 10px 30px rgb(15 43 37 / 8%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  min-width: 320px;
}

button, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.app-shell {
  display: grid;
  grid-template-columns: minmax(290px, 34vw) minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--forest-deep);
  color: var(--white);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px clamp(22px, 3vw, 44px);
  z-index: 1;
}

.brand-lockup div, .mobile-brand div { display: grid; gap: 2px; }
.brand-lockup strong { font-size: 1rem; }
.brand-lockup span, .mobile-brand span { color: rgb(255 255 255 / 68%); font-size: 0.78rem; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid rgb(255 255 255 / 38%);
  border-radius: 50%;
  color: var(--white) !important;
  font-family: Georgia, serif;
  font-size: 1.35rem !important;
  font-weight: 700;
}

.brand-image {
  min-height: 180px;
  flex: 1 1 46%;
  background: linear-gradient(180deg, transparent 55%, var(--forest-deep) 100%), url("/soroe-landscape.webp") center / cover no-repeat;
}

.brand-copy {
  padding: 4px clamp(22px, 3vw, 44px) 24px;
  max-width: 560px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(2rem, 4.4vh, 3.5rem);
  font-weight: 500;
  line-height: 1.05;
}

.brand-copy > p:last-child {
  max-width: 46ch;
  margin: 18px 0 0;
  color: rgb(255 255 255 / 76%);
  line-height: 1.55;
}

.disclaimer {
  margin: 0;
  padding: 0 clamp(22px, 3vw, 44px) 22px;
  color: rgb(255 255 255 / 50%);
  font-size: 0.72rem;
  line-height: 1.45;
}

.chat-panel {
  display: grid;
  grid-template-rows: 66px minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: var(--paper);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 82%);
  backdrop-filter: blur(12px);
}

.mobile-brand { display: none; }

.service-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3c8a68;
  box-shadow: 0 0 0 3px rgb(60 138 104 / 14%);
}

.service-state.busy .status-dot { background: var(--gold); }
.service-state.error .status-dot { background: var(--accent); }

.icon-command, .send-button {
  display: grid;
  place-items: center;
  border: 0;
}

.icon-command {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--forest);
  font-size: 1.5rem;
  line-height: 1;
}

.icon-command:hover { background: var(--mint); }
.icon-command:focus-visible, .send-button:focus-visible, .suggestions button:focus-visible, textarea:focus-visible {
  outline: 3px solid rgb(179 72 63 / 26%);
  outline-offset: 2px;
}

.conversation {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 34px clamp(20px, 7vw, 100px) 22px;
  scroll-behavior: smooth;
}

.welcome-state {
  display: grid;
  justify-items: center;
  max-width: 610px;
  margin: min(10vh, 88px) auto 0;
  text-align: center;
}

.assistant-avatar, .message-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--forest);
  color: var(--white);
  font-weight: 750;
}

.assistant-avatar {
  width: 58px;
  height: 58px;
  box-shadow: 0 0 0 8px var(--mint);
}

.welcome-state h2 {
  margin: 24px 0 7px;
  font-family: Georgia, serif;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 500;
}

.welcome-state > p { margin: 0; color: var(--muted); }

.suggestions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-top: 34px;
}

.suggestions button {
  min-height: 70px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.35;
  text-align: left;
  box-shadow: 0 2px 8px rgb(15 43 37 / 3%);
}

.suggestions button:hover { border-color: #99afa6; background: #fbfdfc; }

.messages { display: grid; gap: 22px; max-width: 850px; margin: 0 auto; }

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  max-width: 850px;
  margin: 0 auto;
}

.message-row.user { justify-content: flex-end; }

.message-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  font-size: 0.68rem;
  margin-top: 2px;
}

.message-bubble {
  max-width: min(680px, 82%);
  padding: 13px 16px;
  border-radius: 7px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.message-row.assistant .message-bubble {
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: var(--shadow);
}

.message-row.user .message-bubble { background: var(--forest); color: var(--white); }
.message-bubble p { margin: 0 0 10px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble a { color: inherit; text-underline-offset: 3px; }
.message-time { display: block; margin-top: 8px; color: currentColor; font-size: 0.68rem; opacity: 0.56; }

.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: pulse 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
  0%, 70%, 100% { opacity: 0.25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

.composer-wrap { padding: 12px clamp(20px, 7vw, 100px) 22px; }

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: end;
  gap: 10px;
  max-width: 850px;
  margin: 0 auto;
  padding: 8px 8px 8px 17px;
  border: 1px solid #cbd5d0;
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 8px 26px rgb(15 43 37 / 9%);
}

.composer:focus-within { border-color: #75988a; }

textarea {
  width: 100%;
  max-height: 150px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.45;
  padding: 9px 0;
}
textarea::placeholder { color: #89938f; }

.send-button {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--white);
  font-size: 1.35rem;
  font-weight: 700;
}
.send-button:hover:not(:disabled) { background: #913a34; }
.send-button:disabled { cursor: default; opacity: 0.35; }

.error-message {
  max-width: 850px;
  margin: 9px auto 0;
  color: var(--accent);
  font-size: 0.78rem;
}

.hidden { display: none !important; }
.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: 820px) {
  .app-shell { display: block; }
  .brand-panel { display: none; }
  .chat-panel { height: 100dvh; grid-template-rows: 62px minmax(0, 1fr) auto; }
  .chat-header { justify-content: initial; padding: 0 16px; }
  .mobile-brand { display: flex; align-items: center; gap: 9px; margin-right: auto; }
  .mobile-brand .brand-mark { width: 34px; height: 34px; flex-basis: 34px; background: var(--forest); }
  .mobile-brand strong { font-size: 0.9rem; }
  .mobile-brand span { color: var(--muted); font-size: 0.7rem; }
  .conversation { padding: 24px 14px 18px; }
  .welcome-state { margin-top: min(8vh, 58px); }
  .suggestions { grid-template-columns: 1fr; gap: 8px; margin-top: 25px; }
  .suggestions button { min-height: 48px; text-align: center; }
  .composer-wrap { padding: 10px 12px max(12px, env(safe-area-inset-bottom)); }
  .message-bubble { max-width: 86%; }
  .service-state { display: none; }
}

@media (max-height: 680px) and (min-width: 821px) {
  .brand-image { min-height: 100px; }
  .brand-copy h1 { font-size: 2rem; }
  .brand-copy > p:last-child { margin-top: 10px; }
  .welcome-state { margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
