/* =========================================================
   User Profile – Redesign v2
   Changelog: Full visual overhaul to match homepage/category
   design system. Sans-serif throughout, wider sidebar with
   profile strength meter, mode-toggle preferences, larger
   pie chart with center label, homepage-matched spacing.
   ========================================================= */

/* ---------- Design Tokens (match homepage / category) ---------- */
:root {
  --bg-page: #ffffff;
  --header-bg: var(--navy, #16304D);
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --brand-dark: var(--navy, #16304D);
  --brand-sage: var(--navy, #16304D);
  --brand-tan: #c9a961;
  --brand-100: #e8f0ea;
  --amber: #e8a020;
  --amber-bg: #fef7e6;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --border-subtle: 1px solid #e5e7eb;
  --radius-lg: 10px;
  --radius-pill: 999px;
  --shadow-card: 0 6px 16px rgba(0,0,0,.10);
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --env: #5b8a72;
  --lab: #5a7a8a;
  --com: #8a5b6e;
  --font-serif: Georgia, 'Times New Roman', Times, serif;
}

/* ---------- Base ---------- */
html, body { height: 100%; min-height: 100vh; }
body {
  background: var(--bg-page);
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}
*, *::before, *::after { box-sizing: border-box; }

/* =========================================================
   Brand Header (matches homepage exactly)
   ========================================================= */
.cart-label { display: none; }
.brand-header {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--header-bg);
  border-bottom: 1px solid rgba(0,0,0,.08);
  color: #fff;
  flex-wrap: wrap;
  gap: 8px;
}
.brand-logo {
  height: 65px; max-width: 250px; object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.15));
  cursor: pointer; transition: transform .25s ease;
}
.brand-logo:hover { transform: scale(1.02); }
.brand-actions {
  display: inline-flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.auth-status { font-weight: 600; }
.brand-header .auth-status {
  color: #fff; opacity: 0.85; margin-right: 12px;
  white-space: nowrap; font-weight: 600;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 8px 14px; border-radius: var(--radius-pill);
  font-weight: 600; font-size: 14px; border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer; line-height: 1;
  transition: background-color .2s, color .2s, box-shadow .2s, transform .15s;
  text-decoration: none; font-family: var(--font-body);
}
.btn-label-short { display: none; }
.btn-feedback { background: var(--amber); color: #fff; border: none; font-size: 14px; text-decoration: none; }
.btn-feedback:hover { background: #d18f18; color: #fff; transform: none; text-decoration: none; }
.btn.primary {
  background: var(--brand-dark); color: white;
  border: none;
  padding: 10px 24px; font-weight: 600; font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  border-radius: var(--radius-lg);
}
.btn.primary:hover:not(:disabled) {
  background: var(--brand-sage);
  transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.brand-header .btn-secondary {
  background: transparent; color: #fff;
  border: none; box-shadow: none;
  font-weight: 600; font-size: 14px; text-decoration: none;
}
.brand-header .btn-secondary:hover { background: transparent; color: rgba(255,255,255,0.75); transform: none; }
.brand-header .btn-secondary:focus-visible { outline: 2px solid #9bd3b5; outline-offset: 2px; }

/* Status indicators */
#saveStatus {
  font-weight: 600; font-size: 12px;
  padding: 6px 14px; border-radius: var(--radius-pill);
  transition: all .3s ease;
}
#saveStatus:not(:empty) { animation: slideIn 0.3s ease-out; }
.status-ok { color: var(--brand-dark); background: rgba(7,41,8,0.08); border: 1px solid rgba(7,41,8,0.2); }
.status-err { color: #dc2626; background: #fee2e2; border: 1px solid #fecaca; }
@keyframes slideIn { from { opacity:0; transform:translateX(-10px); } to { opacity:1; transform:translateX(0); } }

/* =========================================================
   Utilities
   ========================================================= */
.visually-hidden,
#editors-stash {
  position: absolute !important; left: -9999px !important;
  width: 1px !important; height: 1px !important; overflow: hidden !important;
}
.muted { color: var(--text-muted); }
.sr-only { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
h2, h3 { color: var(--text-primary); margin-top: 0; }

/* =========================================================
   Container (matches homepage .home max-width + padding)
   ========================================================= */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px clamp(16px, 2vw, 28px) 80px;
}
@media (max-width: 900px) { .container { padding: 0 8px 60px; } }
@media (max-width: 640px) { .container { padding: 0 12px 40px; } }

/* =========================================================
   Welcome Banner (full-width bar, matches homepage greeting-banner)
   ========================================================= */
.welcome-banner {
  background: #f0ebe1;
  color: var(--text-primary);
  padding: 0 24px;
  width: 100%;
}
.welcome-banner__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 0;
}
.welcome-banner__content {
  position: relative;
  z-index: 1;
}
.welcome-banner__eyebrow {
  font-size: 11px;
  letter-spacing: 1.2px;
  color: rgba(0,0,0,0.45);
  margin: 0 0 6px;
  font-weight: 600;
  text-transform: uppercase;
}
.welcome-banner__greeting {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
  line-height: 1.2;
  letter-spacing: -0.3px;
}
.welcome-banner__subtext {
  font-size: 15px;
  color: rgba(0,0,0,0.55);
  max-width: 100%;
  line-height: 1.6;
  margin: 0;
  font-weight: 400;
}

/* =========================================================
   Category Nav Bar (matches homepage category-nav exactly)
   ========================================================= */
.category-nav {
  position: sticky; top: 85px; z-index: 999;
  background: #e8eaed;
  border-bottom: 1px solid #d1d5db;
}
.category-nav-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-nav-inner::-webkit-scrollbar { display: none; }
.category-nav-link {
  display: inline-flex; align-items: center;
  padding: 14px 20px;
  font-size: 13px; font-weight: 600;
  color: #6b7280; text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  font-family: var(--font-body);
}
.category-nav-link:hover {
  color: var(--brand-dark);
  border-bottom-color: var(--brand-dark);
}
.category-nav-link.active {
  color: var(--brand-dark);
  border-bottom-color: var(--brand-dark);
  font-weight: 700;
}

/* =========================================================
   Two-column Profile Layout
   ========================================================= */
.profile-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}

/* =========================================================
   Sidebar
   ========================================================= */
.profile-sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
}
.profile-sidebar__card {
  background: var(--card-bg);
  border: var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.profile-sidebar__header {
  font-size: 11px;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin: 0 0 14px;
  font-weight: 600;
  text-transform: uppercase;
}
.profile-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
  line-height: 1.3;
}
.sidebar-nav-item[hidden],
.mobile-nav-pill[hidden] { display: none !important; }
.sidebar-nav-item:hover {
  background: #f3f4f6;
}
/* Colored left-border accents on inactive sidebar items */
.sidebar-nav-item--values  { border-left: 3px solid #2e8b3e; }
.sidebar-nav-item--prefs   { border-left: 3px solid #5b8a72; }
.sidebar-nav-item--about   { border-left: 3px solid #8a7a5b; }
.sidebar-nav-item--dealbreakers { border-left: 3px solid #8a6e6e; }
.sidebar-nav-item--purchases { border-left: 3px solid #c9a961; }
.sidebar-nav-item--saved   { border-left: 3px solid #c96b8a; }
.sidebar-nav-item--help    { border-left: 3px solid #2563eb; }
.sidebar-nav-item--active {
  background: var(--brand-dark);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(7,41,8,0.25);
  border-left-color: transparent;
}
.sidebar-nav-item--active:hover {
  background: var(--brand-dark);
}
.sidebar-nav-item svg {
  flex-shrink: 0;
  stroke-width: 2;
  stroke: currentColor;
  pointer-events: none;
  width: 16px;
  height: 16px;
}
.profile-sidebar__divider {
  height: 0;
  border-top: var(--border-subtle);
  margin: 16px 0;
}

/* Sidebar auth section */
.profile-sidebar__auth {
  padding: 0;
}
.profile-sidebar__auth-label {
  font-size: 10px;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin: 0 0 8px;
  font-weight: 600;
  text-transform: uppercase;
}
.profile-sidebar__auth-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.profile-sidebar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-sage);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}
.profile-sidebar__auth-email {
  font-size: 13px;
  color: var(--text-primary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  flex: 1;
  min-width: 0;
}
.profile-sidebar__signout {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body);
  font-weight: 500;
}
.profile-sidebar__signout:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}
.profile-sidebar__signin-btn {
  font-size: 13px;
  color: var(--brand-sage, #2e8b3e);
  background: none;
  border: 1px solid var(--brand-sage, #2e8b3e);
  border-radius: 6px;
  cursor: pointer;
  padding: 6px 14px;
  font-family: var(--font-body);
  font-weight: 600;
  margin-top: 4px;
  transition: background 0.2s, color 0.2s;
}
.profile-sidebar__signin-btn:hover {
  background: var(--brand-sage, #2e8b3e);
  color: #fff;
}

/* Sidebar Leif List Tip (replaces Profile Strength) */
.sidebar-tip {
  margin-top: 16px;
  padding: 14px;
  background: #E6E0F0;
  border-left: 3px solid #9B8BB4;
  border-radius: 0 8px 8px 0;
}
.sidebar-tip__quote {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 10px;
}
.sidebar-tip__quote em {
  font-style: italic;
}
.sidebar-tip__dots {
  display: flex;
  gap: 6px;
}
.sidebar-tip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  transition: background 0.3s ease;
}
.sidebar-tip__dot--filled {
  background: #2e8b3e;
}

/* Mobile nav scroller (hidden on desktop) */
.mobile-nav-scroller {
  display: none;
}

/* =========================================================
   Main Content Area
   ========================================================= */
.profile-main {
  min-width: 0;
}
.profile-section {
  display: none;
}
.profile-section--active {
  display: block;
}

/* Profile cards */
.profile-card {
  background: var(--card-bg);
  border: var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
/* Two-card row: Values left, Preferences right */
.values-prefs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.values-prefs-row .prefs-card {
  max-height: 540px;
  overflow-y: auto;
}
.values-prefs-row .profile-card {
  margin-bottom: 0;
}
/* Values card (matches other cards) */
.values-card {
  background: var(--card-bg);
  border-color: var(--card-border);
  padding: 20px;
  display: flex;
  flex-direction: column;
}
/* Preferences survey card */
.prefs-card {
  display: flex;
  flex-direction: column;
  scroll-margin-top: 100px;
}

/* =========================================================
   Survey Card – Accordion-based Survey
   ========================================================= */

/* Step indicator bar */
.survey-step-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px 0;
}
.survey-step-dots {
  display: flex;
  gap: 6px;
}
.survey-step-dot {
  width: 28px; height: 4px;
  border-radius: 2px;
  background: #d1d5db;
  transition: background .2s;
}
.survey-step-dot--active {
  background: var(--navy, #16304D);
}

.survey-step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .5px;
}

/* Pages */
.survey-pages {
  padding: 20px 24px 14px;
}
.survey-page {
  display: none;
  flex-direction: column;
}
.survey-page--active {
  display: flex;
}
.survey-page__eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin: 10px 0 4px;
  text-transform: uppercase;
}
.survey-page__title {
  font-size: 20px;
  font-weight: 800;
  color: #111827;
  margin: 0 0 4px;
  line-height: 1.2;
  letter-spacing: -0.3px;
}
.survey-page__desc {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 14px;
  line-height: 1.5;
}

/* Accordion sections */
.survey-accordions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
  max-height: 320px;
  overflow-y: auto;
}
.survey-accordions::-webkit-scrollbar { width: 4px; }
.survey-accordions::-webkit-scrollbar-track { background: transparent; }
.survey-accordions::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.survey-acc {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  transition: box-shadow .2s;
}
.survey-acc--open {
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  background: var(--acc-tint, var(--card-bg));
  border-color: var(--acc-border, var(--card-border));
}

/* Per-group accordion tints */
.survey-acc[data-acc="brand-values"]    { --acc-tint: rgba(122,106,90,0.06); --acc-border: rgba(122,106,90,0.25); }
.survey-acc[data-acc="environmental"]   { --acc-tint: rgba(46,139,62,0.06);  --acc-border: rgba(46,139,62,0.25); }
.survey-acc[data-acc="human-rights"]    { --acc-tint: rgba(90,122,138,0.06); --acc-border: rgba(90,122,138,0.25); }
.survey-acc[data-acc="workplace-dei"]   { --acc-tint: rgba(122,110,138,0.06); --acc-border: rgba(122,110,138,0.25); }
.survey-acc[data-acc="animal-welfare"]  { --acc-tint: rgba(138,110,110,0.06); --acc-border: rgba(138,110,110,0.25); }
.survey-acc[data-acc="governance"]      { --acc-tint: rgba(90,106,138,0.06); --acc-border: rgba(90,106,138,0.25); }
.survey-acc[data-acc="health-safety"]   { --acc-tint: rgba(91,138,114,0.06); --acc-border: rgba(91,138,114,0.25); }
.survey-acc[data-acc="certifications"]  { --acc-tint: rgba(138,126,90,0.06); --acc-border: rgba(138,126,90,0.25); }
.survey-acc[data-acc="sustainability"]  { --acc-tint: rgba(106,138,90,0.06); --acc-border: rgba(106,138,90,0.25); }
.survey-acc[data-acc="diet-food"]       { --acc-tint: rgba(110,127,138,0.06); --acc-border: rgba(110,127,138,0.25); }

/* Accordion header */
.survey-acc__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
}
.survey-acc__header:hover {
  background: rgba(0,0,0,.015);
  border-radius: var(--radius-lg);
}
.survey-acc__header-left {
  flex: 1;
  min-width: 0;
}
.survey-acc__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}
.survey-acc__sub {
  font-size: 11px;
  color: var(--text-muted);
  margin: 2px 0 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.survey-acc__header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Accordion badge (SKIPPED / count) */
.survey-acc__badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.survey-acc__badge--has-count {
  color: var(--navy, #16304D);
}

/* Survey chips: SIZE ONLY. Colour is left to the canonical .pref-toggle[data-tier]
   rules below, so off / nice-to-have (amber) / must-have (filled) read the same in
   the survey as anywhere else. Declaring background/border/colour here would win on
   specificity (#id) and flatten all three tiers into one look. */
#surveyPages .pref-toggle {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  gap: 5px;
}


/* Chevron */
.survey-acc__chevron {
  color: var(--text-muted);
  transition: transform .25s ease;
  flex-shrink: 0;
}
.survey-acc--open .survey-acc__chevron {
  transform: rotate(180deg);
}

/* Accordion body */
.survey-acc__body {
  display: none;
  padding: 0 14px 12px;
}
.survey-acc--open .survey-acc__body {
  display: block;
}
.survey-acc__body .pill-group {
  margin-top: 4px;
}

/* Survey dropdowns inside accordion */
.survey-dropdowns {
  gap: 10px;
}

/* Bottom action bar — pinned to the bottom of the scrolling prefs card so
   Skip / Back / Next stay reachable without scrolling the card to its fold.
   The card is the scroll container on desktop (max-height + overflow-y:auto);
   on mobile it sticks to the page scroll (see the ≤768px override below). */
.survey-bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px 14px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, .06);
}
.survey-reset-link {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-body);
  padding: 0;
  letter-spacing: .2px;
}
.survey-reset-link:hover {
  color: #374151;
  text-decoration: underline;
}
.survey-selection-count {
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
}
.survey-bottom-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.survey-btn-save {
  background: #fff !important;
  color: #374151 !important;
  border: 1.5px solid #d1d5db !important;
  padding: 8px 16px !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  border-radius: 999px !important;
  transition: all .15s !important;
}
.survey-btn-save:hover {
  background: #f3f4f6 !important;
  border-color: #9ca3af !important;
}
.survey-btn-next {
  background: var(--navy, #16304D) !important;
  color: #fff !important;
  border: none !important;
  padding: 9px 22px !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  letter-spacing: .3px !important;
  transition: background .15s !important;
}
.survey-btn-next:hover {
  background: var(--navy, #16304D) !important;
}
.survey-btn-back {
  background: #fff !important;
  color: #374151 !important;
  border: 1.5px solid #d1d5db !important;
  padding: 8px 16px !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  transition: all .15s !important;
}
.survey-btn-back:hover {
  background: #f3f4f6 !important;
  border-color: #9ca3af !important;
}
/* The !important display above outranks an inline style="display:none", so hiding
   the Back button on step 1 has to go through [hidden] to win. */
.survey-btn-back[hidden] { display: none !important; }

/* Responsive */
@media (max-width: 900px) {
  .survey-accordions { max-height: 280px; }
  .survey-pages { padding: 20px 20px 12px; }
  .survey-bottom-bar { padding: 12px 20px 16px; }
  .survey-step-bar { padding: 18px 20px 0; }
}
@media (max-width: 768px) {
  /* Override — no nested scroll on mobile */
  .survey-accordions { max-height: none; overflow-y: visible; }
}
@media (max-width: 600px) {
  .survey-pages { padding: 16px 16px 10px; }
  .survey-bottom-bar { padding: 10px 16px 14px; }
  .survey-step-bar { padding: 14px 16px 0; }
  .survey-page__title { font-size: 22px; }
  .survey-acc__mode-pills { gap: 1px; }
  .survey-mode-pill { padding: 3px 7px; font-size: 10px; }
  .survey-bottom-actions { width: 100%; justify-content: flex-end; }
  .survey-pill { padding: 8px 14px; font-size: 12px; }
}

/* ---------- About You Survey (3-step flow) ---------- */
.survey-step-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  color: #9ca3af; text-transform: uppercase; margin: 0 0 4px;
}
.survey-questions {
  display: flex; flex-direction: column; gap: 0; padding-bottom: 8px;
}
.survey-question { padding: 0; }
.survey-question__label {
  font-size: 14px; font-weight: 700; color: #111827;
  margin: 0 0 3px; line-height: 1.3;
}
.survey-question__hint {
  font-size: 12px; color: #6b7280; margin: 0 0 10px; line-height: 1.45;
}
.survey-question__divider {
  height: 1px; background: #e5e7eb; margin: 16px 0;
}
.survey-text-input {
  width: 100%; max-width: 360px; padding: 10px 14px;
  font-size: 13px; font-family: var(--font-body); color: #111827;
  background: #fff; border: 1.5px solid #d1d5db;
  border-radius: var(--radius-lg); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.survey-text-input::placeholder { color: #9ca3af; }
.survey-text-input:focus {
  border-color: var(--navy, #16304D); box-shadow: 0 0 0 3px rgba(7,41,8,.08);
}
.survey-select {
  max-width: 360px;
  padding: 10px 14px;
  font-size: 13px;
  font-family: var(--font-body);
  color: #111827;
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-lg);
  outline: none;
  appearance: auto;
}
.survey-select:focus {
  border-color: var(--navy, #16304D);
  box-shadow: 0 0 0 3px rgba(7,41,8,.08);
}
.survey-pill-group {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.survey-pill {
  display: inline-flex; align-items: center; padding: 8px 14px;
  font-size: 12px; font-weight: 600; font-family: var(--font-body);
  color: #374151; background: #fff;
  border: 1.5px solid #d1d5db; border-radius: var(--radius-pill);
  cursor: pointer; transition: all .15s ease;
  user-select: none;
}
.survey-pill:hover {
  border-color: var(--navy, #16304D); background: #f0f5f1;
}
.survey-pill--active {
  background: #e8f5ea; border: 1.5px solid #2e8b3e;
  color: #1a5a28;
}
.survey-pill--active:hover {
  background: #d8eedc; border-color: #267a34;
}
.survey-pill--muted { border-style: dashed; color: var(--text-muted); }
.survey-pill--muted.survey-pill--active { border-style: solid; color: #1a5a28; }

/* Ranked pill badge */
.survey-pill__rank {
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px; min-width: 22px;
  border-radius: 50%;
  background: rgba(46,139,62,.15);
  color: #1a5a28;
  font-size: 12px; font-weight: 700;
  line-height: 1;
  margin-right: 6px;
}
.survey-pill--active .survey-pill__rank {
  display: inline-flex;
}
.survey-complete-banner {
  display: flex; align-items: flex-start; gap: 12px; margin-top: 24px;
  padding: 16px 20px; background: var(--brand-100);
  border: 1px solid rgba(11,79,45,.15); border-radius: var(--radius-lg);
}
.survey-complete-banner__dot {
  width: 10px; height: 10px; min-width: 10px;
  border-radius: 50%; background: var(--brand-sage); margin-top: 4px;
}
.survey-complete-banner__text { flex: 1; }
.survey-complete-banner__text strong { font-size: 14px; color: var(--text-primary); }
.survey-complete-banner__text p { font-size: 13px; color: var(--text-secondary); margin: 2px 0 0; line-height: 1.4; }
.survey-skip-link {
  background: none; border: none; color: var(--text-muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: var(--font-body); padding: 0; text-decoration: none;
}
.survey-skip-link:hover { color: var(--text-primary); text-decoration: underline; }
@media (max-width: 600px) {
  .survey-text-input, .survey-select { max-width: 100%; }
  .survey-question__label { font-size: 15px; }
  .survey-pill { padding: 8px 14px; font-size: 12px; }
  .survey-complete-banner { padding: 12px 16px; }
}

.profile-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}
.profile-card__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
  letter-spacing: -0.2px;
}
.values-card .profile-card__title {
  font-size: 18px;
}
.profile-card__subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 20px;
  line-height: 1.5;
}
.values-card .profile-card__subtitle {
  font-size: 13px;
  margin: 0 0 14px;
}
/* Mobile-only merged subtitle — hidden on desktop */
.profile-card__subtitle-mobile {
  display: none;
}

/* =========================================================
   Your Values – Card header actions (Reset + Save)
   ========================================================= */
.values-card__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.values-reset-link {
  background: none;
  border: none;
  color: var(--text-muted);
  text-decoration: underline;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 0;
  transition: color .15s;
}
.values-reset-link:hover {
  color: var(--text-primary);
}
.values-save-btn {
  padding: 8px 20px !important;
  font-size: 13px !important;
}

/* =========================================================
   Your Values – ESG Chart Layout (two-row grid)
   ========================================================= */
.values-chart-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  grid-template-rows: auto auto auto;
  gap: 0 20px;
  align-items: start;
  margin-bottom: 0;
}
.values-chart__right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  min-width: 0;
}
.values-chart__legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.legend-row .weight-slider {
  flex: 1;
  min-width: 60px;
}
/* Legacy swatch (hidden when badge present) */
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
/* Icon badge in legend rows */
.legend-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.legend-badge svg {
  width: 12px;
  height: 12px;
}
.legend-label {
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
  font-weight: 500;
}
.legend-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* Controls row (Back button only — Reset/Save moved to card header) */
#saveWeightsStatus {
  font-size: 13px;
  margin-left: 4px;
}
#weightsHelp {
  grid-column: 2;
}

/* Pie drill-down hint */
.pie-drill-hint {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  margin: 6px 0 0;
  line-height: 1.3;
}

/* Divider between top and bottom rows */
.values-divider {
  grid-column: 1 / -1;
  height: 0;
  border-top: 0.5px solid #e5e7eb;
  margin: 2px 0 0;
}

/* =========================================================
   Example Product Card (bottom-left)
   ========================================================= */
.example-product-card {
  grid-column: 1;
  background: #f9fafb;
  border-radius: 8px;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  align-self: start;
}
.example-product__eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0 0 8px;
}
.example-product__headline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 6px;
  margin-bottom: 8px;
}
.example-product__number {
  font-size: 26px;
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.1;
}
.example-product__of100 {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 400;
}
.example-product__rating {
  flex: 0 0 100%;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  font-style: italic;
}
.example-product__divider {
  height: 0;
  border-top: 1px solid #e5e7eb;
  margin-bottom: 10px;
}
.example-product__breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.example-product__row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.example-product__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.example-product__cat-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.example-product__cat-score {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  /* Holds a tier word ("Very Bad"), not a number, since 2026-08-10. */
  white-space: nowrap;
  text-align: right;
}

