:root {
  --green-900: #123524;
  --gold: #d9bb72;
  --sand-200: #efe6d3;
  --line: #d7ddcf;
  --muted: #5a675a;
  --shadow: 0 14px 34px rgba(17, 37, 22, 0.12);
  --header-gradient-start: #00363a;
  --header-gradient-end: #006c60;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: #f5f7f4;
  color: #1b241d;
}

.shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 16px;
}

.chat-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
  height: min(72vh, 820px);
  min-height: 640px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.chat-header {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px 22px;
  background: linear-gradient(90deg, var(--header-gradient-start), var(--header-gradient-end));
  color: #fff;
}

.brand-logo {
  max-width: 86px;
  max-height: 54px;
}

.chat-header h1 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.1;
}

.reset-conversation {
  margin-left: auto;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.reset-conversation:hover {
  background: rgba(255, 255, 255, 0.2);
}

.reset-conversation:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.reset-conversation:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chat-header p {
  margin: 4px 0 0;
  font-size: 0.95rem;
  opacity: 0.92;
}

.messages {
  min-height: 0;
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.message {
  display: flex;
  gap: 10px;
  max-width: 100%;
}

.message > div:last-child {
  min-width: 0;
  max-width: 100%;
}

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

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d9dfd1;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bubble {
  max-width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  background: #eff4ec;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bubble p,
.bubble ul,
.bubble ol,
.bubble li,
.bubble h1,
.bubble h2,
.bubble h3,
.bubble code,
.bubble a,
.bubble strong,
.bubble em {
  max-width: 100%;
}

.message.user .bubble {
  background: #e6f0ea;
}

time {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: #6b756d;
}

.composer {
  display: flex;
  gap: 10px;
  padding: 18px 22px;
  border-top: 1px solid #edf0ea;
}

.composer textarea {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  font: inherit;
  resize: none;
}

.composer button,
.feedback,
.dialog-actions .primary {
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: var(--green-900);
  font-weight: 800;
  padding: 12px 18px;
  cursor: pointer;
}

.composer button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.info-card {
  background: #fcfcfc;
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.info-toggle {
  list-style: none;
  width: 100%;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
}

.info-toggle::-webkit-details-marker {
  display: none;
}

.info-toggle-text {
  display: grid;
  gap: 2px;
}

.info-title {
  font-weight: 700;
}

.info-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
}

.info-card:not([open]) .info-subtitle {
  display: none;
}

.info-content {
  padding: 0 16px 12px 68px;
}

.info-content p {
  margin: 0;
}

.info-chevron {
  font-size: 2cap;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.info-card[open] .info-chevron {
  transform: rotate(180deg);
}

.accent {
  width: 6px;
  height: 100%;
  min-height: 40px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d9bb72, #8eaa5a);
}

.info-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eaf2f7;
  color: #1b6c9e;
  font-weight: 800;
}

.feedback {
  justify-self: center;
  background: var(--sand-200);
}

.feedback-dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}

.feedback-dialog::backdrop {
  background: rgba(10, 25, 14, 0.36);
}

.feedback-dialog form {
  padding: 22px;
  display: grid;
  gap: 12px;
}

.feedback-dialog textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  font: inherit;
}

.feedback-status {
  min-height: 1.25rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.feedback-status.error {
  color: #9f2d2d;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-actions #feedbackCancel {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f2f4ef;
  color: var(--muted);
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.dialog-actions #feedbackCancel:hover {
  background: #e6ebe2;
  color: var(--green-900);
}

.dialog-actions #feedbackCancel:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.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: 640px) {
  .shell {
    padding: 12px;
    gap: 12px;
  }

  .chat-card {
    height: min(74vh, 760px);
    min-height: 560px;
    border-radius: 18px;
  }

  .chat-header {
    gap: 10px;
    padding: 12px 14px;
  }

  .brand-logo {
    max-width: 60px;
    max-height: 38px;
  }

  .chat-header h1 {
    font-size: 1.2rem;
    line-height: 1.05;
  }

  .reset-conversation {
    width: 36px;
    height: 36px;
    justify-content: center;
    padding: 0;
    font-size: 1.1rem;
  }

  .reset-conversation-label {
    display: none;
  }

  .chat-header p {
    margin-top: 2px;
    font-size: 0.8rem;
  }

  .messages {
    padding: 14px;
  }

  .composer {
    padding: 12px 14px;
  }

  .info-card {
    padding: 0;
  }

  .info-toggle {
    gap: 8px;
    padding: 8px 12px;
  }

  .info-icon {
    width: 26px;
    height: 26px;
  }

  .accent {
    min-height: 48px;
  }

  .info-subtitle {
    display: none;
  }

  .info-content {
    padding: 0 12px 10px 46px;
  }
}
