*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 8px;
  --transition: 0.18s ease;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  /* Neutral palette */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;

  /* Condition palettes */
  --c1-primary: #1e3a8a;
  --c1-accent: #dc2626;
  --c1-light: #eff6ff;
  --c2-primary: #6d28d9;
  --c2-accent: #0d9488;
  --c2-light: #f5f3ff;
  --c3-primary: #166534;
  --c3-accent: #374151;
  --c3-light: #f0fdf4;

  --accent: #2563eb;
  --accent-light: #eff6ff;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ── */
.page { display: none; min-height: 100vh; }
.page.active { display: flex; flex-direction: column; }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

.container-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  gap: 0.5rem;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.3; }
h2 { font-size: 1.375rem; font-weight: 600; line-height: 1.35; }
h3 { font-size: 1.125rem; font-weight: 600; }
p { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

/* ── Header ── */
.study-header {
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.study-header .logo { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); }
.progress-bar {
  height: 3px;
  background: var(--border);
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* ── Page 1: Consent ── */
.consent-header { text-align: center; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.institution { font-size: 0.8125rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.consent-body { margin-bottom: 1.5rem; }
.consent-item {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
  color: var(--text-muted);
}
.consent-item:last-child { border-bottom: none; }
.consent-item svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.consent-check {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--accent-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
}
.consent-check input { width: 1.125rem; height: 1.125rem; cursor: pointer; }
.study-meta {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.meta-item { font-size: 0.875rem; color: var(--text-muted); }
.meta-item strong { color: var(--text); font-weight: 600; display: block; }

/* ── Page 2: Survey ── */
.survey-section { margin-bottom: 2rem; }
.survey-section h3 { margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.likert-item { margin-bottom: 1.25rem; }
.likert-label { font-size: 0.9375rem; margin-bottom: 0.625rem; display: block; }
.likert-scale {
  display: flex; gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.likert-scale label {
  flex: 1; text-align: center;
  padding: 0.5rem 0.25rem;
  cursor: pointer;
  border-right: 1px solid var(--border);
  font-size: 0.8125rem;
  transition: var(--transition);
  position: relative;
}
.likert-scale label:last-child { border-right: none; }
.likert-scale input[type=radio] { position: absolute; opacity: 0; width: 0; }
.likert-scale label:has(input:checked) { background: var(--accent); color: #fff; }
.likert-scale label:hover:not(:has(input:checked)) { background: var(--bg); }
.likert-anchors { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Open-ended review textarea */
.review-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.875rem;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--surface);
  resize: vertical;
  min-height: 5.5rem;
  transition: border-color var(--transition);
}
.review-textarea:focus { outline: none; border-color: var(--accent); }
.review-textarea::placeholder { color: var(--text-light); }

/* Star rating */
.star-item { margin-bottom: 0.25rem; }
.star-rating { display: flex; gap: 0.4rem; margin: 0.25rem 0 0.5rem; }
.star {
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--border);
  transition: color var(--transition), transform var(--transition);
  user-select: none;
}
.star:hover { transform: scale(1.08); }
.star.hover { color: #f5b301; }
.star.filled { color: #f5a623; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; }
.form-group input, .form-group select {
  width: 100%; padding: 0.5rem 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.9375rem; font-family: var(--font);
  background: var(--surface);
  transition: var(--transition);
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.binary-group { display: flex; gap: 0.5rem; }
.binary-group label {
  flex: 1; text-align: center;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: var(--transition);
  position: relative;
}
.binary-group input[type=radio] { position: absolute; opacity: 0; }
.binary-group label:has(input:checked) { background: var(--accent); color: #fff; border-color: var(--accent); }
.binary-group-stacked { flex-direction: column; }
.binary-group-stacked label { text-align: left; }

/* ── Page 3: Condition intro ── */
.cond-card {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  max-width: 640px;
  margin: 0 auto;
}
.cond-header {
  padding: 2rem;
  text-align: center;
}
.cond-logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}
.cond-tagline { font-size: 0.875rem; opacity: 0.8; }

/* Condition 1 — RetailCorp */
.cond-1 .cond-header { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); color: #fff; }
.cond-1 .cond-logo span { color: #fca5a5; }
.cond-1 .btn-cond { background: #1e3a8a; color: #fff; }
.cond-1 .btn-cond:hover { background: #1e40af; }

/* Condition 2 — AssistAI */
.cond-2 .cond-header { background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%); color: #fff; }
.cond-2 .cond-logo span { color: #5eead4; }
.cond-2 .btn-cond { background: #6d28d9; color: #fff; }
.cond-2 .btn-cond:hover { background: #7c3aed; }

/* Condition 3 — Jamie */
.cond-3 .cond-header { background: linear-gradient(135deg, #14532d 0%, #166534 100%); color: #fff; }
.cond-3 .cond-logo span { color: #86efac; }
.cond-3 .btn-cond { background: #166534; color: #fff; }
.cond-3 .btn-cond:hover { background: #15803d; }

.cond-body { padding: 2rem; }
.cond-body p { color: var(--text-muted); line-height: 1.7; }
.cond-footer { padding: 1.5rem 2rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 1.25rem; }
.cond-prolific { display: flex; flex-direction: column; gap: 0.5rem; }
.cond-prolific label { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.prolific-input { padding: 0.625rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9375rem; font-family: inherit; color: var(--text); }
.prolific-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.prolific-error { font-size: 0.8125rem; color: #dc2626; margin: 0; }
.cond-footer .btn-cond { align-self: flex-end; }

/* ── Page 4: Pre-bias ── */
.single-question {
  max-width: 640px; margin: 0 auto;
  text-align: center;
}
.single-question .q-text {
  font-size: 1.125rem; margin-bottom: 2rem; color: var(--text); line-height: 1.6;
}
.likert-vertical {
  display: flex; flex-direction: column; gap: 0.5rem;
  text-align: left; margin-bottom: 2rem;
}
.likert-vertical label {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}
.likert-vertical label:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
.likert-vertical input[type=radio] { width: 1rem; height: 1rem; accent-color: var(--accent); }

/* ── Page 5: Shopping task ── */
.shopping-layout {
  display: grid;
  grid-template-columns: 40% 60%;
  height: calc(100vh - 120px);
  gap: 0;
  border-top: 1px solid var(--border);
}

.catalogue-pane {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.catalogue-search {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.catalogue-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font);
}
.catalogue-search input:focus { outline: none; border-color: var(--accent); }
.catalogue-filters {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.filter-group { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.filter-chip {
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.3rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  line-height: 1.2;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 5px rgba(37,99,235,0.4);
}
.filter-chip.active:hover { color: #fff; }
.catalogue-grid {
  flex: 1; overflow-y: auto;
  padding: 0.75rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex; gap: 0.75rem; align-items: flex-start;
}
.product-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(37,99,235,0.1); }
.product-icon {
  width: 48px; height: 48px; flex-shrink: 0;
  background: var(--bg); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.product-info { flex: 1; min-width: 0; }
.product-name { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.125rem; }
.product-price { font-size: 0.875rem; font-weight: 700; color: var(--accent); }
.product-tier {
  display: inline-block; font-size: 0.6875rem; font-weight: 500;
  padding: 0.125rem 0.375rem; border-radius: 3px; margin-left: 0.375rem;
}
.tier-premium { background: #fef3c7; color: #92400e; }
.tier-mid { background: #d1fae5; color: #065f46; }
.tier-budget { background: #f3f4f6; color: #4b5563; }
.product-stars { font-size: 0.75rem; color: #f59e0b; }
.product-specs { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Chat pane ── */
.chat-pane {
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
.chat-header {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.75rem;
}
.chat-agent-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.chat-agent-name { font-size: 0.875rem; font-weight: 600; }
.chat-agent-status { font-size: 0.75rem; color: #10b981; }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 1rem;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.chat-msg { display: flex; gap: 0.625rem; }
.chat-msg.user { flex-direction: row-reverse; }
.msg-bubble {
  max-width: 80%; padding: 0.625rem 0.875rem;
  border-radius: 12px; font-size: 0.875rem; line-height: 1.5;
}
.chat-msg.agent .msg-bubble { background: var(--bg); color: var(--text); }
.chat-msg.user .msg-bubble { background: var(--accent); color: #fff; }
.msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0; align-self: flex-end;
}
.chat-msg.agent .msg-avatar { background: var(--bg); color: var(--text-muted); }
.chat-msg.user .msg-avatar { background: #bfdbfe; color: #1e40af; }

.typing-indicator {
  display: flex; align-items: center; gap: 4px; padding: 0.625rem 0.875rem;
}
.typing-indicator span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted); animation: typing 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); } 30% { opacity: 1; transform: scale(1); } }

.chat-input-area {
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--border);
  display: flex; gap: 0.625rem;
}
.chat-input-area textarea {
  flex: 1; padding: 0.625rem 0.875rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.875rem; font-family: var(--font);
  resize: none; line-height: 1.5; max-height: 100px;
}
.chat-input-area textarea:focus { outline: none; border-color: var(--accent); }
.chat-send-btn {
  padding: 0.625rem 1rem;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius);
  cursor: pointer; font-size: 0.875rem; font-weight: 500;
  transition: var(--transition); white-space: nowrap;
}
.chat-send-btn:hover:not(:disabled) { background: #1d4ed8; }
.chat-send-btn:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }

.shopping-continue-bar {
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.rec-status { font-size: 0.8125rem; color: var(--text-muted); }
.rec-status.received { color: #10b981; font-weight: 500; }

/* ── Page 6: Choice ── */
.choice-options { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.choice-option {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
}
.choice-option:hover { border-color: var(--accent); }
.choice-option.selected { border-color: var(--accent); background: var(--accent-light); }
.choice-option h4 { font-size: 1rem; margin-bottom: 0.25rem; }
.choice-option p { font-size: 0.875rem; color: var(--text-muted); margin: 0; }

.choice-catalogue { margin-top: 1.5rem; }
.choice-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.choice-product-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.choice-product-card:hover { border-color: var(--accent); }
.choice-product-card.selected { border-color: var(--accent); background: var(--accent-light); }
.choice-product-card .name { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.25rem; }
.choice-product-card .price { font-size: 0.875rem; color: var(--accent); font-weight: 700; }

/* ── Page 7: Delegation ── */
.slider-container { margin: 2rem 0; }
.slider-input {
  width: 100%; -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 3px; background: var(--border);
  outline: none; cursor: pointer;
}
.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px;
  border-radius: 50%; background: var(--accent);
  border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2); cursor: pointer;
}
/* No preselected value: hide the thumb until the participant interacts */
.slider-input.unset::-webkit-slider-thumb { opacity: 0; }
.slider-input.unset::-moz-range-thumb { opacity: 0; border-color: transparent; background: transparent; }
.slider-anchors { display: flex; justify-content: space-between; margin-top: 1rem; }
.slider-anchor { font-size: 0.75rem; color: var(--text-muted); max-width: 18%; text-align: center; }
.slider-value-display {
  text-align: center; font-size: 2.5rem; font-weight: 700;
  color: var(--accent); margin: 1rem 0;
}
.slider-value-display.unset {
  font-size: 1rem; font-weight: 500; color: var(--text-muted);
}

/* ── Page 8: Post-measures ── */
.measure-block { margin-bottom: 2rem; }
.measure-block h3 { margin-bottom: 1.25rem; }

/* ── Page 9: Debrief ── */
.debrief-card { text-align: center; }
.completion-code {
  background: var(--bg); border: 2px dashed var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  font-size: 1.5rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--accent); margin: 1.5rem 0;
}
.debrief-icon { font-size: 3rem; margin-bottom: 1rem; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: 12px;
  max-width: 540px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96);
  transition: transform 0.2s ease;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-start;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.25rem; padding: 0.25rem;
}
.modal-body { padding: 1.5rem; }
.spec-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.spec-table td { padding: 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.spec-table td:first-child { color: var(--text-muted); width: 45%; }
.spec-table td:last-child { font-weight: 500; }
.review-excerpt { font-style: italic; color: var(--text-muted); font-size: 0.875rem; padding: 0.75rem; background: var(--bg); border-radius: var(--radius); margin-top: 0.75rem; }

/* ── Admin ── */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.stat-card .value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-card .label { font-size: 0.875rem; color: var(--text-muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.625rem 0.875rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
th { font-weight: 600; background: var(--bg); }
.export-links { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.export-link { padding: 0.5rem 1rem; background: var(--accent); color: #fff; border-radius: var(--radius); text-decoration: none; font-size: 0.875rem; }

/* ── Alert ── */
.alert { padding: 0.875rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-info { background: var(--accent-light); border: 1px solid #bfdbfe; color: #1e40af; }

/* ── Condition-specific chat header colours ── */
.cond-color-1 { background: var(--c1-primary); }
.cond-color-2 { background: var(--c2-primary); }
.cond-color-3 { background: var(--c3-primary); }

/* ── Utility ── */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.gap-1 { gap: 0.25rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .shopping-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .catalogue-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 50vh;
  }
  .chat-pane { min-height: 60vh; }
  h1 { font-size: 1.375rem; }
  .form-row { grid-template-columns: 1fr; }
  .study-meta { flex-direction: column; gap: 0.75rem; }
}

/* ── Cart flow (page 5 add-to-cart + page 6 cart completion) ── */
.cart-indicator {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.cart-indicator.cart-pop { transform: scale(1.18); border-color: var(--accent); color: var(--accent); }
.cart-count {
  position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-size: 0.6875rem; font-weight: 700;
  border-radius: 999px; line-height: 1;
}
.cart-count.bump { animation: cart-bump 0.35s ease; }
@keyframes cart-bump { 0% { transform: scale(0.4); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }

.fly-to-cart {
  position: fixed; z-index: 9999; pointer-events: none;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  transform: translate(-50%, -50%);
  transition: left 0.62s cubic-bezier(0.5, -0.2, 0.5, 1), top 0.62s cubic-bezier(0.5, -0.2, 0.5, 1), opacity 0.62s ease, transform 0.62s ease;
}

/* In-chat recommendation add-to-cart card */
.chat-rec-card {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 0.25rem 0 0.5rem 38px; padding: 0.75rem;
  background: var(--accent-light); border: 1px solid #bfdbfe; border-radius: var(--radius);
}
.chat-rec-icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: var(--radius); background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--accent); }
.chat-rec-info { flex: 1; min-width: 0; }
.chat-rec-name { font-weight: 600; font-size: 0.875rem; }
.chat-rec-price { font-size: 0.8125rem; color: var(--accent); font-weight: 700; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8125rem; }

/* Modal add-to-cart note */
.modal-cart-note { margin-top: 0.5rem; text-align: center; font-size: 0.75rem; color: var(--text-muted); }

/* Cart completion page */
.cart-confirm-banner {
  display: flex; align-items: center; gap: 0.875rem;
  padding: 1rem 1.25rem; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: var(--radius);
  margin-bottom: 1.25rem;
}
.cart-check {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  background: #10b981; color: #fff; font-size: 1.25rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.cart-product-card { display: flex; gap: 1.25rem; align-items: flex-start; }
.cart-product-icon {
  flex-shrink: 0; width: 140px; height: 140px; border-radius: var(--radius);
  background: linear-gradient(145deg, var(--bg), #eef1f6);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.cart-product-body { flex: 1; min-width: 0; }
.cart-product-name { font-size: 1.0625rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.cart-product-price { font-size: 1.25rem; font-weight: 700; color: var(--accent); margin: 0.25rem 0; }
.cart-product-desc { font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; margin: 0.5rem 0 0.75rem; }
.cart-feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; }
.cart-feature-grid > div { display: flex; flex-direction: column; font-size: 0.8125rem; }
.cart-feature-grid span { color: var(--text-muted); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.03em; }
.cart-feature-grid strong { font-weight: 600; }

/* Floating assistant FAB + panel */
.assistant-fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1200;
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 1.1rem 0.6rem 0.6rem; border: none; cursor: pointer;
  background: var(--accent); color: #fff; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.assistant-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,0.22); }
.fab-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center; font-size: 0.8125rem; font-weight: 700;
}
.fab-label { font-size: 0.875rem; font-weight: 600; }

.assistant-panel {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1300;
  width: 360px; max-width: calc(100vw - 2rem); height: 480px; max-height: calc(100vh - 3rem);
  display: none; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.24);
}
.assistant-panel.open { display: flex; }
.assistant-panel .chat-messages { flex: 1; }
.assistant-panel-close {
  background: rgba(255,255,255,0.18); border: none; color: #fff; cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%; font-size: 0.875rem; flex-shrink: 0;
}
.assistant-panel-close:hover { background: rgba(255,255,255,0.32); }

@media (max-width: 768px) {
  .cart-product-card { flex-direction: column; align-items: center; text-align: center; }
  .cart-product-icon { width: 120px; height: 120px; }
  .cart-feature-grid { text-align: left; }
  .assistant-panel { right: 1rem; left: 1rem; width: auto; }
}

/* FAB condition colours need to beat the base .assistant-fab background (defined later). */
.assistant-fab.cond-color-1 { background: var(--c1-primary); }
.assistant-fab.cond-color-2 { background: var(--c2-primary); }
.assistant-fab.cond-color-3 { background: var(--c3-primary); }
/* The choice is locked once on the cart page, so don't show the add action in the panel. */
.assistant-panel .chat-rec-card { display: none; }
