body.view-app {
  min-height: 100vh;
  background:
    radial-gradient(1200px 420px at 50% -80px, #d7ece3 0%, transparent 62%),
    #f3f7f4;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1040px;
  padding-bottom: 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -18px 22px;
  padding: 14px 18px;
  background: rgba(243, 247, 244, .88);
  backdrop-filter: blur(12px);
}

.chat-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 16px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: calc(100vh - 148px);
  overflow: hidden;
}

.chat-heading {
  align-items: flex-start;
  padding: 20px 24px 18px;
}

.chat-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.chat-heading h2 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.chat-subtitle {
  max-width: 36rem;
  margin: 6px 0 0;
  color: #547068;
  font-size: .95rem;
  line-height: 1.45;
}

.chat-heading-actions .button.secondary {
  padding: 8px 12px;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 320px;
  background:
    linear-gradient(180deg, #f8fbf9 0%, #f4f8f6 100%);
}

.chat-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: auto;
  padding: 36px 28px;
  max-width: 520px;
  text-align: center;
}

.chat-empty-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  border-radius: 18px;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  background: #176b58;
  box-shadow: 0 10px 24px rgba(23, 107, 88, .22);
}

.chat-empty h3 {
  margin: 0;
  font-size: 1.2rem;
}

.chat-empty p {
  margin: 0;
  color: #547068;
  line-height: 1.5;
}

.chat-prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.chat-prompt {
  border: 1px solid #c8d9d2;
  border-radius: 999px;
  padding: 8px 13px;
  color: #245247;
  background: #fff;
  font-size: .86rem;
  font-weight: 650;
}

.chat-prompt:hover {
  border-color: #318267;
  background: #eef7f3;
}

.chat-panel .messages {
  display: none;
  gap: 16px;
  min-height: 0;
  max-height: none;
  padding: 8px 24px 22px;
  background: transparent;
}

.chat-thread:has(.messages:not(:empty)) .chat-empty {
  display: none;
}

.chat-thread:has(.messages:not(:empty)) .messages {
  display: grid;
  flex: 1;
  overflow-y: auto;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: min(86%, 680px);
}

.message-row.owner {
  justify-self: end;
  flex-direction: row-reverse;
}

.message-row.bot {
  justify-self: start;
}

.message-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: .72rem;
  font-weight: 800;
}

.message-row.bot .message-avatar {
  color: #fff;
  background: #176b58;
}

.message-row.owner .message-avatar {
  color: #176b58;
  background: #d7ece3;
}

.chat-panel .message {
  max-width: none;
  padding: 12px 15px 13px;
  box-shadow: 0 8px 20px rgba(26, 65, 51, .05);
}

.chat-panel .message.owner {
  border-bottom-right-radius: 6px;
}

.chat-panel .message.bot {
  background: #fff;
  border: 1px solid #dce8e2;
  border-bottom-left-radius: 6px;
}

.chat-panel .message.bot p {
  margin: 0 0 8px;
}

.chat-panel .message.bot p:last-child {
  margin-bottom: 0;
}

.chat-panel .bot-questions {
  display: block;
  margin: 0 0 8px;
  padding-left: 1.4rem;
  list-style: decimal;
}

.chat-panel .bot-questions li + li {
  margin-top: 6px;
}

.message-label {
  margin-bottom: 2px;
}

.chat-panel .message-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 14px 18px 16px;
  background: #fff;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border: 1px solid #c7d8d0;
  border-radius: 18px;
  background: #fbfdfc;
}

.composer:focus-within {
  outline: 3px solid #bbdfd1;
  border-color: #318267;
}

.composer textarea {
  min-height: 52px;
  max-height: 160px;
  border: 0;
  padding: 10px 4px;
  background: transparent;
  resize: none;
}

.composer textarea:focus {
  outline: none;
}

.send-button {
  min-width: 84px;
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  color: #fff;
  background: #176b58;
  font-weight: 700;
}

.send-button:hover {
  background: #105544;
}

.send-button:disabled {
  cursor: wait;
  opacity: .65;
}

.composer-hint {
  margin: 0 6px;
  color: #6a8078;
  font-size: .78rem;
  line-height: 1.4;
}

.debug-panel {
  margin-bottom: 8px;
}

@media (max-width: 640px) {
  .chat-panel {
    min-height: calc(100vh - 210px);
  }

  .chat-heading,
  .chat-panel .messages,
  .chat-panel .message-form {
    padding-left: 16px;
    padding-right: 16px;
  }

  .message-row {
    max-width: 94%;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .send-button {
    justify-self: end;
  }
}
