/* ================================================================
   builder.css — Allergy Card Builder page-specific styles
   Extracted from index.html inline <style> block.
   All design tokens inherit from /main.css — no standalone system.
   Do not add global styles here; scope everything to .ac-* classes
   or builder-specific selectors.
================================================================ */


/* ── UTILITY CLASSES ── */
/* Replaces inline style="display:none" throughout index.html and builder.js.
   Use classList.add/remove('u-hidden') to toggle visibility. */
.u-hidden { display: none !important; }

/* Semantic state utilities — prefer these over inline style.display toggles.
   .is-hidden  : visually and structurally removes an element (mirrors u-hidden but
                 without !important, so CSS specificity can override for modals/overlays)
   .is-open    : marks interactive disclosures (modals, dropdowns, accordions) as expanded
   .is-active  : marks the currently selected/focused item in a list or tab set
   .is-shown   : overrides a component-level display:none rule (e.g. inline error messages) */
.is-hidden { display: none; }
.is-open   {}          /* behaviour hook — appearance defined per component */
.is-active {}          /* behaviour hook — appearance defined per component */
.is-shown  { display: block; } /* overrides component-level display:none rules */

/* ── DOWNLOAD SPINNER OVERLAY ── */
/* Replaces inline style.cssText in the download function */
.ap-dl-spinner-host { position: relative; }
.ap-dl-spinner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  border-radius: inherit;
  z-index: 10;
}

/* ── FREE CONFIRM BOX ── */
/* Replaces inline styles on #freeConfirm in index.html */
.free-confirm-box {
  margin-top: 1.25rem;
  padding: 0.875rem 1rem;
  background: var(--linen-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--soil);
  line-height: 1.6;
}

/* ── PRINT BUTTON SIZE MODIFIER ── */
.btn--sm-text { font-size: 0.875rem; }

/* ============================================================
   ALLERGY CARD BUILDER — Page-specific styles
   All tokens from main.css. No standalone design system.
============================================================ */

/* ── DOWNLOAD RING SPINNER ── */
@keyframes ap-ring-spin { to { transform: rotate(360deg); } }
.ap-ring-spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(44,31,20,0.15);
  border-top-color: var(--bark);
  border-radius: 50%;
  animation: ap-ring-spin 0.75s linear infinite;
}

/* ── DEST INSIGHT PLACEHOLDER ── */
.dest-insight--placeholder {
  display: block !important;
  color: var(--soil);
  font-style: italic;
  font-size: 0.8125rem;
}

/* ── SCROLL-TRIGGERED ANIMATIONS ── */
.animate[data-animation] {
  opacity: 0;
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.animate[data-animation="fade-up"]   { transform: translateY(24px); }
.animate[data-animation="fade-left"] { transform: translateX(20px); }
.animate[data-animation].is-visible  { opacity: 1; transform: none; }

/* ── EXPORT ACTIONS FADE-IN ── */
#exportActions {
  transition: opacity 0.3s var(--ease);
}

/* ── FAQ styles defined below in the FAQ component section ── */


.allergen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.5rem;
}

.allergen-chip {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  transition: all 0.15s var(--ease);
  width: 100%;
  min-height: 52px;
}
.allergen-chip:hover {
  border-color: var(--clay);
  background: var(--clay-light);
}
.allergen-chip.selected {
  border-color: var(--clay);
  background: var(--clay-light);
  border-width: 2px;
}
.allergen-chip.selected .ac-chip-name { color: var(--clay-dark); font-weight: 700; }
.ac-chip-emoji { font-size: 1.25rem; flex-shrink: 0; }
.ac-chip-name  { font-size: 0.8125rem; font-weight: 500; color: var(--bark); line-height: 1.3; flex: 1; }
.ac-chip-check { width: 16px; height: 16px; border-radius: 50%; background: var(--clay); display: flex; align-items: center; justify-content: center; flex-shrink: 0; opacity: 0; transition: opacity 0.15s; }
.allergen-chip.selected .ac-chip-check { opacity: 1; }
.ac-chip-check::after { content: '✓'; color: #fff; font-size: 0.625rem; font-weight: 700; }

/* Medical allergen chips — red accent when selected */
.allergen-chip.medical.selected {
  border-color: var(--red);
  background: #fff5f5;
}
.allergen-chip.medical.selected .ac-chip-name { color: var(--red); }
.allergen-chip.medical.selected .ac-chip-check { background: var(--red); }
.allergen-chip.medical:hover {
  border-color: var(--red);
  background: #fff5f5;
}

/* ── DESTINATION GRID ── */
.dest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.625rem;
}

