:root {
  color: #18212f;
  background: #edf1f5;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

button,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  min-height: 100vh;
  place-content: center;
  padding: 24px;
}

.chat {
  display: grid;
  width: min(440px, calc(100vw - 32px));
  height: min(720px, calc(100vh - 80px));
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  border: 1px solid #d9e0e7;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 70px rgb(24 33 47 / 14%);
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e7ebef;
}

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: #18212f;
  font-weight: 750;
}

h1 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.new-chat {
  margin-left: auto;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  color: #52606f;
  background: #f1f4f7;
  cursor: pointer;
  font-size: 11px;
}

.setup {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  color: #66717f;
  text-align: center;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #e1e6eb;
  border-top-color: #f0a500;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.messages {
  overflow-y: auto;
  padding: 18px;
  background: #f7f8fa;
}

.message {
  display: flex;
  margin: 8px 0;
}

.message.customer {
  justify-content: flex-end;
}

.bubble {
  max-width: 78%;
  padding: 10px 12px 7px;
  border-radius: 15px 15px 15px 4px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(24 33 47 / 8%);
}

.customer .bubble {
  border-radius: 15px 15px 4px;
  background: #ffd46b;
}

.bubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.45;
}

.bubble time {
  display: block;
  margin-top: 3px;
  color: #6e7885;
  font-size: 10px;
  text-align: right;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid #e7ebef;
}

.conversation-state {
  margin: 0;
  padding: 14px 18px;
  border-top: 1px solid #e7ebef;
  color: #66717f;
  background: #fff;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  padding: 10px 13px;
  border: 1px solid #d8dfe6;
  border-radius: 13px;
  outline: none;
  line-height: 20px;
}

.composer textarea:focus {
  border-color: #f0a500;
  box-shadow: 0 0 0 3px rgb(240 165 0 / 12%);
}

.composer button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: #18212f;
  cursor: pointer;
  font-size: 19px;
}

.error {
  min-height: 0;
  margin: 0;
  padding: 0 14px 8px;
  color: #c93434;
  background: #fff;
  font-size: 12px;
}

.error:empty {
  display: none;
}

.hint {
  margin: 12px 0 0;
  color: #788391;
  font-size: 12px;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  .shell {
    display: block;
    padding: 0;
  }

  .chat {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .hint {
    display: none;
  }
}