/* =========================================================
   Dynamic Insight Block (bottom-right)
   ========================================================= */
.values-insight {
  grid-column: 2;
  padding: 14px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  align-self: start;
}
.values-insight__eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0 0 8px;
}
.values-insight__text {
  font-size: 15px;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
}
.values-insight__text strong {
  font-style: normal;
  font-weight: 500;
  color: #2a4a2e;
}

/* =========================================================
   Donut Chart (SVG + controls)
   ========================================================= */
.score-editor__pie {
  flex-shrink: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.score-editor__pie svg {
  width: 180px;
  height: 180px;
  overflow: visible;
}
svg#weightsPie .wedge { cursor: pointer; transition: transform .15s ease, filter .15s ease; transform-origin: 100px 100px; }
svg#weightsPie .wedge:hover { transform: scale(1.04); filter: brightness(1.08) drop-shadow(0 2px 6px rgba(0,0,0,.15)); }
svg#weightsPie .wedge.selected { filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
svg#weightsPie .sub-slice { stroke: #fff; stroke-width: 1; }
.score-editor__pie-controls {
  display: none;
}
.pie-back-btn,
.pie-reset-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: var(--radius-pill);
  border: var(--border-subtle); background: #fff;
  font-weight: 600; font-size: 12px; color: var(--text-secondary);
  cursor: pointer; transition: all .15s;
  font-family: var(--font-body);
}
.pie-back-btn:hover, .pie-reset-btn:hover {
  background: #f3f4f6;
  color: var(--text-primary);
}
.pie-back-btn[hidden], .pie-reset-btn[hidden] { display: none; }

