:root {
  color-scheme: light;
  --leaf: #1f3327;
  --leaf-2: #315f42;
  --rose: #d85c72;
  --gold: #c58b37;
  --cream: #f6f1e8;
  --paper: #fffaf2;
  --line: #d9d2c5;
  --ink: #243026;
  --muted: #687166;
  --blue: #4d86c8;
  --green: #2f9d73;
  --shadow: 0 24px 70px rgba(35, 43, 33, 0.14);
  --soft-shadow: 0 16px 44px rgba(35, 43, 33, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(246, 241, 232, 0.94), rgba(238, 232, 220, 0.98)),
    radial-gradient(circle at 15% 20%, rgba(216, 92, 114, 0.12), transparent 32%),
    radial-gradient(circle at 85% 5%, rgba(47, 157, 115, 0.12), transparent 34%);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea,
select {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
  max-width: 1380px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

.assistant-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 132px;
  padding: 28px 34px;
  border-radius: 8px;
  background: var(--leaf);
  color: #fff7e8;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: #f0d59a;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0;
}

.topbar-subtitle {
  max-width: 680px;
  margin-top: 12px;
  color: rgba(255, 247, 232, 0.82);
  font-size: 16px;
  line-height: 1.7;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 42px;
  line-height: 1.08;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e4ecdf;
  font-size: 14px;
  font-weight: 650;
}

.status-pill span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #55d98c;
  box-shadow: 0 0 0 5px rgba(85, 217, 140, 0.16);
}

.status-pill a {
  color: inherit;
  text-decoration: none;
}

.chat-surface,
.quick-card,
.knowledge-card,
.product-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 250, 242, 0.86);
  box-shadow: var(--soft-shadow);
}

.chat-surface {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: calc(100vh - 198px);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
}

.chat-header h2,
.quick-card h2,
.knowledge-card h2,
.product-card h2 {
  font-size: 20px;
  line-height: 1.2;
}

.chat-header p {
  max-width: 780px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.chat-eyebrow {
  margin-bottom: 6px;
  color: var(--gold);
  font-size: 12px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  color: var(--leaf);
  cursor: pointer;
  font-size: 25px;
  font-weight: 800;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 420px;
  max-height: calc(100vh - 348px);
  overflow: auto;
  padding: 24px 26px;
}

.message {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  max-width: 850px;
}

.message.user {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr) 40px;
}

.message.loading .bubble {
  color: var(--muted);
  font-weight: 750;
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--leaf-2);
  color: white;
  font-weight: 850;
}

.user .avatar {
  grid-column: 2;
  grid-row: 1;
  background: var(--rose);
}

.bubble {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  color: #344136;
  line-height: 1.58;
}

.user .bubble {
  background: #fff3f5;
  border-color: #efc4cc;
}

.bubble strong {
  color: var(--leaf);
}

.bubble ul {
  margin: 8px 0 0;
  padding-left: 22px;
}

.bubble li + li {
  margin-top: 4px;
}

.customer-block {
  padding: 0 0 10px;
}

.customer-block + .customer-block {
  padding-top: 10px;
  border-top: 1px solid #eee5d8;
}

.customer-block strong {
  display: block;
  margin-bottom: 4px;
}

.customer-block p {
  color: #405044;
}

.image-diagnosis-response {
  display: grid;
  gap: 12px;
}

.image-diagnosis-response > strong {
  display: block;
  color: var(--leaf);
  font-size: 1.08rem;
}

.image-diagnosis-response section {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid #eee5d8;
  border-radius: 14px;
  background: #fffaf2;
}

.image-diagnosis-response h3 {
  margin: 0;
  color: var(--rose);
  font-size: 0.98rem;
}

.image-diagnosis-response p,
.image-diagnosis-response ul,
.image-diagnosis-response ol {
  margin: 0;
}

.image-diagnosis-response ol,
.image-diagnosis-response ul {
  padding-left: 22px;
}

.image-diagnosis-response li span {
  display: block;
  margin-top: 3px;
  color: #405044;
}

.symptom-illustrations {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.symptom-illustration {
  margin: 0;
  overflow: hidden;
  border: 1px solid #d9e7d5;
  border-radius: 8px;
  background: #fbfdf8;
}

.symptom-illustration img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: white;
}

.symptom-illustration figcaption {
  padding: 8px 10px;
  color: var(--leaf);
  font-weight: 800;
  font-size: 0.92rem;
  border-top: 1px solid #d9e7d5;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 12px;
  position: sticky;
  bottom: 0;
  padding: 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.96);
  backdrop-filter: blur(10px);
}