.dest-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 0.5rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: center;
  font-family: var(--font-body);
  transition: all 0.15s var(--ease);
  position: relative;
}
.dest-chip:hover { border-color: var(--clay); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(196,89,58,0.1); }
.dest-chip.selected { border-color: var(--clay); border-width: 2px; background: #fff; box-shadow: 0 0 0 3px rgba(var(--clay-rgb, 180,90,20),0.12); }
.dest-chip.selected .dest-chip__name { color: var(--bark); font-weight: 700; }
.dest-chip.selected .dest-chip__lang { color: var(--soil); }
.dest-chip__flag { width: 48px; height: 32px; object-fit: cover; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.15); display: block; }
.dest-chip__name { font-size: 0.75rem; font-weight: 600; color: var(--bark); line-height: 1.2; }
.dest-chip__lang { font-size: 0.6875rem; color: var(--soil); }
.dest-chip__badge {
  position: absolute; top: 6px; right: 6px;
  font-size: 0.5625rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 100px;
}
.dest-chip__badge--free { background: var(--clay-light); color: var(--clay); border: 1px solid var(--clay-mid); }
.dest-chip__badge--paid { background: #FFF6EC; color: var(--amber); border: 1px solid #FDE68A; }
.dest-chip.selected .dest-chip__badge--free { background: var(--linen-mid); color: var(--soil); border-color: var(--border); }
.dest-chip.selected .dest-chip__badge--paid { background: var(--linen-mid); color: var(--clay-dark); border-color: var(--border); }

/* ── CARD PREVIEW ── */
.card-preview-wrap {
  position: sticky;
  top: calc(var(--nav-h) + 1.5rem);
}

.allergy-card {
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(44,31,20,0.12);
  max-width: 340px;
  margin: 0 auto;
  font-family: var(--font-body);
}

.ac-banner {
  padding: 1.25rem 1.5rem;
  position: relative;
}
.ac-banner--ana { background: #CC0000; }
.ac-banner--sev { background: var(--amber); }
.ac-banner--int { background: var(--bark); }

.ac-banner-title { font-size: 1.15rem; font-weight: 900; color: #fff; line-height: 1.2; display: block; }
.ac-banner-sub   { font-size: 0.625rem; color: rgba(255,255,255,0.8); margin-top: 0.25rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; display: block; }

.ac-body { padding: 1rem 1.25rem; }
.ac-allergen-row {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--linen-mid);
}
.ac-allergen-row:last-of-type { border-bottom: none; }
.ac-allergen-icon { font-size: 1.25rem; flex-shrink: 0; }
.ac-allergen-local { font-size: 1.05rem; font-weight: 800; color: var(--bark); display: block; line-height: 1.15; }
.ac-allergen-rom   { font-size: 0.6rem; color: var(--soil); font-style: italic; display: block; }
.ac-allergen-en    { font-size: 0.7rem; color: var(--soil); display: block; margin-top: 0.1rem; }

.ac-instr {
  background: var(--linen-mid);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  margin-top: 0.75rem;
}
.ac-instr-local { font-size: 0.8rem; font-weight: 700; color: var(--bark); }
.ac-instr-en    { font-size: 0.625rem; color: var(--soil); margin-top: 0.125rem; }

.ac-footer {
  border-top: 1px solid var(--border);
  padding: 0.5rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ac-footer-v { font-size: 0.55rem; color: var(--soil); }
.ac-footer-b { font-family: var(--font-display); font-size: 0.7rem; color: var(--clay); font-weight: 700; }

/* empty state */
.preview-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--soil);
  font-size: 0.875rem;
  line-height: 1.7;
}
.preview-empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }

/* ── TOOL LAYOUT ── */
.tool-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 3rem;
  align-items: start;
}