/* =========================================================
   Sliders (ESG weight bars – horizontal)
   ========================================================= */
.sliders-panel[hidden] { display: none; }
.score-editor__bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sliders-panel {
  display: flex; flex-direction: column; gap: 10px;
}
.slider-row {
  display: flex; flex-direction: row;
  align-items: center; gap: 10px; padding: 0;
}
.slider-row::before {
  content: ""; display: inline-block;
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.slider-row--env::before { background: var(--env); }
.slider-row--lab::before { background: var(--lab); }
.slider-row--com::before { background: var(--com); }
.slider-row__value {
  display: none;
}
.slider-row--env .slider-row__value { color: var(--env); }
.slider-row--lab .slider-row__value { color: var(--lab); }
.slider-row--com .slider-row__value { color: var(--com); }
.slider-row .weight-slider {
  writing-mode: horizontal-tb; direction: ltr;
  height: 8px; width: 100%; flex: 1;
}
.weight-slider, .sub-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; border-radius: 4px;
  background: #e5e7eb; outline: none; cursor: pointer;
  touch-action: none;
}
.weight-slider::-webkit-slider-thumb, .sub-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid #d1d5db;
  box-shadow: 0 1px 3px rgba(0,0,0,.15); cursor: grab;
}
.weight-slider::-moz-range-thumb, .sub-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid #d1d5db;
  box-shadow: 0 1px 3px rgba(0,0,0,.15); cursor: grab;
}
/* Category-colored slider thumb borders */
.legend-row[data-legend="env"] .weight-slider::-webkit-slider-thumb { border-color: var(--env); }
.legend-row[data-legend="env"] .weight-slider::-moz-range-thumb { border-color: var(--env); }
.legend-row[data-legend="lab"] .weight-slider::-webkit-slider-thumb { border-color: var(--lab); }
.legend-row[data-legend="lab"] .weight-slider::-moz-range-thumb { border-color: var(--lab); }
.legend-row[data-legend="com"] .weight-slider::-webkit-slider-thumb { border-color: var(--com); }
.legend-row[data-legend="com"] .weight-slider::-moz-range-thumb { border-color: var(--com); }

/* Sub-weight rows */
.sub-rows-container {
  display: flex; flex-direction: column; gap: 10px;
}
.sub-row {
  display: flex; flex-direction: row; align-items: center; gap: 10px;
}
.sub-row::before {
  content: ""; display: inline-block;
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  background: var(--row-color, #888);
}
.sub-row > label { display: none; }
.sub-slider-wrap {
  display: flex; flex-direction: row; align-items: center;
  gap: 10px; flex: 1;
}
.sub-slider-wrap .sub-slider {
  writing-mode: horizontal-tb; direction: ltr;
  height: 8px; width: 100%; border-radius: 4px;
}
.sub-slider__value {
  font-weight: 700; font-size: 14px; text-align: right;
  min-width: 42px; font-variant-numeric: tabular-nums;
}

/* Legacy swatches (hidden legend) */
.sw-env { background: var(--env); }
.sw-lab { background: var(--lab); }
.sw-com { background: var(--com); }
.bar-legend .swatch {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
}

/* =========================================================
   Preferences Section Header + Mode Toggle
   ========================================================= */
.prefs-section-header {
  margin-bottom: 20px;
}
.prefs-section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
  letter-spacing: -0.2px;
}
.prefs-section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