.composer-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.composer-actions {
  display: grid;
  grid-template-rows: 44px 1fr;
  gap: 10px;
}

.composer-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 15px;
  background: #ffffff;
  color: var(--ink);
  line-height: 1.5;
  outline: none;
}

textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 157, 115, 0.14);
}

.composer button {
  border: 0;
  border-radius: 18px;
  background: #b8324a;
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 100%;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.send-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(31, 51, 39, 0.18);
}

.composer button:disabled,
.quick-group button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

.composer button:disabled {
  background: #c9b8a0;
}

#imageUpload {
  display: none;
}

.attach-button,
.secondary-button {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  color: var(--leaf);
  cursor: pointer;
  font-weight: 800;
  text-align: center;
}

.upload-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}

.upload-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.upload-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.upload-item span {
  display: block;
  overflow: hidden;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: rgba(31, 51, 39, 0.82);
  color: white;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.rose-visual {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.quick-card,
.knowledge-card,
.product-card {
  padding: 20px;
}

.quick-topic-card {
  padding: 18px;
}

.quick-card-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(217, 210, 197, 0.78);
}

.quick-card-heading p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.quick-groups {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.quick-group {
  overflow: hidden;
  border: 1px solid rgba(217, 210, 197, 0.92);
  border-radius: 18px;
  background: #fff8ee;
}

.quick-group[open] {
  border-color: rgba(197, 139, 55, 0.48);
  box-shadow: 0 10px 28px rgba(35, 43, 33, 0.08);
}

.quick-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 56px;
  padding: 13px 15px;
  color: var(--leaf);
  cursor: pointer;
  font-weight: 850;
  list-style: none;
}

.quick-group summary span {
  display: grid;
  gap: 3px;
}

.quick-group summary strong {
  color: var(--leaf);
  font-size: 15px;
}

.quick-group summary small {
  color: #7a6d60;
  font-size: 12px;
  font-weight: 700;
}

.quick-group summary::-webkit-details-marker {
  display: none;
}

.quick-group summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff8ed;
  color: var(--gold);
  font-weight: 900;
}

.quick-group[open] summary::after {
  content: "-";
  color: var(--rose);
}

.quick-group-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(232, 216, 190, 0.92);
  background: #ffffff;
}

.quick-group-buttons button {
  min-height: 38px;
  border: 1px solid rgba(197, 139, 55, 0.32);
  border-radius: 999px;
  background: #fffaf2;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 13px;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.quick-group-buttons button:hover {
  border-color: var(--rose);
  background: var(--rose);
  color: #ffffff;
  transform: translateY(-1px);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.quick-grid button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
}

.quick-grid button:hover,
.icon-button:hover,
.composer button:hover,
.attach-button:hover,
.secondary-button:hover {
  filter: brightness(0.97);
}

.card-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.case-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.case-panel label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.case-panel select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
  outline: none;
}

.case-panel select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 157, 115, 0.14);
}

.case-summary {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #dbe7d6;
  border-radius: 8px;
  background: #f4f8f1;
  color: #415045;
  font-size: 13px;
  line-height: 1.45;
}

.case-summary strong {
  color: var(--leaf);
}

.secondary-button {
  width: 100%;
  background: var(--leaf-2);
  color: white;
}

.knowledge-card ul {
  margin: 13px 0 0;
  padding-left: 20px;
  color: #445046;
  line-height: 1.55;
}

.knowledge-card li + li {
  margin-top: 8px;
}

.product-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.product-list span {
  padding: 8px 10px;
  border-radius: 999px;
  background: #eef4eb;
  color: #31533b;
  font-size: 13px;
  font-weight: 760;
}

.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: 980px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
    padding: 24px;
  }

  h1 {
    font-size: 34px;
  }

  .chat-surface {
    min-height: 680px;
  }

  .messages {
    max-height: 520px;
  }
}

@media (max-width: 620px) {
  .composer {
    grid-template-columns: 1fr;
  }

  .composer-actions {
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: 48px;
  }

  .composer button,
  .attach-button {
    min-height: 48px;
  }

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

  .message,
  .message.user {
    grid-template-columns: 34px minmax(0, 1fr);
    max-width: 100%;
  }

  .message.user .avatar {
    grid-column: 1;
  }

  .avatar {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }
}

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