:root {
  --ink: #3d2d31;
  --muted: #7b686d;
  --soft-white: #fffdfb;
  --cream: #fff8f4;
  --blush: #f6e2df;
  --blush-deep: #e5b5b2;
  --rose: #a85f6c;
  --rose-dark: #7e4350;
  --plum: #60424f;
  --gold: #b99359;
  --gold-light: #dec89d;
  --line: rgba(92, 60, 67, .18);
  --shadow: 0 28px 80px rgba(69, 42, 48, .28);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(231, 184, 181, .36), transparent 35%),
    linear-gradient(135deg, #f9efeb, #f3e3de);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.assistant-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 5;
  border: 1px solid var(--gold-light);
  border-radius: 999px;
  padding: 12px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--rose), var(--rose-dark));
  box-shadow: 0 14px 36px rgba(126, 67, 80, .25);
  font-weight: 700;
}

.assistant-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.assistant-shell:not(.is-open) {
  display: none;
}

.assistant-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(53, 37, 42, .56);
  backdrop-filter: blur(7px);
}

.assistant-panel {
  position: relative;
  width: min(680px, 100%);
  max-height: calc(100vh - 36px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: var(--radius-lg);
  background: var(--cream);
  box-shadow: var(--shadow);
}

.assistant-scroll {
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 67, 80, .42) transparent;
}

.assistant-scroll::-webkit-scrollbar,
.chat-log::-webkit-scrollbar {
  width: 8px;
}

.assistant-scroll::-webkit-scrollbar-track,
.chat-log::-webkit-scrollbar-track {
  background: transparent;
}

.assistant-scroll::-webkit-scrollbar-thumb,
.chat-log::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(126, 67, 80, .42);
  background-clip: padding-box;
}

.assistant-reset {
  position: absolute;
  top: 14px;
  right: 60px;
  z-index: 4;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 50%;
  color: #fff;
  background: rgba(61, 45, 49, .4);
  font-size: 1.28rem;
  line-height: 1;
}

.assistant-reset:hover,
.assistant-close:hover {
  background: rgba(61, 45, 49, .56);
}

.assistant-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 50%;
  color: #fff;
  background: rgba(61, 45, 49, .4);
  font-size: 1.7rem;
  line-height: 1;
}

.assistant-hero {
  position: relative;
  height: 255px;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: #efd9ce;
}

.assistant-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(63, 43, 49, .72), transparent 65%);
}

.assistant-hero img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
  transform: none;
}

.assistant-hero__overlay {
  position: absolute;
  z-index: 2;
  left: 34px;
  bottom: 24px;
  color: #fff;
}

.assistant-hero__overlay p,
.report-kicker {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .78rem;
  font-weight: 700;
}

.assistant-hero h1,
.assistant-content h2 {
  font-family: "Playfair Display", serif;
}

.assistant-hero h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4.4vw, 2.55rem);
  line-height: 1.02;
}

.assistant-content {
  padding: 24px 30px 30px;
}

.assistant-content h2 {
  margin: 0 0 24px;
  font-size: 1.64rem;
  line-height: 1.1;
}

.field-group {
  margin-bottom: 22px;
}

.field-group > label,
.topic-fieldset legend {
  display: block;
  margin-bottom: 10px;
  font-size: 1.08rem;
  font-weight: 700;
}

.repeat-fields {
  display: grid;
  gap: 9px;
  width: min(100%, 400px);
}

.repeat-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--soft-white);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  font-size: 1rem;
}

input {
  height: 44px;
  padding: 0 13px;
}

textarea {
  min-height: 76px;
  padding: 12px 13px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(185, 147, 89, .13);
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--gold-light);
  border-radius: var(--radius-sm);
  color: var(--rose-dark);
  background: linear-gradient(180deg, #fffdf9, #f3e6d6);
  font-size: 1.38rem;
  font-weight: 800;
}

.icon-button.remove-field {
  color: var(--rose-dark);
  border-color: rgba(168, 95, 108, .28);
  background: #fff5f4;
}

.icon-button:disabled {
  opacity: .42;
}

.topic-fieldset {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
}

.topic-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.topic-pills button {
  border: 1px solid var(--gold-light);
  border-radius: 999px;
  padding: 10px 15px;
  color: #5e463d;
  background: #fffaf1;
  transition: transform .16s, border-color .16s, background .16s;
  font-size: 1.02rem;
}

.topic-pills button:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: var(--gold);
}

.topic-pills button:disabled {
  opacity: .4;
}

.topic-pills button.is-selected {
  color: #fff;
  border-color: var(--rose);
  background: var(--rose);
}

.question-group {
  width: min(100%, 560px);
  margin-bottom: 18px;
}