/* Mode toggle row */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.mode-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  border: 2px solid #e5e7eb;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}
.mode-toggle__btn:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}
.mode-toggle__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mode-toggle__btn[data-mode="0"] .mode-toggle__dot {
  border: 2px solid #9ca3af;
  background: transparent;
}
.mode-toggle__btn[data-mode="1"] .mode-toggle__dot {
  background: var(--amber);
}
.mode-toggle__btn[data-mode="2"] .mode-toggle__dot {
  background: var(--brand-dark);
}
/* Active mode button */
.mode-toggle__btn--active {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
  color: #fff;
}
.mode-toggle__btn--active[data-mode="0"] .mode-toggle__dot {
  border-color: rgba(255,255,255,0.5);
}
.mode-toggle__btn--active[data-mode="1"] {
  border-color: var(--amber);
  background: var(--amber);
  color: #fff;
}
.mode-toggle__btn--active[data-mode="1"] .mode-toggle__dot {
  background: #fff;
}
.mode-toggle__btn--active[data-mode="2"] .mode-toggle__dot {
  background: #fff;
}
.mode-toggle__hint {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 4px;
}

/* =========================================================
   Pill State Legend (small inline version)
   ========================================================= */
.pill-state-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 10px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.pill-state-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.pill-state-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.pill-state-swatch--off {
  border: 2px solid #9ca3af;
  background: transparent;
}
.pill-state-swatch--nice {
  background: var(--amber);
}
.pill-state-swatch--must {
  background: var(--brand-dark);
}

/* =========================================================
   Pill Section Headers
   ========================================================= */
.pill-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  margin-top: 20px;
}
.pill-section-header:first-of-type,
.pill-state-legend + .pill-section-header,
.mode-toggle + .pill-section-header {
  margin-top: 0;
}
/* Pill section icon badge */
.pill-section-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pill-section-badge svg {
  width: 14px;
  height: 14px;
}
.pill-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
  position: relative;
  padding-bottom: 4px;
}
/* Accent underline on group titles (60px colored bar) */
.pill-section-header:has(.pill-section-badge) .pill-section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.25;
}
.pill-section-header--sub .pill-section-title::after { display: none; }
.pill-section-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.pill-section-divider {
  border-top: var(--border-subtle);
  margin: 24px 0 8px;
}

/* =========================================================
   Preference Toggle Pills (3-state: off / nice-to-have / must-have)
   ========================================================= */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