/* ── SECTION GROUP ── */
.tool-group {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.tool-group__header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.875rem;
}
.tool-group__num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bark); color: #fff;
  font-size: 0.8125rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.tool-group__num--done {
  background: #16a34a;
}
.tool-group__num--done::after { content: '✓'; }
/* Step is available but not yet visited */
.tool-group__num--pending {
  background: var(--border);
  color: var(--soil);
}
/* Dim step 2 when step 1 is empty to hint at the expected order */
.tool-group--dimmed {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.tool-group__title { font-size: 1rem; font-weight: 700; color: var(--bark); }
.tool-group__sub   { font-size: 0.8125rem; color: var(--soil); margin-top: 0.125rem; }
.tool-group__body  { padding: 1.5rem; }

.clear-all-btn {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--soil);
  cursor: pointer;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.clear-all-btn:hover, .clear-all-btn:focus-visible {
  color: var(--clay-dark);
  text-decoration-color: currentColor;
}
.clear-all-btn:focus-visible { outline: 2px solid var(--bark); outline-offset: 1px; }

/* ── Optional extras (collapsible <details>) ──
   Lives below the preview/export actions, not in the sequential step flow.
   Reset native <summary> marker and add a custom chevron that rotates open. */
.tool-group--collapsible { margin-top: 1.5rem; margin-bottom: 0; }
.tool-group__header--summary {
  cursor: pointer;
  list-style: none;
  justify-content: space-between;
}
.tool-group__header--summary::-webkit-details-marker { display: none; }
.tool-group__header--summary::after {
  content: '';
  width: 10px; height: 10px;
  flex-shrink: 0;
  border-right: 2px solid var(--dust);
  border-bottom: 2px solid var(--dust);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-right: 0.25rem;
}
.tool-group--collapsible[open] > .tool-group__header--summary::after {
  transform: rotate(-135deg);
}
.tool-group--collapsible:not([open]) > .tool-group__header--summary {
  border-bottom: none;
}
.tool-group__header--summary:focus-visible {
  outline: 2px solid var(--bark);
  outline-offset: -2px;
}

/* ── PRESET PILLS ── */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.preset-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 0.875rem;
  min-height: 44px; /* WCAG 2.5.8 touch target */
  border: 1.5px solid var(--border);
  border-radius: 100px;
  background: var(--white);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--bark);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s var(--ease);
  white-space: nowrap;
}
.preset-pill:hover { border-color: var(--bark); background: var(--linen-mid); }
.preset-pill.active { border-color: var(--bark); background: var(--bark); color: #fff; border-width: 2px; }

/* ── CATEGORY LABEL ── */
.category-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--soil);
  margin: 1.5rem 0 0.625rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.category-label--medical { color: var(--red); border-color: #FECACA; }

/* ── SEVERITY TOGGLE ── */
.sev-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.toggle-card {
  background: var(--linen);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1rem;
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
  width: 100%;
  transition: all 0.15s var(--ease);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.toggle-card:hover { border-color: var(--border-dark); }
.toggle-card.on { border-color: var(--clay); background: var(--clay-light); }
.toggle-card.on.danger { border-color: var(--red); background: #fff5f5; }
.toggle-switch {
  width: 40px; height: 24px; border-radius: 12px;
  background: var(--border-dark);
  position: relative; flex-shrink: 0; margin-top: 1px;
  transition: background 0.2s;
}
.toggle-switch::after {
  content: ''; position: absolute;
  top: 4px; left: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-card.on .toggle-switch { background: var(--clay); }
.toggle-card.on.danger .toggle-switch { background: var(--red); }
.toggle-card.on .toggle-switch::after { left: 20px; }
.toggle-text-title { font-size: 0.875rem; font-weight: 600; color: var(--bark); }
.toggle-text-sub   { font-size: 0.75rem; color: var(--soil); margin-top: 0.125rem; }

/* ── DESTINATION INSIGHT ── */
.dest-insight {
  background: var(--clay-light);
  border: 1px solid var(--clay-mid);
  border-left: 3px solid var(--clay);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  font-size: 0.8125rem;
  color: var(--bark);
  line-height: 1.7;
  margin-top: 1rem;
  display: none;
}
.dest-insight.show { display: block; }
.dest-insight strong { color: var(--clay-dark); }

/* ── EXPORT ACTIONS ── */
.export-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 1.25rem;
}

/* ── COUNT BADGE ── */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--clay);
  color: #fff;
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 0.375rem;
}

/* ── PAYWALL NOTICE ── */
.paywall-notice {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  color: var(--bark);
  line-height: 1.7;
  display: none;
}
.paywall-notice.show { display: block; }
.paywall-notice strong { color: var(--amber); }

/* ── CARD COPY SECTION (below preview on mobile) ── */
.card-copy-section { margin-top: 1.25rem; }

/* ── HOW IT WORKS (compact single-row tracker) ──
   Originally a 4-card grid with full descriptions; compressed because this
   content largely restates what the interactive tool shows immediately
   below, and its height was pushing the tool's Show Card/Download CTAs far
   below the fold on first load. */
.how-it-works--compact { padding: 1.5rem 0; }
.how-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1.5rem;
}
.how-compact__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bark);
  margin: 0;
  white-space: nowrap;
}
.how-compact__label em { color: var(--clay-dark); font-style: normal; }
.how-compact__steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.375rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.how-compact__steps li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--soil);
  white-space: nowrap;
}
.how-compact__num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bark); color: #fff;
  font-size: 0.6875rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── FAQ ACCORDION ── */