.primary-button {
  width: max-content;
  min-width: 112px;
  min-height: 44px;
  font-size: 1.05rem;
  border: 1px solid var(--rose-dark);
  border-radius: var(--radius-sm);
  padding: 0 22px;
  color: #fff;
  background: linear-gradient(135deg, var(--rose), var(--rose-dark));
  box-shadow: 0 11px 24px rgba(126, 67, 80, .18);
  font-weight: 700;
}

.primary-button:disabled {
  opacity: .55;
}

.report-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--soft-white);
  box-shadow: 0 14px 34px rgba(87, 58, 65, .08);
}

.report-header {
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(246, 226, 223, .95), rgba(255, 248, 244, .96));
}

.report-kicker {
  color: var(--rose-dark);
}

.report-header h2 {
  margin: 4px 0 0;
  font-size: 2rem;
}

.report-disclaimer {
  margin: 0;
  padding: 13px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #fffaf6;
  font-size: .88rem;
  line-height: 1.45;
}

.report-body {
  padding: 22px 24px 26px;
  font-size: 1rem;
  line-height: 1.58;
}

.report-body > :first-child {
  margin-top: 0;
}

.report-section + .report-section {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.report-section--summary h3 {
  color: var(--rose-dark);
}

.report-section--summary p {
  font-size: 1rem;
}

.report-body h3 {
  margin: 0 0 12px;
  color: var(--rose-dark);
  font-size: 1.38rem;
  line-height: 1.22;
}

.report-body h4 {
  margin: 18px 0 8px;
  color: var(--plum);
  font-size: 1.08rem;
}

.report-body p {
  margin: 0 0 12px;
}

.report-body strong {
  color: var(--plum);
}

.report-body ul {
  margin: 8px 0 0;
  padding-left: 21px;
}

.report-body li {
  margin: 0 0 4px;
  padding-left: 3px;
  line-height: 1.32;
}

.report-body li::marker {
  color: var(--rose);
}

.report-body a {
  color: var(--rose-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 600;
}

.report-body a:hover {
  color: var(--plum);
}

.report-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.report-body table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  font-size: .92rem;
}

.report-body th,
.report-body td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.report-body th {
  color: var(--plum);
  background: var(--blush);
  font-weight: 700;
}

.report-body tr:last-child td {
  border-bottom: 0;
}

.interaction-note {
  margin: 10px 0 0;
  color: #7b686d;
  font-size: .88rem;
  line-height: 1.4;
  font-style: italic;
}

.risk-badge {
  display: inline-block;
  min-width: 64px;
  padding: 3px 8px;
  border-radius: 999px;
  text-align: center;
  font-weight: 800;
  font-size: .82rem;
  line-height: 1.2;
}

.risk-badge--high {
  color: #7a1f2a;
  background: #f8d6d9;
  border: 1px solid rgba(122, 31, 42, .22);
}

.risk-badge--moderate {
  color: #875a18;
  background: #fff1d6;
  border: 1px solid rgba(135, 90, 24, .24);
}

.risk-badge--low {
  color: #326247;
  background: #e3f3ea;
  border: 1px solid rgba(50, 98, 71, .22);
}

.risk-badge--neutral {
  color: var(--plum);
  background: #f4ecef;
  border: 1px solid var(--line);
}

.report-body .report-callout {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-left: 4px solid var(--rose);
  background: var(--blush);
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.export-button {
  border: 1px solid var(--gold-light);
  border-radius: 999px;
  padding: 8px 15px;
  color: var(--rose-dark);
  background: rgba(255, 255, 255, .82);
  font-weight: 700;
}

.chat-card {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--soft-white);
}

.chat-card__header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff8f4;
  font-size: 1rem;
}

.chat-log {
  min-height: 150px;
  max-height: 320px;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 67, 80, .42) transparent;
}

.message {
  width: fit-content;
  max-width: min(84%, 520px);
  padding: 11px 13px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 1.02rem;
}

.message p {
  margin: 0 0 8px;
}

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

.message ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.message li {
  margin-bottom: 4px;
}

.message a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 700;
}

.message--assistant {
  justify-self: start;
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  background: var(--blush);
}

.message--user {
  justify-self: end;
  border-bottom-right-radius: 4px;
  color: #fff;
  background: var(--plum);
}

.chat-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #fff8f4;
}

.chat-composer textarea {
  min-height: 44px;
  max-height: 120px;
  resize: none;
}

.chat-composer button {
  min-width: 76px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  color: #fff;
  background: var(--rose);
  font-weight: 700;
}

.loading-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 30px;
  text-align: center;
  background: rgba(255, 248, 244, .93);
  backdrop-filter: blur(5px);
  border-radius: var(--radius-lg);
}

.loading-layer p {
  font-size: 1rem;
}

.loading-mark {
  display: flex;
  gap: 8px;
}

.loading-mark span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rose);
  animation: pulse 1s infinite ease-in-out;
}