/* Per-group colors for selected toggles (from category bubble palette) */
.pill-group[data-group-name="brand-values"],
.pill-group[data-group-name="survey-brand-values"]       { --group-color: #7a6a5a; --group-hover: #6a5a4a; --group-shadow: rgba(122,106,90,0.25); --group-pastel-bg: #f5f0ea; --group-pastel-border: #7a6a5a; --group-pastel-text: #5a4a3a; }
.pill-group[data-group-name="environmental"],
.pill-group[data-group-name="survey-environmental"]      { --group-color: #2e8b3e; --group-hover: #257a33; --group-shadow: rgba(46,139,62,0.25); --group-pastel-bg: #e8f5ea; --group-pastel-border: #2e8b3e; --group-pastel-text: #1a5a28; }
.pill-group[data-group-name="human-rights"],
.pill-group[data-group-name="survey-human-rights"]       { --group-color: #5a7a8a; --group-hover: #4a6a7a; --group-shadow: rgba(90,122,138,0.25); --group-pastel-bg: #eaf2f5; --group-pastel-border: #5a7a8a; --group-pastel-text: #3a5a6a; }
.pill-group[data-group-name="workplace-dei"],
.pill-group[data-group-name="survey-workplace-dei"]      { --group-color: #7a6e8a; --group-hover: #6a5e7a; --group-shadow: rgba(122,110,138,0.25); --group-pastel-bg: #f0edf3; --group-pastel-border: #7a6e8a; --group-pastel-text: #5a4e6a; }
.pill-group[data-group-name="animal-welfare"],
.pill-group[data-group-name="survey-animal-welfare"]     { --group-color: #8a6e6e; --group-hover: #7a5e5e; --group-shadow: rgba(138,110,110,0.25); --group-pastel-bg: #f3edec; --group-pastel-border: #8a6e6e; --group-pastel-text: #6a4e4e; }
.pill-group[data-group-name="governance"],
.pill-group[data-group-name="survey-governance"]         { --group-color: #5a6a8a; --group-hover: #4a5a7a; --group-shadow: rgba(90,106,138,0.25); --group-pastel-bg: #eceef3; --group-pastel-border: #5a6a8a; --group-pastel-text: #3a4a6a; }
.pill-group[data-group-name="health-safety"],
.pill-group[data-group-name="survey-health-safety"]      { --group-color: #5b8a72; --group-hover: #4b7a62; --group-shadow: rgba(91,138,114,0.25); --group-pastel-bg: #e0f0ea; --group-pastel-border: #5b8a72; --group-pastel-text: #2a5c42; }
.pill-group[data-group-name="certifications"],
.pill-group[data-group-name="survey-certifications"]     { --group-color: #8a7e5a; --group-hover: #7a6e4a; --group-shadow: rgba(138,126,90,0.25); --group-pastel-bg: #f3efe0; --group-pastel-border: #8a7e5a; --group-pastel-text: #5a4e2a; }
.pill-group[data-group-name="sustainability"],
.pill-group[data-group-name="survey-sustainability"]     { --group-color: #6a8a5a; --group-hover: #5a7a4a; --group-shadow: rgba(106,138,90,0.25); --group-pastel-bg: #e5f0e0; --group-pastel-border: #6a8a5a; --group-pastel-text: #3a5c1a; }
.pill-group[data-group-name="diet-food"],
.pill-group[data-group-name="survey-diet-food"]          { --group-color: #6e7f8a; --group-hover: #5e6f7a; --group-shadow: rgba(110,127,138,0.25); --group-pastel-bg: #e0e8f0; --group-pastel-border: #6e7f8a; --group-pastel-text: #3a5060; }
.pref-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  line-height: 1.2;
  border: none;
}
.pref-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s ease;
}
.pref-toggle__label {
  white-space: nowrap;
}

/* Tier 0 = off */
.pref-toggle[data-tier="0"] {
  border: 1.5px solid #d1d5db;
  color: var(--text-secondary);
  background: #fff;
}
.pref-toggle[data-tier="0"] .pref-toggle__icon {
  display: none;
}
.pref-toggle[data-tier="0"]:hover {
  border-color: #9ca3af;
  color: var(--text-primary);
  background: #f9fafb;
}

/* Selected. Binary on/off — there is no nice-to-have vs must-have split; a hard
   requirement is expressed as a deal-breaker (survey step 4). :not([data-tier="0"])
   rather than [data-tier="1"] so any legacy tier-2 value still renders as selected. */
.pref-toggle:not([data-tier="0"]) {
  background: var(--group-pastel-bg, #e8f5ea);
  border: 1.5px solid var(--group-pastel-border, #2e8b3e);
  color: var(--group-pastel-text, #1a5a28);
}
.pref-toggle:not([data-tier="0"]) .pref-toggle__label {
  color: var(--group-pastel-text, #1a5a28);
}
/* Text check, not an SVG — it inherits the group's pastel colour instead of baking one in */
.pref-toggle:not([data-tier="0"]) .pref-toggle__icon {
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
}
.pref-toggle:not([data-tier="0"]) .pref-toggle__icon::before {
  content: "\2713";
  font-weight: 700;
  color: var(--group-pastel-border, #2e8b3e);
}
.pref-toggle[data-tier="2"]:hover {
  background: var(--group-hover, var(--brand-sage));
  border-color: var(--group-hover, var(--brand-sage));
}

/* Save row */
/* display:flex would otherwise beat the [hidden] attribute on the survey's save hook */
.prefs-save-row[hidden] { display: none; }
.prefs-save-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: var(--border-subtle);
}

/* =========================================================
   About You Section (Redesign – accordion-based)
   ========================================================= */
.about-card--redesign {
  background: var(--card-bg);
  border-color: var(--card-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.about-card--redesign .profile-card__title {
  font-size: 18px;
}
.about-card--redesign .profile-card__subtitle {
  font-size: 13px;
  margin: 0 0 14px;
}
.about-card__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.about-card__body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.about-card__footer {
  padding-top: 8px;
  flex-shrink: 0;
}

/* About You accordion overrides */
.about-accordions {
  max-height: none;
  overflow-y: visible;
}
.about-acc__fields {
  gap: 12px;
}

/* Per-group accordion tints for About You */
.survey-acc[data-acc="about-personal"]   { --acc-tint: rgba(90,122,138,0.06); --acc-border: rgba(90,122,138,0.25); }
.survey-acc[data-acc="about-household"]  { --acc-tint: rgba(138,126,90,0.06); --acc-border: rgba(138,126,90,0.25); }
.survey-acc[data-acc="about-categories"] { --acc-tint: rgba(46,139,62,0.06);  --acc-border: rgba(46,139,62,0.25); }
.survey-acc[data-acc="about-values"]     { --acc-tint: rgba(122,110,138,0.06); --acc-border: rgba(122,110,138,0.25); }

.about-section-label {
  font-size: 11px;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin: 20px 0 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.about-section-label:first-of-type {
  margin-top: 0;
}
.about-you__grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.about-you__grid--2col {
  grid-template-columns: 1fr 1fr;
}
.about-you__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.about-you__select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-pill);
  background: #fafbfc;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.about-you__select:hover {
  border-color: #9ca3af;
  background: #fff;
}
.about-you__select:focus {
  outline: none;
  border-color: #9bd3b5;
  box-shadow: 0 0 0 3px rgba(155,211,181,0.2);
  background: #fff;
}
/* Filled state for dropdowns */
.about-you__select--filled {
  background: #e0f0e5;
  border-color: #9bd3b5;
  color: #1a5c2e;
  font-weight: 600;
}
.about-you__select--filled:hover {
  background: #d0e8d8;
  border-color: #7ac49a;
}

/* Progress bar */
.about-progress {
  margin-top: 20px;
  padding-top: 16px;
  border-top: var(--border-subtle);
}
.about-progress__label {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}
.about-progress__track {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}
.about-progress__fill {
  height: 100%;
  background: var(--brand-sage);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* About You pills (checkbox-based) */
.about-you__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.about-you__pills .fp-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid #d1d5db;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.about-you__pills .fp-pill:hover {
  border-color: #9ca3af;
  color: var(--text-primary);
  background: #f9fafb;
}
.about-you__pills .fp-pill:has(input:checked) {
  background: #e0f0e5;
  color: #1a5c2e;
  border-color: #9bd3b5;
  box-shadow: 0 1px 4px rgba(46,139,62,0.12);
}
.about-you__pills .fp-pill:has(input:checked):hover {
  background: #d0e8d8;
  border-color: #7ac49a;
}
.about-you__pills .fp-pill input[type="checkbox"] {
  width: 0; height: 0; opacity: 0;
  position: absolute; pointer-events: none;
}
.about-you__pills .fp-pill.at-max:not(:has(input:checked)) {
  opacity: 0.35; pointer-events: none;
}
.about-you__group-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 14px 0 8px;
}
.about-you__group-label:first-child { margin-top: 0; }
.about-you__actions {
  display: none;
}

/* =========================================================
   Deal-Breakers
   ========================================================= */
.dealbreakers-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.dealbreakers-badge {
  background: #fee2e2;
  color: #991b1b;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--font-body);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
/* Deal-breaker pill active state: red accent */
.about-you__pills--dealbreakers .fp-pill--negative:has(input:checked) {
  background: #fee2e2;
  border: 1.5px solid #f87171;
  color: #991b1b;
  box-shadow: none;
}
.about-you__pills--dealbreakers .fp-pill--negative:has(input:checked)::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  flex-shrink: 0;
  background: no-repeat center/contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23991b1b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E");
}
.about-you__pills--dealbreakers .fp-pill--negative:has(input:checked):hover {
  background: #fecaca;
}

/* =========================================================
   Saved Items
   ========================================================= */
.saved-items__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
}
.saved-items__empty-redesign {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 16px;
  text-align: center;
}
.saved-empty__heading {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 700;
  margin: 0;
}
.saved-empty__body {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 340px;
  line-height: 1.6;
  margin: 0;
}
.saved-empty__cta {
  display: inline-flex;
  align-items: center;
  padding: 10px 24px;
  border-radius: var(--radius-lg);
  background: var(--brand-dark);
  color: white;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  font-family: var(--font-body);
  transition: background 0.15s, transform 0.15s;
  margin-top: 4px;
}
.saved-empty__cta:hover {
  background: var(--brand-sage);
  transform: translateY(-1px);
}
/* Saved-item card — mirrors the supplier page "suggested replacements" cards */
.saved-items__grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.saved-item {
  position: relative;
  display: flex; flex-direction: column; align-items: stretch;
  padding: 0; border-radius: 10px; background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer; min-width: 0; text-decoration: none; color: inherit;
}
.saved-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  border-color: #d1d5db;
}

/* Image area */
.saved-item__image-wrap { position: relative; width: 100%; flex-shrink: 0; }
.saved-item__image {
  width: 100%; height: 110px; object-fit: contain;
  display: block; background: #fff;
  border-radius: 10px 10px 0 0; padding: 10px;
  box-sizing: border-box;
}

/* Score pill — overlaid on bottom-left of image */
.saved-item__score-pill {
  position: absolute; bottom: 8px; left: 8px;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(0,0,0,0.82); backdrop-filter: blur(4px);
  color: #fff; font-size: 12px; font-weight: 700; line-height: 1; z-index: 5;
}
.saved-item__pill-dot   { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.saved-item__pill-num   { font-weight: 800; font-size: 13px; }
.saved-item__pill-sep   { opacity: 0.5; font-size: 13px; }
.saved-item__pill-label { font-size: 9px; font-weight: 700; letter-spacing: 0.3px; opacity: 0.9; }

/* Heart / remove button (top-right of image) */
.saved-item__heart {
  position: absolute; top: 8px; right: 8px; z-index: 10;
  width: 28px; height: 28px; border: none; border-radius: 50%;
  background: rgba(255,255,255,0.9); backdrop-filter: blur(4px);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  padding: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.saved-item__heart:hover { transform: scale(1.15); box-shadow: 0 3px 12px rgba(0,0,0,0.18); background: #fff; }
.saved-item__heart svg {
  width: 14px; height: 14px; stroke: #999; fill: none; stroke-width: 2;
  transition: stroke 0.2s ease, fill 0.3s ease;
}
.saved-item__heart.hearted svg { stroke: #e91e63; fill: #e91e63; }

/* Content area */
.saved-item__content {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%;
  padding: 8px 10px 10px; box-sizing: border-box; flex: 1;
}
.saved-item__title { margin-bottom: 6px; width: 100%; }
.saved-item__title a {
  color: #000; text-decoration: none; font-weight: 600; font-size: .78rem; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
.saved-item__title a:hover { color: #1769AA; text-decoration: underline; }

.saved-item__footer {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin-top: auto; gap: 6px;
}
.saved-item__price {
  font-size: .78rem; font-weight: 600; color: #000; font-variant-numeric: tabular-nums;
}
.saved-items__empty {
  grid-column: 1 / -1; display: flex; flex-direction: column;
  align-items: center; gap: 6px; padding: 32px 16px; color: var(--text-muted);
}
.saved-items__empty p { margin: 0; font-size: 14px; font-weight: 600; }
.saved-items__pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.saved-items__page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid #e5e7eb; background: #fff;
  color: var(--text-secondary); font-size: 12px; cursor: pointer;
  transition: all .15s; font-family: inherit;
}
.saved-items__page-btn:hover:not(:disabled) { background: #f3f4f6; color: var(--text-primary); }
.saved-items__page-btn:disabled { opacity: 0.3; cursor: default; }
.saved-items__page-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }

/* =========================================================
   Help & Info Links
   ========================================================= */
.help-links {
  display: flex;
  flex-direction: column;
}
.help-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 8px;
  border-bottom: 1px solid #f3f4f6;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease;
  border-radius: 6px;
}
.help-link:hover {
  background: #f3f4f6;
}
.help-link--last {
  border-bottom: none;
}
.help-link span {
  flex: 1;
}
.help-link__arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}
.help-link svg:first-child {
  flex-shrink: 0;
  color: var(--text-muted);
}

/* =========================================================
   Mobile Responsive (< 768px)
   ========================================================= */
@media (max-width: 768px) {
  .profile-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .profile-sidebar {
    display: none;
  }
  .mobile-nav-scroller {
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: 10px 12px;
    background: #f0ebe1;
    border-bottom: 1px solid #e4ddd0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-nav-scroller::-webkit-scrollbar { display: none; }
  .mobile-nav-pill {
    padding: 7px 14px;
    border-radius: 999px;
    border: none;
    font-size: 13px;
    font-family: var(--font-body);
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
  }
  /* Rotating palette matching subcategory circles */
  .mobile-nav-pill:nth-child(1) { background: #2e8b3e; } /* green */
  .mobile-nav-pill:nth-child(2) { background: #5b8a72; } /* sage */
  .mobile-nav-pill:nth-child(3) { background: #7a6e8a; } /* muted purple */
  .mobile-nav-pill:nth-child(4) { background: #8a6e6e; } /* dusty rose */
  .mobile-nav-pill:nth-child(5) { background: #6e7f8a; } /* slate blue */
  .mobile-nav-pill:hover {
    opacity: 0.85;
  }
  .mobile-nav-pill--active {
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    outline: 2px solid #fff;
    outline-offset: -2px;
  }
  .mobile-nav-pill--active:hover {
    opacity: 1;
  }
  /* Fix sticky nav position — header is shorter on mobile */
  .category-nav { top: 56px; }
  /* Keep title + actions on same row on mobile */
  .values-card .profile-card__header { flex-direction: row; align-items: center; gap: 8px; }
  .values-card .values-card__actions { width: auto; flex-shrink: 0; }
  /* Mobile values: donut + example score side-by-side, sliders below */
  .values-chart-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 12px 16px;
    justify-items: stretch;
  }
  .values-chart-layout .values-divider {
    display: none;
  }
  .values-chart-layout .values-insight {
    display: none;
  }
  /* Show merged mobile subtitle, hide desktop one */
  .values-card .profile-card__subtitle {
    display: none;
  }
  .values-card .profile-card__subtitle-mobile {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 14px;
    line-height: 1.5;
  }
  .score-editor__pie {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    justify-self: start;
  }
  .score-editor__pie svg { width: 180px; height: 180px; }
  .example-product-card {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    padding: 8px 10px;
    max-width: 160px;
    justify-self: start;
  }
  /* Compact example score: hide labels, keep dot + score */
  .example-product__eyebrow {
    font-size: 9px;
    letter-spacing: 0.6px;
    margin-bottom: 2px;
  }
  .example-product__divider { display: none; }
  .example-product__headline { margin-bottom: 6px; }
  .example-product__number { font-size: 21px; }
  .example-product__of100 { font-size: 12px; }
  .example-product__rating { font-size: 10px; margin-top: 2px; }
  .example-product__breakdown { gap: 3px; }
  .example-product__row { gap: 5px; }
  .example-product__dot { width: 7px; height: 7px; }
  .example-product__cat-name { font-size: 11px; }
  .example-product__cat-score { font-size: 12px; }
  .values-chart__right {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  /* Legend rows: stack label above slider on narrow screens */
  .legend-row {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 10px;
    align-items: center;
  }
  .legend-row .legend-badge { grid-row: 1 / 3; }
  .legend-row .legend-label { grid-column: 2 / 4; font-size: 13px; }
  .legend-row .weight-slider { grid-column: 2; grid-row: 2; min-width: 0; }
  .legend-row .legend-value { grid-column: 3; grid-row: 2; }
  /* Remove nested scroll — let accordions expand naturally on mobile */
  .survey-accordions { max-height: none; overflow-y: visible; }
  .about-you__grid--2col {
    grid-template-columns: 1fr;
  }
  .welcome-banner { padding: 0 16px; }
  .welcome-banner__inner { padding: 20px 0; }
  .welcome-banner__greeting { font-size: 20px; }
  .welcome-banner__subtext { font-size: 15px; }
  .category-nav-link { padding: 10px 14px; font-size: 12px; }
  .category-nav-inner { justify-content: flex-start; padding: 0 8px; }
  .values-prefs-row { grid-template-columns: 1fr; min-height: auto; }
  /* The desktop row caps the survey card and scrolls it internally. Once the row
     stacks, that becomes a scroll box inside the page scroll — swipes get eaten
     and the action bar is hidden below the card's own fold. */
  .values-prefs-row .prefs-card {
    max-height: none;
    overflow-y: visible;
    order: -1;               /* survey is the onboarding path — show it before the weight editor */
  }
  .mode-toggle { flex-wrap: wrap; gap: 6px; }
  .mode-toggle__btn { padding: 8px 14px; font-size: 13px; }
  /* Survey bottom bar — pinned so Back/Next stay reachable in a now-tall card.
     Row 1: skip + count. Row 2: full-width actions. */
  .survey-bottom-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .06);
  }
  .survey-skip-link { order: 1; }
  .survey-selection-count { order: 2; flex: 1; text-align: right; }
  .survey-bottom-actions {
    order: 3;
    flex: 0 0 100%;
    display: flex;
    gap: 8px;
  }
  .survey-bottom-actions .survey-btn-save,
  .survey-bottom-actions .survey-btn-next,
  .survey-bottom-actions .survey-btn-finish {
    flex: 1;
    justify-content: center !important;
  }
  #surveyStatus { order: 4; flex: 0 0 100%; text-align: center; }
  #surveyStatus:empty { display: none; }
  /* Touch targets: pills were ~30px tall, under the 44px minimum */
  .survey-pill { min-height: 42px; }
  .pref-toggle { min-height: 40px; }
}

/* Extra small */
@media (max-width: 640px) {
  .btn-label-full { display: none; }
  .btn-label-short { display: inline; }
  .brand-header { padding: 12px 16px 10px; gap: 0; flex-wrap: wrap; }
  .brand-logo { height: 40px; max-width: 100px; order: 1; }
  .brand-actions { order: 2; margin-left: auto; gap: 6px; flex-wrap: nowrap; }
  .brand-header .auth-status { display: none; }
  .brand-header .btn-secondary { padding: 5px 8px; font-size: 12px; gap: 5px; white-space: nowrap; }
  .brand-header .btn-secondary svg { width: 14px; height: 14px; flex-shrink: 0; }
  #userProfileBtn { padding: 6px !important; }
  #userProfileBtn svg { width: 16px; height: 16px; }
  .cart-label { display: none !important; }
  .cart-btn { padding: 6px !important; }
  .cart-btn svg { width: 14px !important; height: 14px !important; }
  .btn-feedback { font-size: 0 !important; padding: 6px !important; gap: 0 !important; border: none; }
  .btn-feedback svg { width: 16px; height: 16px; flex-shrink: 0; }
  /* Fix sticky nav — header is even shorter at this breakpoint (~46px) */
  .category-nav { top: 46px; }

  .profile-card { padding: 16px; }
  .score-editor__pie svg { width: 150px; height: 150px; }
  .pref-toggle { padding: 5px 10px; font-size: 12px; }
  .example-product__number { font-size: 20px; }
  .example-product__cat-score { font-size: 11px; }

  /* Values card: tighter spacing */
  .values-card { padding: 14px; }
  /* Keep title + Reset/Save on same row */
  .values-card .profile-card__header { flex-direction: row; align-items: center; gap: 8px; }
  .values-card .values-card__actions { width: auto; flex-shrink: 0; }

  /* Legend row: ensure slider thumb is reachable */
  .legend-row .legend-label { font-size: 12px; }
  .legend-row .legend-value { font-size: 12px; min-width: 32px; }

  /* Survey card: tighter padding */
  .prefs-card { padding: 12px 0 !important; }
  .survey-pages { padding: 0 12px; }
  .survey-step-bar { padding: 8px 12px 0; }
  .survey-page__title { font-size: 17px; }
  .survey-page__desc { font-size: 12px; }
  .survey-acc__header { padding: 8px 10px; }
  .survey-acc__title { font-size: 14px; }
  .survey-acc__sub { font-size: 11px; }

  /* Mobile touch — larger slider thumbs */
  .weight-slider::-webkit-slider-thumb, .sub-slider::-webkit-slider-thumb {
    width: 24px; height: 24px;
    border: 2px solid rgba(0,0,0,.2);
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
  }
  .weight-slider::-moz-range-thumb, .sub-slider::-moz-range-thumb {
    width: 24px; height: 24px;
    border: 2px solid rgba(0,0,0,.2);
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
  }

  /* Mobile nav pills: slightly smaller */
  .mobile-nav-pill { padding: 6px 12px; font-size: 12px; }

  /* Insight text readable on small screens */
  .values-insight__text { font-size: 14px; line-height: 1.5; }
  .values-insight { padding: 12px; }
  .example-product-card { padding: 10px 12px; }
}

/* =========================================================
   Modal (preserved for purchasing habits + supplier preview)
   ========================================================= */
.modal-overlay[hidden] { display: none !important; }
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: grid; place-items: center;
  z-index: 2000;
}
.modal {
  width: min(960px, 94vw); max-height: 90vh;
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,.30);
  padding: 24px 26px; overflow: auto;
  position: relative; color: #000;
}
.modal__title {
  margin: 2px 0 12px; color: #000;
  font-weight: 700; font-size: 20px; line-height: 1.2;
}
.modal__content > .card {
  border: 1px solid rgba(0,0,0,.10);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  padding: 16px 16px 14px; background: #fff; color: #000;
}
.modal__close {
  position: absolute; top: 8px; right: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15); background: #fff;
  cursor: pointer; font-size: 18px; font-weight: 700;
}
.modal__close:hover { background: #f5f5f5; }
@media (max-width: 640px) {
  .modal { width: 98vw; max-height: 94vh; padding: 14px 12px; border-radius: 10px; }
}

/* =========================================================
   Product Modal (supplier preview from purchase history)
   ========================================================= */
.product-modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
  z-index: 10000;
}
.product-modal .modal-content {
  background: #fff; border-radius: 12px; padding: 24px;
  max-width: 600px; width: 90%;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3); animation: fadeIn 0.3s ease forwards;
}
.product-modal .modal-content--supplier-preview {
  max-width: 960px; width: 92vw; height: min(80vh, 720px);
  display: flex; flex-direction: column; padding: 0;
  position: relative; border: 8px solid #fff;
}
.btn-primary {
  background: var(--brand-dark); color: #fff; border-color: rgba(0,0,0,0.35);
}
.btn-primary:hover {
  background: var(--brand-sage); box-shadow: 0 2px 8px rgba(0,0,0,0.18); transform: translateY(-1px);
}
.btn-primary:focus-visible { outline: 2px solid #57b58c; outline-offset: 2px; }
.btn-secondary {
  background: rgba(0,0,0,0.06); color: #111; border-color: rgba(0,0,0,0.14);
}
.btn-secondary:hover { background: #e7eaee; box-shadow: 0 2px 8px rgba(0,0,0,0.12); transform: translateY(-1px); }
.btn-secondary:focus-visible { outline: 2px solid #b6c2d1; outline-offset: 2px; }
.modal-frame { display: block; width: 100%; height: 100%; border: 0; border-radius: 12px; }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* =========================================================
   Purchasing Habits Modal (card grid, preserved)
   ========================================================= */
.habits-date-group {
  grid-column: 1 / -1; font-size: 13px; font-weight: 700;
  color: var(--text-muted); padding: 6px 0 2px;
  border-bottom: 1px solid rgba(0,0,0,0.08); margin-bottom: 2px;
}
.habits-date-group:first-child { padding-top: 0; }
.habits-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.habits-card {
  background: #ffffff; color: #000;
  border: 1px solid rgba(0,0,0,0.1); border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column; padding: 12px;
  cursor: pointer; overflow: visible; position: relative; justify-content: space-between;
}
.habits-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(0,0,0,0.12); border-color: rgba(0,0,0,0.2); }
.habits-top { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; padding-bottom: 8px; }
.habits-image {
  width: 90px; height: 90px; object-fit: contain;
  background: #ffffff; border: 1px solid rgba(0,0,0,0.10);
  border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  padding: 6px; transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.habits-card:hover .habits-image { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.14); }
.habits-info {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; background: transparent; padding: 8px 10px;
  border-radius: 8px; min-width: 85px;
}
.habits-score { display: flex; align-items: center; justify-content: center; }
.habits-score .circular-score { width: 40px; height: 40px; flex-shrink: 0; }
.habits-price {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 5px 10px; border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.06); border: 1px solid rgba(0,0,0,0.14);
  font-weight: 700; font-variant-numeric: tabular-nums; color: #111; font-size: 14px;
}
.habits-stars { display: flex; align-items: center; justify-content: center; margin-top: 3px; }
.habits-stars .rating { display: inline-flex; align-items: center; gap: 4px; color: #666; }
.habits-stars .stars { display: inline-grid; grid-auto-flow: column; gap: 3px; }
.habits-stars .star { width: 13px; height: 13px; }
.habits-stars .star path { stroke: #f5a623; stroke-width: 1; fill: none; }
.habits-stars .star--empty path { fill: rgba(0,0,0,0.10); stroke: rgba(0,0,0,0.10); }
.habits-stars .star--full path, .habits-stars .star--half path { fill: #f5a623; stroke: #f5a623; }
.habits-stars .rating-count { font-size: 10px; color: #777; }
.habits-title {
  position: relative; margin-top: 8px; padding-top: 8px;
  font-size: 12px; font-weight: 600; text-align: center; line-height: 1.3;
}
.habits-title::before {
  content: ""; position: absolute; top: 0; left: 10%; right: 10%;
  height: 1px; background: rgba(0,0,0,0.12);
}
.habits-title a { color: #000; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.habits-title a:hover { color: var(--brand-sage); text-decoration: underline; }
.habits-title span { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.habits-date { font-size: 11px; font-weight: 600; color: var(--text-muted); text-align: center; margin-top: 6px; }
.habits-empty { grid-column: 1 / -1; color: #666; padding: 12px; text-align: center; }
.source-badge {
  position: absolute; bottom: -10px; right: 8px;
  font-size: 10px; font-weight: 700; padding: 4px 8px;
  border-radius: 6px; letter-spacing: 0.3px; z-index: 10;
}
.source-badge--amazon { background: var(--header-bg); color: #ffffff; box-shadow: 0 2px 6px rgba(7,41,8,0.3); }
.source-badge--target { background: linear-gradient(135deg, #cc0000 0%, #b30000 100%); color: #ffffff; box-shadow: 0 2px 6px rgba(204,0,0,0.25); }
.source-badge--walmart { background: linear-gradient(135deg, #0071ce 0%, #005fa3 100%); color: #ffffff; box-shadow: 0 2px 6px rgba(0,113,206,0.25); }
.habits-see-more {
  display: block; width: 100%; margin: 12px 0 4px; padding: 10px 16px;
  border-radius: var(--radius-lg); background: #f3f4f6; color: var(--brand-dark);
  border: 2px solid var(--brand-sage); font-weight: 700; font-size: 14px;
  cursor: pointer; transition: background .2s, transform .15s, box-shadow .2s;
}
.habits-see-more:hover:not(:disabled) { background: var(--brand-sage); color: #fff; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.habits-see-more:disabled { opacity: 0.6; cursor: not-allowed; }
@media (max-width: 640px) {
  .habits-list { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
  .habits-card { padding: 10px; }
  .habits-top { flex-direction: column; align-items: center; gap: 6px; padding-bottom: 4px; }
  .habits-image { width: 70px; height: 70px; padding: 4px; }
  .habits-info { width: 100%; display: grid; grid-template-columns: auto auto; gap: 4px 8px; justify-content: center; padding: 4px 0; }
  .habits-info .habits-stars { grid-column: 1 / -1; justify-content: center; }
  .habits-title { font-size: 11px; margin-top: 4px; padding-top: 4px; }
}

/* Tile loading spinner */
/* ---------- Purchase Tile ---------- */
.tile {
  min-height: auto;
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-sage), var(--env), var(--brand-sage));
  opacity: 0;
  transition: opacity .2s ease;
}
.tile:hover::before, .tile:focus-visible::before { opacity: 1; }
.tile:hover, .tile:focus-visible {
  box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 8px rgba(11,122,79,.08);
  transform: translateY(-2px);
  border-color: rgba(11,122,79,.2);
}
.tile__header {
  padding: 16px 16px 12px;
  margin: 0 0 4px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.tile__title { margin: 0; color: var(--text-primary); font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.tile__body { padding: 8px 16px 12px; display: grid; place-items: center; gap: 8px; }
.tile__footer { padding: 0 16px 16px; display: grid; place-items: center; min-height: 32px; }
.tile__more {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted); opacity: 0.5;
  user-select: none; pointer-events: none;
  transition: opacity .2s ease, color .2s ease;
  text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.tile:hover .tile__more, .tile:focus-visible .tile__more {
  opacity: 1; color: var(--brand-sage);
}

.tile-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; height: 100%; min-height: 180px;
  color: var(--text-muted); font-size: 13px; font-weight: 600;
}
/* boat loader (utils/page-loader.js mounts it); was a spinning ring */
.tile-spinner { width: 64px; aspect-ratio: 597 / 421; --leif-loader-bg: #fff; }
@keyframes tile-spin { to { transform: rotate(360deg); } }

/* Generic pill */
.pill {
  display: inline-block; background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.12); border-radius: var(--radius-pill);
  padding: 6px 12px; font-weight: 700; color: #000;
  font-size: 13px; font-variant-numeric: tabular-nums;
}

/* =========================================================
   Tutorial (preserved)
   ========================================================= */
.tut-overlay { position: fixed; inset: 0; z-index: 9999; pointer-events: none; }
.tut-overlay[hidden] { display: none !important; }
.tut-overlay > * { pointer-events: auto; }
.tut-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.65); transition: opacity .3s ease; }
.tut-spotlight {
  position: fixed; border-radius: 14px; border: 3px solid var(--brand-sage);
  transition: all .4s cubic-bezier(0.4,0,0.2,1); pointer-events: none; z-index: 10002;
}
.tut-spotlight::after {
  content: ''; position: absolute; inset: -6px; border-radius: 18px;
  border: 2px solid rgba(11,79,45,0.3); animation: tutPulse 2s ease-in-out infinite;
}
@keyframes tutPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.01); }
}
.tut-tooltip {
  position: fixed; z-index: 10001; background: #fff;
  border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.10);
  padding: 20px 22px 16px; max-width: 380px; min-width: 280px;
  transition: all .4s cubic-bezier(0.4,0,0.2,1);
  border: 1px solid rgba(0,0,0,0.08);
}
.tut-step-indicator { display: flex; gap: 6px; margin-bottom: 12px; }
.tut-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(0,0,0,0.12); transition: all .2s ease; }
.tut-dot.active { background: var(--brand-sage); transform: scale(1.25); }
.tut-dot.done { background: var(--brand-100); border: 1.5px solid var(--brand-sage); }
.tut-content h4 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--text-primary); }
.tut-content p { margin: 0 0 6px; font-size: 13px; line-height: 1.55; color: var(--text-secondary); }
.tut-content .tut-action {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 6px;
  padding: 5px 12px; border-radius: var(--radius-pill); background: #f3f4f6;
  color: var(--brand-dark); font-weight: 700; font-size: 12px;
  border: 1px solid #e5e7eb;
}
.tut-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(0,0,0,0.06);
}
.tut-btn { border: none; border-radius: var(--radius-pill); cursor: pointer; font-weight: 600; font-size: 13px; transition: all .2s ease; }
.tut-btn--skip { background: transparent; color: var(--text-muted); padding: 6px 12px; }
.tut-btn--skip:hover { color: var(--text-primary); background: rgba(0,0,0,0.04); }
.tut-btn--next { background: var(--brand-dark); color: #fff; padding: 8px 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.tut-btn--next:hover:not(:disabled) { background: var(--brand-sage); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.25); }
.tut-btn--locked { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
@media (max-width: 700px) {
  .tut-tooltip { max-width: calc(100vw - 24px); min-width: unset; padding: 14px 14px 10px; }
  .tut-content { max-height: calc(100vh - 200px); overflow-y: auto; }
  .tut-content h4 { font-size: 15px; }
  .tut-content p { font-size: 12px; line-height: 1.45; margin-bottom: 6px; }
  .tut-content .tut-action { font-size: 11px; padding: 5px 10px; }
  .tut-actions { margin-top: 10px; padding-top: 8px; }
  .tut-btn { font-size: 13px; padding: 7px 14px; }
  .tut-step-indicator { margin-bottom: 8px; }
}

/* =========================================================
   Legacy compat (elements referenced by JS but hidden/removed)
   ========================================================= */
.card { background: var(--card-bg); border: var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 18px; }
fieldset { border: 1px solid rgba(0,0,0,.10); border-radius: 10px; padding: 16px; background: #fff; }
legend { font-weight: 600; color: #000; padding: 0 6px; }
.stack { display: grid; gap: 12px; }
label { font-weight: 500; color: var(--text-secondary); }
.actions { display: none; }
.filter-tier-hint {
  width: 100%; font-size: 12px; font-weight: 500;
  color: var(--text-muted); margin: 0; padding: 8px 20px 0; line-height: 1.4;
}
.filter-group-label {
  width: 100%; margin: 8px 0 2px; padding: 0;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
}
.filter-group-label:first-of-type { margin-top: 0; }

/* Score-related tiles (removed but CSS kept for JS-generated content in modal) */
.score-tile-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 2px 8px; width: 100%; }
.score-wheels-row { display: flex; justify-content: center; align-items: flex-start; gap: 24px; width: 100%; }
.score-wheel-col { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.score-wheel-mount { width: 88px; height: 88px; display: grid; place-items: center; }
.score-wheel-caption { font-size: 12px; font-weight: 700; color: var(--text-primary); text-align: center; }
.score-wheel-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-pill); font-weight: 700; font-size: 11px; }

/* Tier chip — replaces the 0-100 score wheel in the Purchases tile (2026-08-10). */
.tier-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}
.tier-chip--empty {
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
  border: 1.5px dashed #d6d6d6;
  font-size: 12px;
  font-weight: 600;
}

/* Distribution of purchases across rungs — the honest form of an "average"
   when the ladder has six values and the sample is small. */
.tier-distro {
  width: 100%;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tier-distro__bar {
  display: flex;
  width: 100%;
  height: 9px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.05);
}
.tier-distro__seg { height: 100%; }
.tier-distro__seg:not(:last-child) { border-right: 1px solid #fff; }
.tier-distro__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
}
.tier-distro__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.tier-distro__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Purchase-history card: tier chip in place of the small score wheel. */
.habits-score--tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.3;
}
.score-trend-chart-wrap { width: 100%; display: flex; justify-content: center; padding: 0; margin-top: 0; }
.trend-chart-svg { display: block; border-radius: 10px; background: rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.06); }
.trend-chart-empty { color: var(--text-muted); font-size: 12px; font-weight: 600; text-align: center; padding: 16px 8px; }
.breakdown-body { display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 60px; }
.breakdown-list { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.breakdown-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(0,0,0,0.03); position: relative; overflow: hidden;
}
.breakdown-pct {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px;
}
.breakdown-name { flex: 1; font-weight: 700; font-size: 13px; color: var(--text-primary); }
.breakdown-count { flex-shrink: 0; font-weight: 600; font-size: 12px; color: var(--text-muted); }
.breakdown-empty { color: var(--text-muted); font-size: 13px; font-weight: 600; text-align: center; padding: 32px 8px; }

/* ---------- Purchases Row Layout ---------- */
.purchases-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
  /* Match sidebar height — sidebar card is sticky with ~padding+nav+auth */
  max-height: 480px;
}
.purchases-row > .tile {
  min-height: 0;
  overflow: hidden;
}
.purchases-row > .tile .tile__body {
  overflow-y: auto;
  min-height: 0;
}
.purchases-breakdown-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0 !important;
}
.purchases-breakdown-card .breakdown-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
@media (max-width: 768px) {
  .purchases-row {
    grid-template-columns: 1fr;
    max-height: none;
  }
  .purchases-breakdown-card .breakdown-body {
    max-height: 320px;
  }
  .breakdown-list {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Extra-small Mobile (max-width: 414px)
   ========================================================= */
@media (max-width: 414px) {
  /* Header: compact buttons with labels */
  .brand-header .btn-secondary { padding: 4px 6px !important; font-size: 10px !important; gap: 3px !important; }
  #signInBtn, #signOutBtn { font-size: 10px !important; padding: 4px 6px !important; }

  .example-product__number { font-size: 20px; }
  .example-product__of100 { font-size: 11px; }

  /* Mode toggle wrap to 2 columns */
  .mode-toggle { flex-wrap: wrap; }
  .mode-toggle__btn { padding: 8px 12px; font-size: 12px; flex: 1 1 calc(50% - 3px); }

  /* Saved items grid single column */
  .saved-items__grid { grid-template-columns: 1fr; gap: 8px; }

  /* Habits cards single column.
     The 640px rules stack the card contents into a centered column, which is
     right for a 2-up narrow card but absurd once the card is full-width —
     a small centered image over centered meta with gaps everywhere. Go back
     to a horizontal row: image left, meta right, text left-aligned. */
  .habits-list { grid-template-columns: 1fr !important; gap: 10px; }
  .habits-card { padding: 10px 12px; }
  .habits-top {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding-bottom: 6px;
  }
  .habits-image { width: 64px; height: 64px; flex-shrink: 0; }
  .habits-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px 8px;
    padding: 0;
  }
  .habits-info .habits-stars {
    flex: 0 0 100%;
    justify-content: flex-start;
    margin-top: 0;
  }
  .habits-title { text-align: left; }
  .habits-title::before { left: 0; right: 0; }
  .habits-date { text-align: left; }
  /* Badge overhangs the card edge by design on desktop; inline it on mobile */
  .source-badge {
    position: static;
    align-self: flex-end;
    margin-top: 6px;
    box-shadow: none;
  }

  /* Profile card tighter padding */
  .profile-card { padding: 12px; margin-bottom: 12px; }

  /* Welcome banner smaller */
  .welcome-banner { padding: 0 12px; }
  .welcome-banner__greeting { font-size: 18px; }
  .welcome-banner__subtext { font-size: 13px; line-height: 1.4; }
  .welcome-banner__eyebrow { font-size: 10px; }

  /* Container breathing room */
  .container { padding: 0 8px 40px; }

  /* Donut chart — keep reasonable size, still side-by-side */
  .score-editor__pie svg { width: 120px; height: 120px; }
  .example-product-card { max-width: 130px; padding: 6px 8px; }

  /* Survey: Back + Next share one row — the bar is sticky, vertical space is scarce */
  .survey-bottom-actions { flex-direction: row; }
  .survey-bottom-actions .survey-btn-back { flex: 0 0 auto; }
  .survey-bottom-actions .survey-btn-save,
  .survey-bottom-actions .survey-btn-next,
  .survey-bottom-actions .survey-btn-finish {
    flex: 1;
    text-align: center;
    justify-content: center !important;
  }

  /* Mobile nav pills */
  .mobile-nav-scroller { padding: 6px 8px; gap: 4px; }
  .mobile-nav-pill { padding: 5px 10px; font-size: 11px; }

  /* Modal tighter */
  .modal { width: 98vw; padding: 12px 10px; }
}

/* Spacing helpers */
.mb-0 { margin-bottom: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px !important; }
.mt-12 { margin-top: 12px !important; }

/* Auth gate overlay */
.auth-gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.auth-gate-dialog {
  background: #fff;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 380px;
  width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  text-align: center;
}
.auth-gate-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.auth-gate-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 20px;
}
.auth-gate-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.auth-gate-btn {
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: 8px;
  padding: 10px 22px;
  cursor: pointer;
  border: none;
  transition: background 0.2s, color 0.2s;
}
.auth-gate-btn--primary {
  background: var(--brand-sage, #2e8b3e);
  color: #fff;
}
.auth-gate-btn--primary:hover {
  background: var(--brand-dark, #1a5c2e);
}
.auth-gate-btn--secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle-color, #d1d5db);
}
.auth-gate-btn--secondary:hover {
  background: var(--surface-hover, #f5f5f5);
}

/* =========================================================
   Tune Recommendations section
   ========================================================= */
.tune-card {
  padding: 28px;
}
.tune-section-header {
  margin-bottom: 8px;
}
.tune-block {
  padding: 20px 0;
  border-top: 1px solid var(--border-subtle, #e5e7eb);
}
.tune-block:first-of-type {
  border-top: none;
  padding-top: 8px;
}
.tune-block-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #111827);
  margin: 0 0 4px;
}
.tune-block-desc {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  margin: 0 0 12px;
  line-height: 1.45;
}

/* Pill grids — scoped so this section doesn't inherit from elsewhere */
#section-tune .pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#section-tune .pill-grid .fp-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(0,0,0,0.10);
  background: #ffffff;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  gap: 6px;
}
#section-tune .pill-grid .fp-pill input[type="checkbox"] {
  width: 0; height: 0; opacity: 0; position: absolute; pointer-events: none;
}
#section-tune .pill-grid .fp-pill:hover {
  border-color: #999;
  background: #f7f7f7;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Deal-breakers (red/negative) */
#tuneDealBreakers .fp-pill:has(input:checked) {
  background: #fce8e8; color: #7a2a2a; border-color: #c55a5a;
  box-shadow: 0 2px 6px rgba(197,90,90,0.12);
  text-decoration: line-through;
  text-decoration-color: rgba(122, 42, 42, 0.45);
  text-decoration-thickness: 1.5px;
}

/* Lifestyle (warm neutral) */
#tuneLifestyle .fp-pill:has(input:checked) {
  background: #f5f0ea; color: #5a4a3a; border-color: #7a6a5a;
  box-shadow: 0 2px 6px rgba(122,106,90,0.12);
}

/* Made-where (teal) */
#tuneMadeWhereAllow .fp-pill:has(input:checked) {
  background: #e6f3f0; color: #1a5a4a; border-color: #2a8a7a;
  box-shadow: 0 2px 6px rgba(42,138,122,0.12);
}

/* Brand chip input */
.tune-tag-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.tune-input {
  flex: 1;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1.5px solid rgba(0,0,0,0.12);
  background: #fff;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary, #111827);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tune-input:focus {
  outline: none;
  border-color: var(--brand-sage, #2e8b3e);
  box-shadow: 0 0 0 3px rgba(46,139,62,0.15);
}
.tune-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 4px;
}
.tune-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px 5px 12px;
  border-radius: 999px;
  background: #f0f4f1;
  color: #1a5c2e;
  border: 1px solid rgba(46,139,62,0.18);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
#tuneBlocklistChips .tune-chip {
  background: #fce8e8;
  color: #7a2a2a;
  border-color: rgba(197,90,90,0.25);
}
.tune-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.6;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.tune-chip__remove:hover {
  opacity: 1;
  background: rgba(0,0,0,0.06);
}

.tune-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle, #e5e7eb);
}

@media (max-width: 640px) {
  .tune-card { padding: 20px 16px; }
  .tune-block { padding: 16px 0; }
  .tune-block-title { font-size: 14px; }
}

/* =========================================================
   Delete Account / Danger Zone
   ========================================================= */
.profile-card--danger {
  margin-top: 18px;
  border: 1px solid #f3c2c2;
  background: #fff7f7;
}
.profile-card--danger .profile-card__title { color: #b42318; }
.profile-card--danger .profile-card__subtitle { color: #6b3a3a; }

.danger-zone__signedout {
  font-size: 13px;
  color: #6b3a3a;
  margin-top: 8px;
}
.danger-zone__signedout a { color: #b42318; text-decoration: underline; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #b42318;
  background: #fff;
  color: #b42318;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 12px;
}
.btn-danger:hover:not(:disabled) { background: #b42318; color: #fff; }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* Modal */
.delete-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.delete-modal[hidden] { display: none; }
.delete-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.delete-modal__panel {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: min(440px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.delete-modal__title {
  margin: 0 0 12px 0;
  font-size: 20px;
  color: #b42318;
}
.delete-modal__body {
  margin: 8px 0;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}
.delete-modal__list {
  margin: 8px 0 12px 18px;
  padding: 0;
  font-size: 14px;
  color: #333;
}
.delete-modal__input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  margin-top: 4px;
  font-family: inherit;
}
.delete-modal__input:focus {
  outline: none;
  border-color: #b42318;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.15);
}
.delete-modal__error {
  color: #b42318;
  font-size: 13px;
  margin: 10px 0 0 0;
  min-height: 1.2em;
}
.delete-modal__error a { color: #b42318; text-decoration: underline; }
.delete-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