.faq-item {
  border-top: 1px solid var(--border);
}
.faq-item:last-child { border-bottom: 1px solid var(--border); }
.faq-question {
  width: 100%; background: none; border: none;
  padding: 1.25rem 0;
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.9375rem; font-weight: 700;
  color: var(--bark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq-question:hover { color: var(--clay); }
.faq-chevron {
  width: 20px; height: 20px; flex-shrink: 0;
  margin-left: auto; margin-right: 0;
  border: 1.5px solid var(--border-dark);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; color: var(--soil);
  transition: transform 0.2s var(--ease), border-color 0.15s;
}
.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  border-color: var(--clay);
  color: var(--clay);
}
/* ── FAQ: grid-based collapse (avoids magic max-height number) ── */
.faq-answer {
  font-size: 0.875rem;
  color: var(--soil);
  line-height: 1.8;
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 0.28s var(--ease), padding 0.22s var(--ease);
  padding-top: 0;
  padding-bottom: 0;
}
.faq-answer > p,
.faq-answer > div,
.faq-answer > * { min-height: 0; }
.faq-item.open .faq-answer {
  grid-template-rows: 1fr;
  padding-top: 0.75rem;
  padding-bottom: 1.25rem;
}

/* ── WHY CARDS MATTER ── */
.why-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.why-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
}
.why-card__icon { font-size: 2rem; margin-bottom: 0.875rem; }
.why-card h3 { font-size: 1rem; font-weight: 700; color: var(--bark); margin-bottom: 0.5rem; }
.why-card p  { font-size: 0.875rem; color: var(--soil); line-height: 1.75; }

/* ── TOOL SECTION INTRO ── */
.tool-intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

/* ── RELATED TOOLS ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

/* ── LANGUAGE CHIPS PREVIEW ── */
.lang-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.875rem;
}
.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--linen-mid);
  border: 1px solid var(--border);
  color: var(--soil);
}
.lang-chip img { width: 16px; height: 11px; object-fit: cover; border-radius: 2px; }
.lang-chip--free { background: var(--clay-light); border-color: var(--clay-mid); color: var(--clay-dark); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .tool-layout { grid-template-columns: 1fr; }
  /* Mobile step order: allergens (1) → preview + Show Card/Download (2) →
     destination (3, still needed to pick a language, but the card + CTAs are
     usable the moment allergens exist, since dest defaults to TH) →
     optional extras (already nested inside card-preview-wrap as a collapsed
     <details>, so it naturally follows the export actions there).
     .tool-form has no box styling of its own (confirmed: untouched outside
     this block) so display:contents lets its two children — group-allergens
     and group-dest — take independent order values as if they were direct
     children of .tool-layout, instead of being stuck moving as one unit. */
  .tool-form { display: contents; }
  #group-allergens   { order: 0; }
  .card-preview-wrap { position: static; order: 1; }
  #group-dest         { order: 2; }
  #group-source-lang  { order: 3; }
  .why-grid  { grid-template-columns: 1fr; }
  .tool-intro-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .allergen-grid { grid-template-columns: repeat(2, 1fr); }
  /* Use auto-fill so chips never shrink below their content on narrow phones */
  .dest-grid     { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .sev-row       { grid-template-columns: 1fr 1fr; }
  /* Preset row: horizontal scroll so chips never shrink below their content */
  .preset-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .preset-row::-webkit-scrollbar { display: none; }
}

@media (max-width: 480px) {
  /* Recover ~16px of horizontal space on SE-class phones */
  .tool-group__body { padding: 1rem; }
  .tool-group__header { padding: 1rem; }
}

/* ── SOCIAL PROOF STRIP ── */
.social-proof-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: center;
  padding: 0.875rem 1.25rem;
  background: var(--linen-mid);
  border-bottom: 1px solid var(--border);
}
.social-proof-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--soil);
  font-weight: 500;
}
.social-proof-item::before {
  content: '✓';
  color: #16a34a;
  font-weight: 700;
  font-size: 0.875rem;
}