.loading-mark span:nth-child(2) {
  animation-delay: .14s;
}

.loading-mark span:nth-child(3) {
  animation-delay: .28s;
}

@keyframes pulse {
  0%,
  80%,
  100% {
    transform: scale(.7);
    opacity: .45;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.is-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: 720px) {
  .assistant-shell {
    padding: 0;
    align-items: stretch;
  }

  .assistant-panel,
  .assistant-scroll {
    max-height: 100vh;
    border-radius: 0;
  }

  .assistant-hero {
    height: 226px;
    border-radius: 0;
  }

  .assistant-content {
    padding: 22px 16px max(96px, calc(env(safe-area-inset-bottom) + 72px));
  }

  #startAssistant {
    margin-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .assistant-hero__overlay {
    left: 20px;
    bottom: 20px;
  }

  .assistant-content h2,
  .report-header h2 {
    font-size: 1.52rem;
  }

  .assistant-hero h1 {
    font-size: clamp(1.62rem, 8.2vw, 2.12rem);
  }

  .repeat-fields,
  .question-group {
    width: 100%;
  }

  .report-header,
  .report-body,
  .report-disclaimer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .message {
    max-width: 92%;
  }
}


/* Direct-download PDF layout */
.pdf-report {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 816px;
  min-height: 1056px;
  overflow: visible;
  color: #3d2d31;
  background: #fff;
  font: 14px/1.45 Arial, sans-serif;
}

.pdf-hero {
  position: relative;
  height: 220px;
  overflow: hidden;
  background: #efd9ce url("pharmacyWelcome.png") top center / cover no-repeat;
}

.pdf-hero img {
  display: none;
}

.pdf-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(63, 43, 49, .72), transparent 68%);
}

.pdf-hero__text {
  position: absolute;
  z-index: 2;
  left: 24px;
  bottom: 18px;
  color: #fff;
}

.pdf-hero__text small {
  display: block;
  margin-bottom: 3px;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 700;
}

.pdf-hero__text h1 {
  margin: 0;
  font: 700 30px Georgia, serif;
}

.pdf-disclaimer { margin: 0; padding: 10px 22px; border: 1px solid #e4d8d5; border-top: 0; color: #7b686d; background: #fffaf6; font-size: 12px; }
.pdf-body { padding: 4px 22px 20px; border: 1px solid #e4d8d5; border-top: 0; font-size: 13px; }
.pdf-body .report-section--summary p { font-size: 13px; }
.pdf-body .report-section { break-inside: avoid; padding-top: 18px; }
.pdf-body .report-section + .report-section { margin-top: 14px; border-top: 1px solid #e4d8d5; }
.pdf-body h3 { margin: 0 0 8px; color: #7e4350; font-size: 18px; }
.pdf-body h4 { margin: 12px 0 5px; color: #60424f; font-size: 13px; }
.pdf-body p { margin: 0 0 8px; }
.pdf-body ul { margin: 7px 0 0; padding-left: 20px; }
.pdf-body li { margin-bottom: 2px; line-height: 1.24; }
.pdf-body a { color: #7e4350; text-decoration: underline; font-weight: 700; }
.pdf-body .report-table-wrap { overflow: visible; margin-top: 10px; border: 1px solid #e4d8d5; border-radius: 8px; }
.pdf-body table { width: 100%; min-width: 0; border-collapse: collapse; font-size: 11px; }
.pdf-body th, .pdf-body td { padding: 8px 9px; border-bottom: 1px solid #e4d8d5; text-align: left; vertical-align: top; }
.pdf-body th { background: #f6e2df; }
.pdf-body tr:last-child td { border-bottom: 0; }
.pdf-body .interaction-note { margin: 8px 0 0; color: #7b686d; font-size: 11px; line-height: 1.35; font-style: italic; }

.pdf-body .risk-badge { display: inline-block; min-width: 54px; padding: 2px 6px; border-radius: 999px; text-align: center; font-weight: 700; font-size: 10px; line-height: 1.2; }
.pdf-body .risk-badge--high { color: #7a1f2a; background: #f8d6d9; border: 1px solid rgba(122, 31, 42, .22); }
.pdf-body .risk-badge--moderate { color: #875a18; background: #fff1d6; border: 1px solid rgba(135, 90, 24, .24); }
.pdf-body .risk-badge--low { color: #326247; background: #e3f3ea; border: 1px solid rgba(50, 98, 71, .22); }
.pdf-body .risk-badge--neutral { color: #60424f; background: #f4ecef; border: 1px solid #e4d8d5; }
.pdf-body .report-callout { padding: 10px 12px; border-left: 4px solid #a85f6c; background: #f6e2df; }
.pdf-footer { margin: 12px 0 0; text-align: left; color: #7b686d; font-size: 11px; }