/* ── FREE VS PREMIUM COMPARISON ── */
.tier-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.tier-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  background: var(--white);
}
.tier-card--premium {
  border-color: var(--amber);
  background: #FFFBF0;
  position: relative;
}
.tier-card__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--soil);
  margin-bottom: 0.625rem;
  display: block;
}
.tier-card--premium .tier-card__label {
  color: var(--amber);
}
.tier-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--soil);
  margin-bottom: 0.375rem;
  line-height: 1.35;
}
.tier-item::before {
  content: '✓';
  color: #16a34a;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 0.75rem;
}
.tier-card--premium .tier-item {
  color: var(--bark);
  font-weight: 500;
}
.tier-card--premium .tier-item::before {
  color: var(--amber);
}
/* Features that are sold but not yet actually deliverable — keep them
   visible (so the roadmap is honest) but visually de-emphasized, and swap
   the checkmark for a neutral marker so they don't read as "this works now". */
.tier-item--soon {
  color: var(--soil) !important;
  font-weight: 400 !important;
}
.tier-item--soon::before {
  content: '◷' !important;
  color: var(--soil) !important;
}
.tier-item--soon .tier-item__soon-label {
  font-size: 0.6875rem;
  font-style: italic;
}

/* ── "COMING SOON" BUTTON STATE ──
   Used for export actions that exist in the UI but aren't reliable/built
   yet (e.g. Print, until @page sizing + print-color-adjust are fixed).
   Keeps the button visible for transparency about the roadmap, but
   unmistakably inert. */
.btn--coming-soon {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  position: relative;
}
.btn--coming-soon:hover { opacity: 0.55; }

/* Demoted "coming soon" actions: rendered as a small inline caption instead
   of a full-width button, so a non-functional control doesn't carry the same
   visual weight as Show Card / Download / Wallet. Keeps the element (and its
   disabled state + listener) intact for an easy flip back to a full button
   once the feature ships — see the comment above btnPrint's listener in
   builder.js for what's still blocking that. */
.btn--text-inline {
  align-self: center;
  width: auto;
  margin: 0.15rem auto 0;
  padding: 0.2rem 0.4rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* Shown instead of the live $ upgrade CTA in the sidebar tier-compare card once
   the user already has access to the selected destination. Same inert
   treatment as .btn--coming-soon, but framed as confirmed, not disabled. */
.btn--owned {
  opacity: 0.8;
  cursor: default;
  pointer-events: none;
  background: var(--soil);
  border-color: var(--soil);
}

/* Small muted caption directly below a button, e.g. under Premium explaining
   what's not built yet. Lives as a sibling in the .export-actions flex column,
   not inside the button — .btn is display:inline-flex with no flex-direction
   set (so row, by default), which would have shoved a nested span sideways
   instead of stacking it underneath. */
.export-actions__note {
  margin: -0.3rem 0 0 0;
  padding: 0;
  font-size: 0.75rem;
  color: var(--soil);
  text-align: center;
  font-style: italic;
}

/* Apple/Google Wallet links shown after a successful /api/generate-wallet-pass
   call. Sits as a sibling in the .export-actions flex column, same pattern
   as .export-actions__note above. */
.wallet-result-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: -0.2rem;
}
.wallet-result-links a {
  display: block;
  text-align: center;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--sand-light, #f4efe8);
  color: var(--clay-dark);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}
.wallet-result-links a:hover { opacity: 0.85; }

/* ── SHOW ALL ALLERGENS TOGGLE ── */
.allergen-common-section { }
.allergen-expand-row {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.allergen-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 0.875rem;
  min-height: 44px; /* WCAG 2.5.8 touch target */
  border: 1.5px dashed var(--border-dark);
  border-radius: 100px;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--soil);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s var(--ease);
}
.allergen-expand-btn:hover {
  border-color: var(--clay);
  color: var(--clay);
  background: var(--clay-light);
}
.allergen-expand-btn .expand-chevron {
  transition: transform 0.2s ease;
  display: inline-block;
  font-style: normal;
}
.allergen-expand-btn.expanded .expand-chevron {
  transform: rotate(180deg);
}
.allergen-all-section {
  display: none;
}
.allergen-all-section.visible {
  display: block;
}

/* ── ALLERGEN SEARCH ── */
.allergen-search-row {
  position: relative;
  margin-top: 1rem;
  display: flex;
  align-items: center;
}
.allergen-search-input {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1.5px solid var(--border-dark);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-family: var(--font-body);
  background: var(--linen);
  color: var(--soil);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s var(--ease);
}
.allergen-search-input:focus {
  border-color: var(--clay);
}
.allergen-search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.125rem 0.375rem;
  border: none;
  border-radius: 100px;
  background: transparent;
  font-size: 0.75rem;
  color: var(--soil);
  cursor: pointer;
  line-height: 1;
  font-family: var(--font-body);
  transition: color 0.15s var(--ease);
}
.allergen-search-clear:hover {
  color: var(--bark);
}
.allergen-search-count {
  margin: 0.5rem 0 0;
  padding: 0 0.25rem;
  font-size: 0.75rem;
  color: var(--soil);
  font-family: var(--font-body);
  line-height: 1.4;
}

/* ── TRAVELER PASS CARD ── */
.traveler-pass-card {
  border: 1.5px solid var(--clay-mid);
  background: linear-gradient(135deg, var(--clay-light) 0%, #fff 100%);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  margin-top: 0.75rem;
}
.traveler-pass-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}
.traveler-pass-card__title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--clay-dark);
}
.traveler-pass-card__sub {
  font-size: 0.6875rem;
  color: var(--clay);
  margin-top: 0.125rem;
}
.traveler-pass-card__price {
  font-size: 1rem;
  font-weight: 800;
  color: var(--clay-dark);
  flex-shrink: 0;
}
.traveler-pass-card__items {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.traveler-pass-card__item {
  font-size: 0.75rem;
  color: var(--soil);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.traveler-pass-card__item::before {
  content: '✓';
  color: var(--clay);
  font-weight: 700;
  font-size: 0.6875rem;
  flex-shrink: 0;
}
.traveler-pass-cta {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.625rem;
  background: var(--clay);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.traveler-pass-cta:hover {
  background: var(--clay-dark);
}

/* ── DEMO CARD INDICATOR ── */
.preview-demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--soil);
  background: var(--linen-mid);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.2rem 0.5rem;
  margin-top: 0.75rem;
  text-align: center;
}

/* ── DEST LOCK ICON ── */
.dest-chip__lock {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.625rem;
  line-height: 1;
}

/* ── PAYWALL NOTICE — stronger ── */
.paywall-notice--strong {
  background: #FFFBEB;
  border: 1.5px solid var(--amber);
  border-left: 4px solid var(--amber);
}
.paywall-notice--strong strong { color: var(--amber); }
.paywall-notice-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.875rem;
}

/* ── PRINT ── */
@media print {
  /* Hide everything except the card preview */
  body > *:not(main) { display: none !important; }
  main > *:not(#tool) { display: none !important; }
  #tool .tool-form,
  #tool .section-header,
  nav, footer,
  .card-copy-section,
  .export-actions,
  #freeConfirm,
  #premiumCta,
  .dest-insight,
  #ap-toast,
  .social-proof-strip,
  #hiddenIngredientsPanel,
  #ap-paywall-overlay { display: none !important; }
  .tool-layout { grid-template-columns: 1fr !important; }
  .card-preview-wrap { position: static !important; box-shadow: none !important; }
  /* Strip the "Live Preview" header bar */
  .card-preview-wrap > div > div:first-child { display: none !important; }
  .allergy-card {
    max-width: 100% !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }
}

/* ── HIDDEN INGREDIENTS PANEL ──────────────────────────────────────────
   Educational preview component shown below the allergy card.
   Reads hiddenSources from allergen data. Not part of the printable card.
   Excluded from print and html2canvas via #hiddenIngredientsPanel selector.
────────────────────────────────────────────────────────────────────── */
.hi-panel {
  margin-top: 1rem;
  background: var(--linen);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 340px;
  margin-inline: auto;
  font-family: var(--font-body);
}

.hi-panel__head {
  background: var(--bark);
  padding: 0.625rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.hi-panel__title {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
  display: block;
}

.hi-panel__sub {
  font-size: 0.625rem;
  color: rgba(255,255,255,0.65);
  font-weight: 500;
  letter-spacing: 0.03em;
  display: block;
}

.hi-panel__body {
  padding: 0.625rem 0.875rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.hi-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.hi-row__head {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.hi-row__emoji {
  font-size: 0.9375rem;
  flex-shrink: 0;
  line-height: 1;
}

.hi-row__name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--bark);
  line-height: 1.2;
}

.hi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding-left: 1.5rem; /* indent under emoji */
}

.hi-chip {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--soil);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.125rem 0.5rem;
  line-height: 1.5;
  white-space: nowrap;
}

.hi-chip--more {
  color: var(--soil);
  background: transparent;
  border-color: transparent;
  font-style: italic;
  padding-left: 0;
}

/* ── Print: hide the Hidden Ingredients panel (not part of the card) ── */
#demoCardWrap, #tierCompare {
  transition: opacity 0.25s ease;
}
#demoCardWrap.fading, #tierCompare.fading {
  opacity: 0;
}

/* ── SEVERITY TOGGLE ON-STATE ── */
.toggle-card.danger.on {
  background: #fff5f5;
  border-color: var(--red);
}
.toggle-card.danger.on .toggle-text-title { color: var(--red); }
.toggle-card.on:not(.danger) {
  background: var(--clay-light);
  border-color: var(--clay-mid);
}
.toggle-card.on:not(.danger) .toggle-text-title { color: var(--clay-dark); }

/* ── FIELD INPUT ── */
.field-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem; /* 16px — prevents iOS Safari auto-zoom on focus */
  background: var(--white);
  color: var(--bark);
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus { border-color: var(--bark); }

/* ── MULTI-DESTINATION (Frequent Traveler Pack) ── */
.multidest-heading {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--bark);
  margin-bottom: 0.875rem;
}
.multidest-slots {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.multidest-slot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--linen-mid);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  min-height: 52px;
}
.multidest-slot__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bark);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.multidest-slot__num--optional {
  background: var(--border);
  color: var(--soil);
}
.multidest-slot select {
  flex: 1;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--bark);
  outline: none;
  min-height: 44px;
}
.multidest-slot select:focus { border-color: var(--bark); }
.multidest-slot__remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--soil);
  cursor: pointer;
  font-size: 1.375rem;
  line-height: 1;
  padding: 0.25rem 0.375rem;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.multidest-slot__remove:hover { color: var(--red); background: #fff5f5; }
.multidest-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  border: 1.5px dashed var(--border-dark);
  border-radius: 100px;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--soil);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  min-height: 44px;
}
.multidest-add-btn:hover {
  border-color: var(--clay);
  color: var(--clay);
  background: var(--clay-light);
}
.multidest-dup-warning {
  display: none;
  font-size: 0.8125rem;
  color: var(--amber);
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
}
.multidest-dup-warning.show { display: block; }
.multidest-summary {
  font-size: 0.8125rem;
  color: var(--soil);
  margin-top: 0.75rem;
  line-height: 1.6;
}

/* ── RTL SUPPORT (Arabic, Hebrew, Persian, Urdu) ── */
/* Applied when card destination is set to RTL language */
.allergy-card[data-rtl="true"],
.allergy-card[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

.allergy-card[data-rtl="true"] .ac-banner-title,
.allergy-card[dir="rtl"] .ac-banner-title {
  text-align: right;
}

.allergy-card[data-rtl="true"] .ac-body,
.allergy-card[dir="rtl"] .ac-body {
  text-align: right;
}

.allergy-card[data-rtl="true"] .ac-allergen-row,
.allergy-card[dir="rtl"] .ac-allergen-row {
  flex-direction: row-reverse;
  text-align: right;
}

.allergy-card[data-rtl="true"] .ac-allergen-icon,
.allergy-card[dir="rtl"] .ac-allergen-icon {
  margin-left: 0;
  margin-right: 0.625rem;
}

.allergy-card[data-rtl="true"] .ac-footer,
.allergy-card[dir="rtl"] .ac-footer {
  flex-direction: row-reverse;
  text-align: right;
}

.allergy-card[data-rtl="true"] .ac-instr,
.allergy-card[dir="rtl"] .ac-instr {
  text-align: right;
}

.allergy-card[data-rtl="true"] .ac-instr-local,
.allergy-card[dir="rtl"] .ac-instr-local {
  text-align: right;
}

/* RTL for form inputs and flex containers */
.allergen-chip[data-rtl="true"],
.dest-chip[data-rtl="true"] {
  text-align: right;
}

.toggle-card[data-rtl="true"],
.preset-pill[data-rtl="true"] {
  text-align: right;
}

.tool-group__header[data-rtl="true"] {
  flex-direction: row-reverse;
  text-align: right;
}

.tool-group__title[data-rtl="true"],
.tool-group__sub[data-rtl="true"] {
  text-align: right;
}

/* RTL for FAQ and other sections */
.faq-question[data-rtl="true"] {
  text-align: right;
  flex-direction: row-reverse;
}

/* faq-chevron margin merged into component definition below */

.faq-question[data-rtl="true"] .faq-chevron {
  margin-left: 0;
  margin-right: auto;
}

/* ── SOURCE LANGUAGE PICKER ── */
/* Slightly smaller chip grid than the destination picker */
.dest-grid--source {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.5rem;
}

/* Chips default to slightly muted; full opacity when selected */
.source-lang-chip { opacity: 0.88; }
.source-lang-chip.selected { opacity: 1; }

/* Chips whose language matches the current destination — dimmed with a small badge */
.source-lang-chip--same-as-dest {
  opacity: 0.45;
  cursor: default;
  pointer-events: auto; /* still clickable — renderPreview silently no-ops the column */
}
.source-lang-chip--same-as-dest:hover {
  border-color: var(--border);
  transform: none;
  box-shadow: none;
}
.source-lang-chip__same-badge {
  position: absolute;
  bottom: 4px; right: 4px;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 4px;
  border-radius: 100px;
  background: var(--linen-mid);
  color: var(--soil);
  border: 1px solid var(--border);
}

/* Explainer note below the source grid */
.source-lang-note {
  font-size: 0.72rem;
  color: var(--soil);
  margin-top: 0.875rem;
  line-height: 1.5;
}
.source-lang-note__link {
  color: var(--clay);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── ALLERGY CARD: source-language additions ── */
/* Flex-column wrapper for all label spans within one allergen row */
.ac-allergen-labels {
  display: flex;
  flex-direction: column;
}

/* Source language label — below English, clay-tinted to distinguish from dest */
.ac-allergen-source {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--clay);
  display: block;
  margin-top: 0.175rem;
  line-height: 1.2;
  opacity: 0.85;
}

/* Source language instruction line */
.ac-instr-src {
  font-size: 0.625rem;
  color: var(--clay);
  margin-top: 0.125rem;
  font-style: italic;
  opacity: 0.85;
}

/* Source language banner subtitle — muted second line in banner */
.ac-banner-sub--src {
  display: block;
  font-size: 0.65rem;
  opacity: 0.75;
  margin-top: 0.125rem;
  font-style: italic;
}

/* Extra breathing room between allergen rows when two languages are shown */
.allergy-card.has-source-lang .ac-allergen-row {
  padding: 0.575rem 0;
}
