:root{
  color-scheme: light;
  --bg0:#f6f8ff;
  --bg1:#f2fbff;
  --card:#ffffffcc;
  --cardSolid:#ffffff;
  --stroke: rgba(15,23,42,.10);
  --stroke2: rgba(15,23,42,.08);
  --ink:#0f172a;
  --muted:#475569;
  --muted2:#4a5362;
  --a:#4fd1c5;
  --b:#7aa7ff;
  --c:#c4b5fd;
  --danger:#ef4444;
  --ok:#22c55e;
  --shadow-sm: 0 6px 18px rgba(15,23,42,.08);
  --shadow-md: 0 14px 38px rgba(15,23,42,.12);
  --shadow-lg: 0 26px 70px rgba(15,23,42,.16);
  --radius: 18px;
  --radius-lg: 26px;
  --focus: 0 0 0 4px rgba(122,167,255,.28);
  
  /* Global accessibility: minimum tap target */
  --tap-target-min: 44px;
  --transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Global overflow clamp - prevent horizontal scroll at root */
html, body {
  width: 100%;
  overflow-x: clip; /* Modern browsers */
  overflow-x: hidden; /* Fallback for older browsers */
}

/* Disable animations/transitions during resize to prevent stuttering */
/* Only applies to fine pointer devices (desktop) - mobile never loses animations */
@media (pointer: fine) {
  html.is-resizing *,
  html.is-resizing *::before,
  html.is-resizing *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  html.is-resizing .bg-gradient {
    animation: none !important;
    filter: none !important;
    transform: none !important;
  }

  html.is-resizing .fade-in,
  html.is-resizing .reveal,
  html.is-resizing .search-section.is-revealed .fade-in {
    opacity: 1 !important;
    transform: none !important;
  }
}

html{
  height:100%;
  overflow-x: clip; /* Modern - prevents horizontal scroll */
  overflow-x: hidden; /* Fallback */
  width: 100%;
}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--ink);
  background: var(--bg0);
  overflow-x: clip; /* Modern - prevents horizontal scroll */
  overflow-x: hidden; /* Fallback */
  line-height:1.6;
  width: 100%;
  max-width: 100%; /* Changed from 100vw to prevent horizontal scroll */
}

.bg-gradient{
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(79,209,197,0.22), transparent 52%),
    radial-gradient(circle at 82% 55%, rgba(122,167,255,0.18), transparent 54%),
    radial-gradient(circle at 38% 86%, rgba(196,181,253,0.16), transparent 56%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  animation: gradientShift 18s ease-in-out infinite;
  /* CRITICAL: Only use will-change when actually animating - reduces compositing overhead */
  /* transform: translateZ(0) promotes to GPU layer but can cause unnecessary repaints */
  /* Let the browser decide compositing strategy for better performance */
  /* Decorative element - ensure it doesn't affect layout */
  pointer-events: none;
  width: 100%;
  height: 100%;
}
@keyframes gradientShift{
  0%,100%{ transform: scale(1) rotate(0deg); opacity: 1; }
  50%{ transform: scale(1.04) rotate(1deg); opacity: .96; }
}

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  .bg-gradient{ animation: none !important; }
}

.sr-only{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

.skip-link{
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--a);
  color: white;
  padding: 10px;
  z-index: 100;
  text-decoration: none;
  font-weight: 700;
  border-radius: 0 0 8px 0;
}

.skip-link:focus{
  top: 0;
}

a{color:inherit}
.container{
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 18px;
  padding-right: 18px;
  width: 100%;
  overflow-x: clip; /* Modern */
  overflow-x: hidden; /* Fallback */
}

/* Mobile container centering guarantee */
/* Container mobile padding moved to consolidated @media (max-width: 640px) block */

.crisis-banner{
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, rgba(239,68,68,.92), rgba(190,18,60,.92));
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.20);
  box-shadow: 0 10px 30px rgba(239,68,68,.18);
  width: 100%;
  max-width: 100%; /* Changed from 100vw to prevent horizontal scroll */
  overflow-x: clip; /* Modern */
  overflow-x: hidden; /* Fallback */
  /* Safe area padding for iPhone notch */
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

/* Phase 3: Optimize sticky crisis banner for mobile */
@media (pointer: coarse) {
  .crisis-banner {
    /* CRITICAL FIX: Disable sticky positioning - causes scroll jank */
    position: relative !important;
    /* Remove shadow entirely - expensive on scroll */
    box-shadow: none !important;
  }
}
.crisis-banner .inner{
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 18px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 12px;
  flex-wrap:wrap;
  font-weight: 700;
  letter-spacing: -.01em;
  text-align:center;
  font-size: 13px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.crisis-banner a{
  color:#fff;
  text-decoration:none;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.20);
  transition: var(--transition);
  font-weight: 800;
}
.crisis-banner a:hover{ transform: translateY(-1px); background: rgba(255,255,255,.26); }

header{
  padding: 26px 0 18px;
}

.header-content{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 18px;
  flex-wrap:wrap;
  max-width: 100%;
}

.brand{
  display:flex;
  align-items:center;
  gap: 14px;
}
.mark{
  display: block;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  flex: 0 0 auto;
  line-height: 0;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(42, 157, 143, 0.22);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.mark:hover{
  box-shadow: 0 10px 24px rgba(42, 157, 143, 0.28);
}
.mark:focus-visible{
  outline: 2px solid var(--a, #2a9d8f);
  outline-offset: 3px;
}
.mark img{
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 16px;
}

.brand .kicker{
  font-size: 13px;
  color: var(--muted2);
  font-weight: 800;
  letter-spacing: .02em;
  margin:0;
}
.brand .title{
  font-size: 20px;
  font-weight: 950;
  letter-spacing: -.03em;
  margin:0;
  line-height: 1.15;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.74);
  box-shadow: var(--shadow-sm);
  color: var(--muted);
  font-size: 13px;
  white-space:nowrap;
}
.pill .dot{
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--a), var(--b));
  box-shadow: 0 0 0 4px rgba(79,209,197,.18);
}

.triage-split{
  margin: 20px 0 30px;
  padding: 24px 0;
}

.triage-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
  max-width: 100%;
}

/* Mobile-first: single column for all grids at <= 600px */
@media (max-width: 600px){
  .triage-grid{ 
    grid-template-columns: 1fr !important; 
    width: 100%;
    max-width: 100%;
  }
  
  .trust-grid {
    grid-template-columns: 1fr !important;
  }
  
  .specialized-resources-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Results grid already single-column at 640px, ensure it's enforced */
  .grid {
    flex-direction: column;
  }
  
  .grid > .card, .grid > .skeleton {
    flex-basis: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important; /* Critical for text wrapping */
  }
  
  /* Hero single column on mobile */
  .hero {
    grid-template-columns: 1fr !important;
  }
  
  /* Hide or simplify decorative hero-visual on very small screens if needed */
  @media (max-width: 430px) {
    .hero-visual {
      min-height: 200px; /* Reduce height on very small screens */
    }
    
    .floating-card {
      width: min(180px, 80%); /* Smaller on very small screens */
    }
  }
}

.triage-card{
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--stroke);
  background: rgba(255,255,255,.85);
  box-shadow: var(--shadow-lg);
  text-align: center;
  transition: var(--transition);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.triage-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 20px 60px rgba(15,23,42,.15);
}

.triage-card.emergency{
  border-color: rgba(239,68,68,.40);
  background: linear-gradient(135deg, rgba(239,68,68,.08), rgba(239,68,68,.04));
}

.triage-card.planning{
  border-color: rgba(79,209,197,.35);
  background: linear-gradient(135deg, rgba(79,209,197,.08), rgba(122,167,255,.06));
}

.triage-icon{
  font-size: 48px;
  margin-bottom: 12px;
}

.triage-card h2{
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 900;
}

.triage-card p{
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.btn-emergency{
  display: block;
  width: 100%;
  padding: 16px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  text-decoration: none;
  border-radius: 14px;
  font-weight: 900;
  font-size: 18px;
  border: none;
  box-shadow: 0 16px 40px rgba(239,68,68,.30);
  animation: pulse 2s ease-in-out infinite;
  cursor: pointer;
  min-height: 44px;
}

@keyframes pulse{
  0%, 100%{ transform: scale(1); }
  50%{ transform: scale(1.02); }
}

.btn-emergency:hover{
  box-shadow: 0 20px 50px rgba(239,68,68,.40);
}

.btn-secondary{
  width: 100%;
  padding: 12px;
  background: rgba(255,255,255,.85);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
  min-height: 44px;
  transition: var(--transition);
}

.btn-secondary:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.trust-strip{
  margin: 20px 0;
  padding: 20px;
  background: linear-gradient(135deg, rgba(79,209,197,.08), rgba(122,167,255,.08));
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke2);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.hero-gateway .trust-strip {
  margin-left: 0;
  margin-right: 0;
}

.trust-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 100%;
}

/* Specialized Resources Section */
.specialized-resources-section {
  margin: 40px 0;
  padding: 32px 0;
}

.specialized-resources-section h2 {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 900;
  margin: 0 0 12px 0;
  text-align: center;
}

.specialized-resources-section > p {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 28px 0;
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
}

.specialized-resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 100%;
}

.specialized-resource-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--stroke);
  background: rgba(255,255,255,.85);
  box-shadow: var(--shadow-md);
  text-align: center;
  transition: var(--transition);
}

.specialized-resource-card h3 {
  font-size: 20px;
  font-weight: 900;
  margin: 0 0 8px 0;
  color: var(--ink);
}

.specialized-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 20px 0;
  line-height: 1.5;
}

.specialized-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.specialized-buttons .filter-preset-btn {
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.92);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
  box-sizing: border-box;
}

.specialized-buttons .filter-preset-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  background: rgba(255,255,255,.98);
  border-color: rgba(122,167,255,.35);
}

.specialized-buttons .filter-preset-btn:active {
  transform: translateY(0);
}

.trust-item{
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: rgba(255,255,255,.70);
  border-radius: 14px;
  border: 1px solid var(--stroke);
}

.trust-icon{
  font-size: 24px;
  flex: 0 0 auto;
}

.trust-text strong{
  display: block;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 2px;
}

.trust-text span{
  font-size: 12px;
  color: var(--muted);
}

.hero{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
  align-items: stretch;
  margin-top: 16px;
  width: 100%;
  max-width: 100%;
}
@media (max-width: 980px){ 
  .hero{ 
    grid-template-columns: 1fr; 
    width: 100%;
    max-width: 100%;
  } 
}

.hero-copy{
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke2);
  background: linear-gradient(135deg, rgba(255,255,255,.78), rgba(255,255,255,.52));
  /* CRITICAL: Reduce backdrop-filter blur on desktop - 12px is expensive */
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-md);
  overflow:hidden;
  padding: 22px;
  position: relative;
}

h1{
  margin: 0;
  font-size: clamp(26px, 4.5vw, 40px);
  line-height: 1.08;
  letter-spacing: -.03em;
}
.sub{
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 70ch;
}

.hero-bullets{
  margin-top: 14px;
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
}
.hero-bullets .chip{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.78);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  user-select:none;
  min-height: 44px;
}
.chip input{ accent-color: #5b8cff; }

/* Visually hidden but accessible for screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Multi-chip container for SUD Services */
.multi-chip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

/* Chip checkbox style - matches existing chip design */
.chip-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.78);
  font-size: 13px;
  color: var(--muted);
  box-shadow: 0 2px 8px rgba(15,23,42,.04);
  user-select: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  position: relative;
}

.chip-check:hover {
  background: rgba(255,255,255,.92);
  box-shadow: 0 4px 12px rgba(15,23,42,.08);
  transform: translateY(-1px);
}

.chip-check:active {
  transform: translateY(0);
}

.chip-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
}

.chip-check input[type="checkbox"]:focus + span,
.chip-check:focus-within {
  outline: 2px solid #5b8cff;
  outline-offset: 2px;
}

/* Selected state */
.chip-check input[type="checkbox"]:checked + span {
  font-weight: 700;
  color: var(--ink);
}

.chip-check input[type="checkbox"]:checked ~ span::before,
.chip-check:has(input[type="checkbox"]:checked) {
  background: rgba(91, 140, 255, 0.1);
  border-color: #5b8cff;
  box-shadow: 0 2px 8px rgba(91, 140, 255, 0.15);
}

.chip-check:has(input[type="checkbox"]:checked) span::after {
  content: "✓";
  margin-left: 6px;
  color: #5b8cff;
  font-weight: 700;
}

/* Clear button for chip groups */
.chip-clear-btn {
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 0;
  transition: color 0.2s ease;
}

.chip-clear-btn:hover {
  color: var(--ink);
}

.chip-clear-btn:focus {
  outline: 2px solid #5b8cff;
  outline-offset: 2px;
  border-radius: 2px;
}

.hero-visual{
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke2);
  background: linear-gradient(135deg, rgba(79,209,197,.14), rgba(196,181,253,.14));
  box-shadow: var(--shadow-md);
  position:relative;
  overflow:hidden;
  min-height: 260px;
  display:flex;
  align-items:center;
  justify-content:center;
  /* Ensure it doesn't cause horizontal overflow */
  max-width: 100%;
  width: 100%;
}

.floating-card{
  position:absolute;
  background: rgba(255,255,255,.80);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 14px 14px;
  box-shadow: var(--shadow-lg);
  /* Decorative element - ensure it doesn't affect layout or overlap content */
  pointer-events: none;
  z-index: 1; /* Below content but above background */
  animation: float 6.5s ease-in-out infinite;
  /* CRITICAL: Reduce backdrop-filter blur on desktop - 14px is very expensive */
  /* Use lighter blur or remove if performance is still an issue */
  backdrop-filter: blur(8px);
  width: min(220px, 72%);
  /* Optimize: Only use will-change when animating */
  will-change: transform;
}
.floating-card strong{
  display:block;
  font-size: 13px;
  letter-spacing: -.01em;
  margin-bottom: 4px;
}
.floating-card span{
  display:block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

@keyframes float{
  0%,100%{ transform: translateY(0) rotate(0deg); }
  50%{ transform: translateY(-16px) rotate(1.5deg); }
}

.floating-card:nth-child(1){
  top: 14%;
  left: 10%;
  z-index: 3;
  animation-delay: 0s;
}
.floating-card:nth-child(2){
  top: 38%;
  right: 8%;
  z-index: 1;
  transform: scale(.98);
  opacity: .92;
  animation-delay: 1.2s;
}
.floating-card:nth-child(3){
  bottom: 10%;
  left: 14%;
  z-index: 2;
  animation-delay: 2.2s;
}

.search-section{
  margin: -34px 0 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.80);
  box-shadow: var(--shadow-lg);
  /* CRITICAL: Reduce backdrop-filter blur on desktop - 16px is very expensive */
  backdrop-filter: blur(8px);
  padding: 18px;
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  /* Ensure it stays within container bounds */
  margin-left: 0;
  margin-right: 0;
}

/* Phase 3: Optimize sticky search section for mobile */
/* NOTE: Mobile layout rules moved to consolidated @media (max-width: 640px) block */
/* This block only handles performance optimizations for touch devices */
@media (pointer: coarse) {
  .search-section {
    /* Performance: disable expensive effects on touch devices */
    box-shadow: none !important;
    backdrop-filter: none !important;
    background: rgba(255,255,255,.95) !important;
    will-change: auto !important;
    transform: none !important;
  }
  
  /* Hide hero-visual container on mobile - floating cards are hidden, so container is empty */
  .hero-visual {
    display: none !important;
    min-height: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* ========== COMPREHENSIVE MOBILE UI/UX OPTIMIZATION ========== */
  
  /* Fix card text overflow and prevent overlap */
  .card {
    padding: 16px !important;
    margin-bottom: 12px !important;
  }
  
  /* Improve card layout - less flat, better visual hierarchy */
  .card-meta-header {
    margin-bottom: 12px !important;
  }
  
  .badgeRow {
    max-width: 100% !important;
    margin: 0 0 10px !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
  }
  
  .cardTop {
    gap: 12px !important;
    align-items: flex-start !important;
    flex-wrap: nowrap !important;
    margin-top: 4px !important; /* Add breathing room from badges */
  }
  
  /* Text container with better spacing */
  .cardTop > div {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    padding-right: 8px !important; /* Space before expand button */
  }
  
  .pname {
    font-size: 16px !important;
    line-height: 1.3 !important;
    margin: 0 0 8px !important; /* Increased spacing */
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    font-weight: 950 !important; /* Stronger visual weight */
    color: var(--ink) !important;
  }
  
  .org {
    font-size: 13px !important;
    line-height: 1.5 !important; /* Better readability */
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    margin: 0 !important;
    color: var(--muted) !important;
  }
  
  .meta {
    margin-top: 10px !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    font-size: 12px !important;
  }
  
  /* Ensure expand button doesn't overlap text */
  .expandBtn {
    flex: 0 0 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    margin-left: auto !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: rgba(79, 209, 197, 0.2) !important;
    position: relative !important;
    z-index: 10 !important;
    flex-shrink: 0 !important; /* Prevent shrinking */
  }
  
  /* Fix panel expansion on mobile - ensure smooth opening */
  .panel {
    margin-top: 12px !important;
    padding-top: 12px !important;
    padding-bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    /* Disable transitions on mobile for instant response */
    transition: none !important;
    will-change: auto !important;
  }
  
  .card[data-open="true"] .panel {
    max-height: none !important;
    opacity: 1 !important;
    transform: none !important;
    display: block !important;
  }
  
  .card[data-open="false"] .panel {
    display: none !important;
  }
  
  /* Ensure expand button is always clickable */
  .expandBtn {
    pointer-events: auto !important;
    cursor: pointer !important;
  }
  
  /* Fix chevron icon size for better visibility */
  .chev {
    width: 16px !important;
    height: 16px !important;
    border-width: 2.5px !important;
  }
  
  /* Fix kv grid for mobile */
  .kv {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding: 10px 0 !important;
  }
  
  .k {
    font-size: 11px !important;
    margin-bottom: 4px !important;
  }
  
  .v {
    font-size: 13px !important;
    line-height: 1.5 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  
  /* Fix card action buttons */
  .card-action-btn {
    min-height: 44px !important;
    padding: 10px 12px !important;
    font-size: 13px !important;
    touch-action: manipulation !important;
  }
  
  /* Fix search header text */
  .search-header h3 {
    font-size: 18px !important;
    line-height: 1.3 !important;
    margin: 0 0 8px !important;
    word-wrap: break-word !important;
  }
  
  .search-header p {
    font-size: 13px !important;
    line-height: 1.5 !important;
    margin: 0 0 12px !important;
    word-wrap: break-word !important;
  }
  
  /* Fix filter presets spacing (exclude quick start — stays centered) */
  .filter-presets:not(.filter-presets--quickstart) {
    margin: 12px 0 !important;
    gap: 8px !important;
    justify-content: flex-start !important;
  }
  
  .filter-preset-btn {
    padding: 10px 16px !important;
    font-size: 13px !important;
    min-height: 44px !important;
    touch-action: manipulation !important;
  }
  
  /* Container padding moved to consolidated @media (max-width: 640px) block */
  
  /* Fix section spacing */
  .section {
    margin-top: 16px !important;
    margin-bottom: 16px !important;
    padding: 0 !important;
  }
  
  /* Fix grid spacing */
  .grid {
    gap: 12px !important;
    padding: 12px !important;
  }
  
  /* Ensure all text is readable and doesn't overlap */
  * {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  
  /* Fix results header */
  .results-header {
    padding: 12px 0 !important;
    margin: 12px 0 !important;
  }
  
  /* Fix card header layout to prevent overlap */
  .card-header {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: flex-start !important;
    width: 100% !important;
  }
  
  /* Ensure card meta doesn't overlap */
  .card-meta {
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 8px !important;
  }
  
  /* Fix accuracy strip */
  .accuracyStrip {
    margin-top: 10px !important;
    padding: 8px 12px !important;
    font-size: 11px !important;
    line-height: 1.4 !important;
  }
  
  /* Fix button groups in cards */
  .card-actions,
  .card-action-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-top: 12px !important;
    width: 100% !important;
  }
  
  .card-action-btn {
    flex: 1 1 auto !important;
    min-width: calc(50% - 4px) !important;
  }
  
  /* Fix dropdown menus on mobile */
  .dd-menu {
    max-width: calc(100% - 24px) !important; /* Changed from 100vw */
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
  }
  
  /* Fix search suggestions positioning */
  .search-suggestions {
    max-width: calc(100% - 24px) !important; /* Changed from 100vw */
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
  }
  
  /* Fix modal on mobile */
  .modal-content {
    max-width: calc(100vw - 24px) !important;
    width: calc(100% - 24px) !important; /* Changed from 100vw */
    margin: 12px !important;
    max-height: calc(100dvh - 24px) !important; /* Use dvh for mobile Safari */
    max-height: calc(100vh - 24px) !important; /* Fallback */
  }
  
  /* Improve touch targets */
  button,
  .btnlike,
  .card-action-btn,
  .expandBtn,
  .filter-preset-btn {
    min-height: 44px !important;
    min-width: 44px !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: rgba(79, 209, 197, 0.2) !important;
  }
  
  /* Fix spacing between sections */
  .section + .section {
    margin-top: 20px !important;
  }
  
  /* Fix container max-width */
  .container {
    max-width: 100% !important;
    width: 100% !important;
  }
}

/* ========== Performance Kill Switches (perf mode only) ========== */
html.perf-no-anim *,
html.perf-no-anim *::before,
html.perf-no-anim *::after {
  animation: none !important;
  transition: none !important;
}

html.perf-no-hero .hero-visual,
html.perf-no-hero .floating-card {
  display: none !important;
}

html.perf-no-shadow * {
  box-shadow: none !important;
}

html.perf-no-fixed-bg .bg-gradient {
  display: none !important;
}

html.perf-no-sticky .crisis-banner,
html.perf-no-sticky .search-section {
  position: static !important;
}

/* ========== Mobile Performance Policy (Phase 1) ========== */
/* On small screens and coarse pointers, make background static and simpler */
@media (max-width: 900px), (pointer: coarse) {
  /* CRITICAL: Hide fixed full-viewport background layer completely on mobile */
  /* Even without animation, a fixed full-viewport element with complex gradients is expensive to repaint during scroll */
  .bg-gradient {
    display: none !important; /* Completely remove from paint/compositing */
  }
  
  /* Use static body background instead */
  body {
    background: var(--bg0) !important;
  }
  
  /* CRITICAL: Hide floating cards completely on mobile - they cause paint cost even without animation */
  /* The animated "signs" in hero section are expensive to repaint during scroll */
  .floating-card {
    display: none !important; /* Completely remove from paint/compositing */
  }
  
  /* Hide hero-visual container on mobile - floating cards are hidden, so container is empty */
  .hero-visual {
    display: none !important;
    min-height: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  
  .btn-emergency {
    animation: none !important;
  }
  
  .accuracyStrip {
    animation: none !important;
  }
  
  .shimmer {
    animation: none !important;
  }
  
  /* Any element with pulse animation */
  [class*="pulse"],
  .btn-emergency {
    animation: none !important;
  }
  
  /* Phase 1 Complete: All infinite animations disabled on mobile
   * Inventory:
   * - .bg-gradient (gradientShift) - DISABLED
   * - .floating-card (float) - DISABLED
   * - .btn-emergency (pulse) - DISABLED
   * - .accuracyStrip (breathe) - DISABLED
   * - .shimmer (shimmer) - DISABLED
   * See MOBILE_PERFORMANCE.md for full documentation
   */
  
  /* CRITICAL FIX: Further reduce shadow cost on cards for smoother scrolling */
  /* Replace medium shadows with minimal border + light shadow */
  .card {
    box-shadow: 0 1px 3px rgba(15,23,42,.06) !important;
    border: 1px solid rgba(15,23,42,.12) !important; /* Slightly stronger border to compensate */
  }
  
  .search-section,
  .modal-content,
  .triage-card {
    box-shadow: var(--shadow-sm) !important;
  }
  
  /* Disable expensive infinite animations on mobile for smooth text-size changes */
  .btn-emergency {
    animation: none !important;
  }
  
  .accuracyStrip {
    animation: none !important;
  }
  
  .shimmer {
    animation: none !important;
  }
}

/* CRITICAL FIX: Refined mobile performance fix - disable only the problematic combinations */
@media (pointer: coarse) {
  /* Disable performance-hazard properties only on known heavy elements. */
  .bg-gradient,
  .floating-card,
  .btn-emergency,
  .accuracyStrip,
  .shimmer,
  .card,
  .search-section,
  .triage-card,
  .modal-content {
    animation: none !important;
    transition: none !important;
    content-visibility: visible !important;
    contain: none !important;
  }
  
  /* Force sticky elements to relative positioning */
  .crisis-banner,
  .search-section {
    position: relative !important;
  }
}

/* Temporarily disable expensive animations and reduce paint cost during iOS visualViewport changes */
/* This prevents jank when user adjusts text size via aA menu */
@media (pointer: coarse) {
  /* Disable all animations during viewport changes */
  html.vv-changing .bg-gradient {
    animation: none !important;
    transform: none !important;
    filter: none !important;
  }
  
  html.vv-changing .btn-emergency {
    animation: none !important;
  }
  
  html.vv-changing .accuracyStrip {
    animation: none !important;
  }
  
  html.vv-changing .shimmer {
    animation: none !important;
  }
  
  html.vv-changing .floating-card {
    animation: none !important;
    transform: none !important;
  }
  
  /* TASK B: Targeted backdrop-filter removal (replaces wildcard to avoid massive recalculation)
   * Only disable backdrop-filter on known elements that have it, not globally
   */
  html.vv-changing .hero-copy,
  html.vv-changing .floating-card,
  html.vv-changing .search-section,
  html.vv-changing .section,
  html.vv-changing .dd-menu,
  html.vv-changing .search-suggestions,
  html.vv-changing .modal-backdrop,
  html.vv-changing .privacy-controls {
    backdrop-filter: none !important;
  }
  
  /* CRITICAL: Optimize hero section during viewport changes */
  html.vv-changing .hero-copy {
    background: rgba(255,255,255,.85) !important; /* Remove gradient, use solid */
    box-shadow: 0 2px 8px rgba(15,23,42,.08) !important;
  }
  
  /* CRITICAL: Optimize triage cards during viewport changes */
  html.vv-changing .triage-card {
    box-shadow: 0 2px 8px rgba(15,23,42,.08) !important;
    background: rgba(255,255,255,.90) !important; /* Simplify gradient to solid */
  }
  
  html.vv-changing .triage-card.emergency {
    background: rgba(239,68,68,.05) !important; /* Simplify gradient */
  }
  
  html.vv-changing .triage-card.planning {
    background: rgba(79,209,197,.05) !important; /* Simplify gradient */
  }
  
  /* CRITICAL: Optimize floating cards during viewport changes */
  html.vv-changing .floating-card {
    background: rgba(255,255,255,.90) !important; /* Remove backdrop-filter effect */
    box-shadow: 0 2px 8px rgba(15,23,42,.08) !important;
  }
  
  /* TASK B: REMOVED - Fixed font-size overrides cause layout shifts during scroll
   * These were causing visible jumps when vv-changing toggled during Safari toolbar collapse/expand
   * vv-changing should only disable expensive effects, not change layout/typography
   */
  
  /* CRITICAL: Disable expensive gradient backgrounds during viewport changes */
  html.vv-changing .triage-card.emergency,
  html.vv-changing .triage-card.planning {
    background-image: none !important; /* Remove gradient, use solid color */
  }
  
  /* CRITICAL: Optimize hero-visual container during viewport changes */
  html.vv-changing .hero-visual {
    will-change: auto !important;
  }
  
  /* Reduce paint cost by simplifying box-shadows (expensive to recompute) */
  html.vv-changing .card,
  html.vv-changing .search-section,
  html.vv-changing .triage-card,
  html.vv-changing .modal-content,
  html.vv-changing .hero-copy,
  html.vv-changing .section {
    box-shadow: 0 1px 2px rgba(15,23,42,.08) !important; /* Even simpler shadow */
  }
  
  /* CRITICAL: On real iOS devices, disable ALL expensive properties immediately */
  /* This prevents any paint cost during viewport changes */
  html.vv-changing .trust-strip,
  html.vv-changing .trust-item {
    background: rgba(255,255,255,.9) !important; /* Remove gradients */
    box-shadow: 0 1px 2px rgba(15,23,42,.08) !important;
  }
  
  /* TASK B: REMOVED - Fixed line-height overrides cause layout shifts
   * vv-changing should only disable expensive effects, not change layout metrics
   */
  
  /* Disable transforms and filters that cause expensive repaints */
  /* BUT: Allow transforms on cards for hover effects (only disable animations) */
  html.vv-changing .bg-gradient,
  html.vv-changing .floating-card,
  html.vv-changing .btn-emergency {
    transform: none !important;
    filter: none !important;
  }
  
  /* Disable transitions on animated elements during viewport changes */
  /* BUT: Keep transitions on interactive elements (cards, buttons) to avoid visual glitches */
  html.vv-changing .bg-gradient,
  html.vv-changing .floating-card,
  html.vv-changing .btn-emergency,
  html.vv-changing .shimmer,
  html.vv-changing .accuracyStrip {
    transition: none !important;
  }
  
  /* Use CSS containment to isolate paint operations during viewport changes */
  /* OPTIMIZED: Reduce scope to only high-impact containers, not every element */
  html.vv-changing .section,
  html.vv-changing .search-section {
    contain: layout style paint !important;
  }
  
  /* Cards get lighter containment to avoid too much work */
  html.vv-changing .grid {
    contain: layout style !important;
  }
  
  /* REMOVED: Disabling hover effects - causes visual glitches during scrolling */
  /* REMOVED: will-change modification - not needed */
  
  /* REMOVED: content-visibility - causes layout shifts and visual glitches during scrolling */
  
  /* Optimize text rendering during viewport changes */
  html.vv-changing {
    text-rendering: optimizeSpeed !important;
    -webkit-font-smoothing: auto !important;
  }
  
  /* REMOVED: transform: translateZ(0) - causes layout shifts during scrolling */
  /* REMOVED: Disabling pseudo-elements - causes visual glitches (card::before is the gradient line) */
  /* REMOVED: content-visibility - causes layout shifts during scrolling */
}

/* ========== Dense Mode: Text Scale Below 100% (TASK B) ========== */
/* Activates when iOS Safari text size is below baseline (aA smaller) */
/* CRITICAL: At smaller text sizes, more elements are visible = more paint cost */
/* Apply aggressive optimizations to handle increased element density */
@media (pointer: coarse) {
  /* TASK B.1: Disable ALL infinite/looping animations when text is small */
  html.text-small .bg-gradient {
    animation: none !important;
    transform: none !important;
    filter: none !important;
  }
  
  /* CRITICAL: Hide floating cards completely in dense mode (already hidden on mobile, but ensure it) */
  html.text-small .floating-card {
    display: none !important;
  }
  
  html.text-small .btn-emergency {
    animation: none !important;
  }
  
  html.text-small .accuracyStrip {
    animation: none !important;
  }
  
  html.text-small .shimmer {
    animation: none !important;
  }
  
  /* CRITICAL FIX: At smaller text sizes, remove ALL shadows - too many elements to repaint */
  /* Use borders only for visual separation */
  html.text-small .crisis-banner {
    box-shadow: none !important; /* Remove shadow completely */
    border-bottom: 2px solid rgba(239,68,68,.25) !important; /* Use border only */
  }
  
  html.text-small .search-section {
    box-shadow: none !important; /* Remove shadow completely */
    border: 1px solid rgba(15,23,42,.15) !important; /* Use border only */
  }
  
  /* CRITICAL: Remove ALL card shadows in dense mode - too many cards visible */
  html.text-small .card {
    box-shadow: none !important; /* Remove shadow completely */
    border: 1px solid rgba(15,23,42,.18) !important; /* Stronger border to compensate */
  }
  
  html.text-small .modal-content,
  html.text-small .section {
    box-shadow: none !important; /* Remove shadow completely */
    border: 1px solid rgba(15,23,42,.12) !important; /* Use border only */
  }
  
  /* TASK B.3: Remove fixed full-viewport background layer */
  html.text-small .bg-gradient {
    display: none !important;
  }
  
  /* Move to static body background (non-fixed) */
  html.text-small body {
    background: var(--bg0) !important;
  }
  
  /* CRITICAL: More aggressive content-visibility for dense mode */
  /* At smaller text sizes, more cards are visible - need better optimization */
  /* OPTIMIZED: Apply only to grid container, let browser handle individual cards */
  html.text-small .grid {
    content-visibility: auto !important;
    contain-intrinsic-size: 800px !important; /* Smaller intrinsic size for denser content */
    contain: layout style !important; /* Lighter containment */
  }
  
  /* REMOVED: Individual card content-visibility rules */
  /* Applying content-visibility to 50-100 cards at once causes massive recalc */
  /* Let the grid-level optimization handle visibility instead */
  
  /* CRITICAL: Disable all transitions in dense mode - too many elements */
  /* REMOVED UNIVERSAL SELECTOR - was causing massive style recalc on toggle */
  /* Instead, target specific high-impact elements only */
  html.text-small .card,
  html.text-small .section,
  html.text-small .grid,
  html.text-small .floating-card,
  html.text-small .btn-emergency,
  html.text-small .shimmer,
  html.text-small .accuracyStrip,
  html.text-small .bg-gradient {
    transition: none !important; /* Remove transitions to prevent repaints */
  }
  
  /* CRITICAL: Disable will-change hints in dense mode - reduces compositing cost */
  /* REMOVED UNIVERSAL SELECTOR - was causing massive style recalc on toggle */
  /* Target only elements that typically use will-change */
  html.text-small .card,
  html.text-small .floating-card,
  html.text-small .hero-visual,
  html.text-small .crisis-banner,
  html.text-small .search-section {
    will-change: auto !important;
  }
  
  /* TASK C: While-scrolling optimization (dense mode only) */
  /* Shadows already removed above, but ensure borders stay for visual separation */
  html.text-small.is-scrolling .card,
  html.text-small.is-scrolling .crisis-banner,
  html.text-small.is-scrolling .search-section {
    /* Shadows already removed, just ensure no other expensive properties */
    transform: none !important;
  }
}

@media (max-width: 768px) {
  /* Disable animations and transforms on mobile for performance during text size changes */
  .floating-card {
    animation: none !important;
    transform: none !important;
  }
  
  /* Disable backdrop-filter on mobile for performance */
  .glass,
  .blur,
  .triage-card,
  .floating-card,
  .dd-menu,
  .modal-backdrop,
  .search-section {
    backdrop-filter: none !important;
  }
  
  /* NOTE: search-section layout rules moved to consolidated @media (max-width: 640px) block */
  /* This block only handles tablet-specific (768px) optimizations */
}

.search-header{
  text-align:center;
  margin: 4px 0 16px;
}
.search-header h3{
  margin:0;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -.02em;
}
.search-header p{
  margin: 6px auto 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 70ch;
}

.search-header .filter-presets--quickstart{
  margin: 14px auto 0;
}

.search-simple{
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  max-width: 100%;
}

.input-group-primary{
  flex: 1 1 300px;
}

.btn-smart-search{
  padding: 12px 24px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, rgba(79,209,197,.92), rgba(122,167,255,.92));
  color: white;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(79,209,197,.25);
  transition: var(--transition);
  white-space: nowrap;
  min-height: 44px;
}

.btn-smart-search:hover{
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(79,209,197,.35);
}

.btn-advanced{
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.85);
  cursor: pointer;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  min-height: 44px;
}

.btn-advanced:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.search-toolbar{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1 1 100%;
  width: 100%;
  margin-top: 4px;
}

.search-toolbar .btn-smart-search{
  flex: 1 1 auto;
  min-width: 140px;
}

.btn-reset-link{
  margin-left: auto;
  padding: 8px 4px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  min-height: 44px;
}

.btn-reset-link:hover{
  color: var(--ink);
}

.filter-presets--quickstart{
  display: flex;
  flex-direction: column;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  text-align: center;
  overflow: visible;
}

.filter-presets--quickstart .filter-presets-label{
  display: block;
  width: 100%;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.filter-presets--quickstart .filter-presets-buttons{
  display: flex;
  flex-wrap: wrap;
  justify-content: center !important;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}

.more-filters-extended{
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px dashed rgba(15,23,42,.10);
}

.more-filters-extended-label{
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.search-actions .btns #reset{
  display: none;
}

.btn-advanced .icon{
  font-size: 16px;
}

.search-advanced{
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--stroke);
}

.search-grid{
  display:grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  align-items:end;
  max-width: 100%;
}

/* Advanced filters use responsive auto-fit grid to avoid dead space */
.search-advanced .search-grid,
.advanced-filters-content .search-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
}

@media (max-width: 980px){ 
  .search-grid{ 
    grid-template-columns: 1fr; 
    width: 100%;
    max-width: 100%;
  } 
}

.input-group label{
  display:block;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted2);
  margin: 0 0 8px 2px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.input-wrapper{ position:relative; }

.input-icon{
  position:absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(100,116,139,.9);
  pointer-events:none;
  font-size: 14px;
  z-index: 1;
}

/* Autocomplete Suggestions */
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--cardSolid);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: 0 22px 60px rgba(15,23,42,.20);
  backdrop-filter: blur(10px);
  z-index: 100;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 4px;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid rgba(15,23,42,.05);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
  background: rgba(122,167,255,.12);
}

.suggestion-icon,
.suggestion-label {
  font-size: 11px;
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(122,167,255,.12);
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.suggestion-text {
  flex: 1;
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}

.search-suggestions::-webkit-scrollbar {
  width: 6px;
}

.search-suggestions::-webkit-scrollbar-track {
  background: rgba(15,23,42,.05);
  border-radius: 3px;
}

.search-suggestions::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,.15);
  border-radius: 3px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
  background: rgba(15,23,42,.25);
}

input[type="search"], select{
  width: 100%;
  padding: 12px 12px 12px 40px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.92);
  color: var(--ink);
  outline: none;
  transition: var(--transition);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  min-height: 44px;
}

@media (max-width: 640px){
  input[type="search"], select, .dd-btn{
    font-size: 16px; /* Prevents zoom on iOS */
  }
  .grid{
    gap: 20px;
  }
  .card{
    padding: 20px;
  }
  input, select, .dd-btn{
    padding: 14px 14px 14px 44px;
  }
  
  /* Larger touch targets for mobile */
  button, .btnlike, .card-action-btn, .linkBtn {
    min-height: 48px;
    padding: 12px 16px;
  }
  
  /* Better spacing for mobile */
  .search-simple {
    flex-direction: column;
  }
  
  .btn-smart-search, .btn-advanced {
    width: 100%;
    margin-top: 8px;
  }
  
  /* Improve autocomplete on mobile */
  .search-suggestions {
    max-height: 60vh;
    font-size: 16px; /* Prevent zoom */
  }
  
  .suggestion-item {
    padding: 14px 16px;
    min-height: 48px;
  }
}

select{ padding-left: 12px; }
.dropdown{ position:relative; width:100%; }

.dd-btn{
  width:100%;
  padding: 12px 44px 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.92);
  color: var(--ink);
  outline: none;
  transition: var(--transition);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  cursor:pointer;
  text-align:left;
  line-height: 1.1;
  min-height: 44px;
}
.dd-btn:hover{
  box-shadow: 0 14px 28px rgba(15,23,42,.08);
  transform: translateY(-1px);
}
.dd-btn:focus-visible{
  border-color: rgba(122,167,255,.55);
  box-shadow: var(--focus), 0 16px 34px rgba(15,23,42,.10);
}

.dd-icon{
  opacity:.75;
  transition: transform .18s ease, opacity .18s ease;
  font-size: 14px;
  transform-origin: 50% 55%;
}
.dropdown.open .dd-icon{ transform: rotate(180deg); opacity:.95; }

.dd-menu{
  position:absolute;
  left:0; right:0;
  top: calc(100% + 8px);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.98);
  box-shadow: 0 22px 60px rgba(15,23,42,.20);
  backdrop-filter: blur(10px);
  z-index: 50;
  max-height: 320px;
  overflow:auto;

  opacity: 0;
  transform: translateY(-6px) scale(.985);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.dropdown.open .dd-menu{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
  transition: opacity .18s ease, transform .18s ease;
}

.dd-option{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  cursor:pointer;
  user-select:none;
  color: var(--ink);
  min-height: 44px;
}
.dd-option:hover,
.dd-option.is-active{
  background: rgba(122,167,255,.14);
}
.dd-option.is-selected{
  background: rgba(45,212,191,.14);
}
.dd-check{
  font-weight: 900;
  opacity: 0;
  transform: translateX(-2px);
  transition: opacity .12s ease, transform .12s ease;
}
.dd-option.is-selected .dd-check{
  opacity: 1;
  transform: translateX(0);
}

.dd-native{
  position:absolute;
  width:1px; height:1px;
  opacity:0;
  pointer-events:none;
}

select{ color-scheme: light; }
.input-group select{
  -webkit-appearance: none;
  appearance: none;
  padding-right: 44px;
}
select option{
  background: #ffffff;
  color: var(--ink);
}

input[type="search"]:focus, select:focus{
  border-color: rgba(122,167,255,.55);
  box-shadow: var(--focus), 0 16px 34px rgba(15,23,42,.10);
}

.search-actions{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  flex-wrap:wrap;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid rgba(15,23,42,.06);
}

.toggles{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  align-items:center;
}
.toggle-chip{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.76);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
  cursor:pointer;
  user-select:none;
  transition: var(--transition);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  min-height: 44px;
}
.toggle-chip:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15,23,42,.10);
}
.toggle-chip input[type="checkbox"]{
  width: 18px;
  height: 18px;
  cursor:pointer;
  accent-color: var(--a);
}

.btns{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  justify-content:flex-end;
  align-items:center;
}

button{
  border-radius: 14px;
  border: 1px solid var(--stroke);
  padding: 10px 12px;
  cursor:pointer;
  font-weight: 900;
  letter-spacing: -.01em;
  background: rgba(255,255,255,.82);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  transition: var(--transition);
  color: var(--ink);
  min-height: 44px;
}
button:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15,23,42,.10);
}
button:focus{ outline:none; box-shadow: var(--focus); }

.header-actions{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  justify-content:flex-end;
  align-items:center;
}

a.btnlike{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  text-decoration:none;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  padding: 10px 12px;
  cursor:pointer;
  font-weight: 900;
  letter-spacing: -.01em;
  background: rgba(255,255,255,.82);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  transition: var(--transition);
  color: var(--ink);
  white-space: nowrap;
  min-height: 44px;
}
a.btnlike:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15,23,42,.10);
}
a.btnlike:active{
  transform: translateY(0px);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
}
a.btnlike:focus{
  outline:none;
  box-shadow: var(--focus);
}

.btn-primary{
  background: linear-gradient(135deg, rgba(79,209,197,.92), rgba(122,167,255,.92));
  border-color: rgba(255,255,255,.55);
  color: white;
}

.results-header{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 12px;
  flex-wrap:wrap;
  margin: 16px 0 10px;
  padding: 10px 2px 12px;
  border-bottom: 1px solid rgba(15,23,42,.08);
  width: 100%;
  max-width: 100%;
  clear: both; /* Ensure it's below any floated elements */
  position: relative; /* Establish stacking context */
  z-index: 1; /* Ensure it's above background elements but below modals */
  /* Ensure flex children can shrink */
  min-width: 0;
}
.results-info{
  display:flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap:wrap;
  min-width: 0; /* Allow flex items to shrink */
  flex: 1 1 auto; /* Allow it to grow and shrink */
}
.results-count{
  font-size: 26px;
  font-weight: 950;
  color: #1a655c;
  letter-spacing: -.02em;
  white-space: nowrap; /* Prevent number from breaking */
  flex-shrink: 0; /* Don't shrink the count */
}
.results-label{
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap; /* Prevent "matches" from breaking */
  flex-shrink: 0;
}

.section{
  margin-top: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15,23,42,.08);
  background: rgba(255,255,255,.62);
  box-shadow: var(--shadow-md);
  overflow:hidden;
  /* CRITICAL: Reduce backdrop-filter blur on desktop - 12px is expensive */
  backdrop-filter: blur(6px);
  width: 100%;
  max-width: 100%;
}

/* Phase 2: Optimize sections for mobile - use content-visibility */
@media (pointer: coarse) {
  .section {
    content-visibility: auto;
    contain-intrinsic-size: 300px;
    /* CRITICAL FIX: Disable expensive backdrop-filter on mobile */
    backdrop-filter: none !important;
    background: rgba(255,255,255,.85) !important;
  }
}
.sectionHead{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15,23,42,.06);
}

.sectionHead--with-intro {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding-bottom: 12px;
}

.sectionHead-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}
.sectionHead h2{
  margin:0;
  font-size: 13px;
  color: var(--muted2);
  letter-spacing:.10em;
  text-transform: uppercase;
  font-weight: 950;
}
.count{
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.grid{
  display:flex;
  flex-wrap:wrap;
  gap: 14px;
  padding: 14px 14px 16px;
  align-items:flex-start;
  width: 100%;
  max-width: 100%;
  overflow-x: clip; /* Modern */
  overflow-x: hidden; /* Fallback */
}

/* Phase 2: Optimize grid for mobile - use content-visibility */
@media (pointer: coarse) {
  .grid {
    content-visibility: auto;
    contain: layout style;
  }
}
.grid > .card, .grid > .skeleton{
  flex: 1 1 calc(33.333% - 14px);
  max-width: calc(33.333% - 14px);
  min-width: 0; /* Critical: allows flex items to shrink below content size */
  align-self:flex-start;
  /* Prevent text overflow */
  overflow-wrap: break-word;
  word-break: break-word;
}
@media (max-width: 980px){
  .grid > .card, .grid > .skeleton{
    flex-basis: calc(50% - 14px);
    max-width: calc(50% - 14px);
    min-width: 0;
  }
}
@media (max-width: 640px){
  .grid{
    gap: 12px;
    padding: 12px;
  }
  .grid > .card, .grid > .skeleton{
    flex-basis: 100%;
    max-width: 100%;
    min-width: 0;
  }
}

/* Consolidated card styles - single authoritative definition */
.card{
  border-radius: var(--radius);
  border: 1px solid rgba(15,23,42,.09);
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  position: relative;
  overflow: visible; /* Changed from hidden to visible for badge */
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  animation: rise .35s ease both;
  animation-delay: var(--enter-delay, 0ms);
  contain: layout style paint;
  /* CRITICAL: content-visibility only on mobile - desktop doesn't need it and it can cause issues */
  max-width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* Critical: allow card to shrink in flex containers */
  min-width: 0;
  /* Prevent long URLs/text from overflowing */
  overflow-wrap: anywhere;
  word-break: break-word;
  page-break-inside: avoid;
}

/* Phase 2: Optimize cards for mobile - reduce paint cost */
@media (pointer: coarse) {
  .card {
    /* Ensure content-visibility works on mobile */
    content-visibility: auto;
    contain-intrinsic-size: 200px; /* Smaller on mobile */
    /* Reduce transition cost */
    will-change: auto; /* Don't hint unless needed */
    /* Disable card animations on mobile for better scroll performance */
    animation: none !important;
    /* CRITICAL FIX: Disable ALL transitions on mobile - transitions cause repaints during scroll */
    transition: none !important; /* Remove all transitions to prevent repaints */
    /* Remove transform: translateZ(0) on mobile - not needed and can cause issues */
    transform: none;
  }
  
  /* CRITICAL FIX: Completely disable ALL hover effects on mobile - they cause repaints during scroll */
  /* Mobile devices don't have true hover, but CSS still evaluates hover states during touch */
  .card:hover,
  .card:focus-within {
    transform: none !important; /* Prevent transform changes that cause repaints */
    box-shadow: 0 1px 3px rgba(15,23,42,.06) !important; /* Keep minimal shadow, don't increase */
    border-color: rgba(15,23,42,.12) !important; /* Keep border color static */
  }
  
  /* Disable card::before gradient line animation on mobile */
  .card::before {
    display: none !important; /* Remove animated gradient line */
  }
}
.card::before{
  content:"";
  position:absolute;
  top:0; left:0; right:0;
  height: 3px;
  background: linear-gradient(90deg, rgba(79,209,197,1), rgba(122,167,255,1));
  transform: scaleX(0);
  transform-origin: left;
  transition: var(--transition);
}
.card:hover{
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(79,209,197,.28);
}
.card:hover::before{ transform: scaleX(1); }
.card:focus-within{ box-shadow: var(--focus), var(--shadow-md); }

/* Badge definition moved to line 1496 with overflow handling */

@keyframes rise{
  from{ opacity:0; transform: translateY(10px); }
  to{ opacity:1; transform: translateY(0); }
}

.badgeRow{
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  margin: 0 0 10px;
  width: 100%;
  max-width: 100%;
}
.badge{
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(241,245,249,.85);
  color: var(--muted);
  font-weight: 900;
  letter-spacing: .02em;
  white-space:nowrap;
}
.badge.loc{ background: rgba(122,167,255,.12); border-color: rgba(122,167,255,.22); }
.badge.loc2{ background: rgba(79,209,197,.12); border-color: rgba(79,209,197,.22); }
.badge.crisis{ background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.22); color:#7f1d1d; }
.badge.recent{ 
  background: rgba(34,197,94,.12); 
  border-color: rgba(34,197,94,.25); 
  color: #15803d; 
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.availability-badge{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  margin-top: 10px;
}

.availability-badge.available{
  background: rgba(34,197,94,.12);
  color: #15803d;
  border: 1px solid rgba(34,197,94,.25);
}

.availability-badge.limited{
  background: rgba(249,115,22,.12);
  color: #9a3412;
  border: 1px solid rgba(249,115,22,.25);
}

.badge-icon{
  font-size: 14px;
}

.cardTop{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
}

.pname{
  font-weight: 950;
  letter-spacing: -.02em;
  margin: 0 0 6px;
  font-size: 16px;
  line-height:1.25;
}

#main {
  scroll-margin-top: 12px;
}
.org{
  margin:0;
  color: var(--muted);
  font-size: 13px;
  line-height:1.45;
}

.meta{
  margin-top: 10px;
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.expandBtn{
  flex: 0 0 auto;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(241,245,249,.80);
  border-radius: 14px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition: var(--transition);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
}
.expandBtn:hover{ transform: translateY(-1px); box-shadow: 0 16px 34px rgba(15,23,42,.10); }
.expandBtn:focus{ outline:none; box-shadow: var(--focus); }

.chev{
  width: 14px;
  height: 14px;
  border-right: 2px solid rgba(15,23,42,.55);
  border-bottom: 2px solid rgba(15,23,42,.55);
  transform: rotate(45deg);
  transition: transform .22s ease;
}
.card[data-open="true"] .chev{ transform: rotate(-135deg); }

.panel{
  margin-top: 12px;
  border-top: 1px dashed rgba(15,23,42,.12);
  padding-top: 12px;
  max-height: 0px;
  opacity: 0;
  transform: translateY(-6px);
  overflow:hidden;
  transition: max-height .24s ease, opacity .18s ease, transform .18s ease;
  will-change: max-height, opacity, transform;
  contain: layout paint;
  /* Ensure panel is in-flow and constrained */
  position: static;
  width: 100%;
  max-width: 100%;
  overflow-wrap: break-word;
  box-sizing: border-box;
}
.card[data-open="true"] .panel{
  max-height: 5000px;
  opacity: 1;
  transform: translateY(0);
}

/* Modal-local card details (self-contained, doesn't affect main page) */
.card-details {
  margin-top: 12px;
  border-top: 1px dashed rgba(15,23,42,.12);
  padding-top: 12px;
  width: 100%;
  max-width: 100%;
  overflow-wrap: break-word;
  box-sizing: border-box;
  position: static;
}

.card-details[hidden] {
  display: none !important;
}

.card[data-open="true"] .card-details {
  display: block !important;
  height: auto;
  max-height: none;
}

/* Ensure chevron rotates correctly in modal cards */
#favoritesModal .card[data-open="true"] .chev {
  transform: rotate(-135deg);
}

#favoritesModal .card[data-open="false"] .chev {
  transform: rotate(45deg);
}

/* Ensure expand button is clickable on mobile - no pointer-events blocking */
#favoritesModal .expandBtn {
  pointer-events: auto !important;
  position: relative;
  z-index: 15 !important; /* Higher z-index to ensure it's on top */
  touch-action: manipulation; /* Improve touch responsiveness */
  -webkit-tap-highlight-color: rgba(79, 209, 197, 0.2); /* iOS tap highlight */
  min-width: 44px !important; /* Minimum touch target size */
  min-height: 44px !important;
  padding: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Ensure modal body and cards don't block pointer events */
#favoritesModal .modal-body,
#favoritesModal .card {
  pointer-events: auto;
}

/* Ensure card-meta-header doesn't overlap expand button */
#favoritesModal .card-meta-header {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#favoritesModal .cardTop {
  position: relative;
  z-index: 2;
}

/* Ensure header row uses flex-wrap and no absolute positioning */
#favoritesModal .card-header,
#favoritesModal .card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Ensure badges/chips are static in modal */
#favoritesModal .recent-badge,
#favoritesModal .chip,
#favoritesModal .badge {
  position: static !important;
}

/* Ensure chevron icon doesn't steal taps */
#favoritesModal .expandBtn .chev,
#favoritesModal .expandBtn svg {
  pointer-events: none;
}

/* Ensure all card elements have pointer-events enabled */
#favoritesModal .card * {
  pointer-events: auto;
}

#favoritesModal .badgeRow {
  pointer-events: auto;
}

/* Disable ::after badge in favorites modal (replaced with normal badge in badgeRow) */
#favoritesModal .card[data-recent="true"]::after {
  content: none !important;
}

/* Style the "Recently Updated" badge in modal */
#favoritesModal .badge.recent {
  background: rgba(34,197,94,.12);
  color: #15803d;
  border: 1px solid rgba(34,197,94,.25);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Card details display is handled by general .card-details rules above */

.accuracyStrip{
  margin-top: 10px;
  border-radius: 16px;
  border: 1px solid rgba(34,197,94,.22);
  background: rgba(34,197,94,.06);
  padding: 10px 12px;
  color: rgba(15,23,42,.82);
  font-size: 13px;
  line-height:1.45;
  display:none;
  animation: breathe 3s ease-in-out infinite;
}
.card[data-open="true"] .accuracyStrip{ display:block; }

@keyframes breathe {
  0%, 100% { opacity: .85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.01); }
}

.kv{
  display:grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(15,23,42,.10);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.kv:last-child{ border-bottom:none; }
.k{ color: var(--muted2); font-size: 11px; text-transform:uppercase; letter-spacing:.09em; font-weight: 900;}
.v{ color: var(--ink); font-size: 13px; line-height:1.45; word-wrap: break-word; overflow-wrap: break-word; }

.actions{
  margin-top: 12px;
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  align-items:center;
  max-width: 100%;
}
.linkBtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  font-weight: 950;
  transition: var(--transition);
  min-height: 44px;
}
.linkBtn:hover{ transform: translateY(-1px); box-shadow: 0 16px 34px rgba(15,23,42,.10); }
.linkBtn.primary{
  background: linear-gradient(135deg, rgba(122,167,255,.92), rgba(196,181,253,.92));
  border-color: rgba(255,255,255,.55);
  color: white;
}
.linkBtn.danger{
  background: linear-gradient(135deg, rgba(239,68,68,.16), rgba(239,68,68,.08));
  border-color: rgba(239,68,68,.22);
  color:#7f1d1d;
}

.empty-state{
  padding: 40px 20px;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.empty-icon{
  font-size: 64px;
  margin-bottom: 16px;
  opacity: .5;
}

.empty-state h3{
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 900;
}

.empty-state p{
  color: var(--muted);
  margin: 0 0 16px;
}

.empty-tips{
  text-align: left;
  margin: 0 0 24px;
  padding-left: 24px;
}

.empty-tips li{
  margin-bottom: 10px;
  line-height: 1.5;
  color: var(--ink);
}

.empty-actions{
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.empty-actions button{
  min-height: 44px;
}

.warnBox{
  margin-top: 10px;
  border: 1px solid rgba(239,68,68,.18);
  background: rgba(239,68,68,.06);
  border-radius: 16px;
  padding: 10px 12px;
  color:#7f1d1d;
  font-size: 13px;
  line-height:1.45;
  display:none;
}
.warnBox.show{ display:block; }

.skeleton{
  border-radius: var(--radius);
  border: 1px solid rgba(15,23,42,.08);
  background: rgba(255,255,255,.82);
  overflow:hidden;
  position:relative;
  min-height: 170px;
  box-shadow: var(--shadow-sm);
}
.shimmer{
  position:absolute; inset:0;
  background: linear-gradient(90deg, rgba(241,245,249,0) 0%, rgba(241,245,249,.85) 50%, rgba(241,245,249,0) 100%);
  transform: translateX(-100%);
  animation: shimmer 1.15s ease-in-out infinite;
}
@keyframes shimmer{
  0%{ transform: translateX(-100%); }
  100%{ transform: translateX(100%); }
}

.call-toast{
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 350px;
  background: linear-gradient(135deg, rgba(79,209,197,.95), rgba(122,167,255,.95));
  color: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 9999;
}

.call-toast.show{
  transform: translateY(0);
  opacity: 1;
}

.call-toast-inner strong{
  display: block;
  font-size: 15px;
  margin-bottom: 6px;
}

.call-toast-inner p{
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  opacity: .9;
}

footer{
  margin: 14px 0 26px;
  color: var(--muted);
  font-size: 12px;
  line-height:1.6;
  padding: 0 2px;
}
/* Add these fixes to your styles.css file */

/* FIX 1: Recently Updated Badge - Now in badgeRow, disable ::after to prevent duplicates */
.card[data-recent="true"]::after{
  content: none; /* Disabled - badge is now in badgeRow for all devices */
}

/* Style the "Recently Updated" badge in badgeRow for desktop */
.badge.recent {
  background: rgba(34,197,94,.12);
  color: #15803d;
  border: 1px solid rgba(34,197,94,.25);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Ensure card has proper overflow handling - properties already defined above at line 1118 */

/* FIX 2: Triage Section Centering & Sizing */
.triage-card h2{
  margin: 0 0 8px;
  font-size: clamp(18px, 4vw, 22px);
  font-weight: 900;
  line-height: 1.2;
}

.triage-card p{
  margin: 0 0 20px;
  color: var(--muted);
  font-size: clamp(13px, 2.5vw, 14px);
  line-height: 1.5;
}

/* Better button sizing in triage cards */
.triage-card .btn-emergency,
.triage-card .btn-secondary{
  font-size: clamp(14px, 3vw, 18px);
}

/* Care levels guide accordion - refactored from inline styles */
.care-levels-guide {
  margin: 20px 0;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.care-levels-summary {
  cursor: pointer;
  padding: 12px 16px;
  background: rgba(79,209,197,.08);
  border: 1px solid rgba(79,209,197,.2);
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.2s ease;
  min-height: 44px;
}

.care-levels-summary:hover {
  background: rgba(79,209,197,.12);
}

.care-levels-summary:focus-visible {
  outline: 2px solid rgba(122,167,255,.6);
  outline-offset: 2px;
  box-shadow: var(--focus);
}

.care-levels-summary-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.care-levels-summary-icon {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.care-levels-guide[open] .care-levels-summary-icon {
  transform: rotate(180deg);
}

.care-levels-body {
  padding: 20px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(15,23,42,.1);
  border-top: none;
  border-radius: 0 0 12px 12px;
  margin-top: -1px;
}

.care-levels-grid {
  display: grid;
  gap: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
}

.care-levels-section {
  margin: 0;
}

.care-levels-heading {
  margin: 0 0 6px 0;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

.care-levels-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.care-levels-list li {
  margin-bottom: 6px;
}

.care-levels-disclaimer {
  margin: 16px 0 0 0;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* Global reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .care-levels-summary,
  .care-levels-summary-icon {
    transition: none;
  }
}

@media (max-width: 640px) {
  .care-levels-guide {
    margin: 16px 0;
  }
  
  .care-levels-body {
    padding: 16px;
  }
  
  .care-levels-grid {
    gap: 12px;
    font-size: 12px;
  }
}

/* Empty state link */
.empty-state-link {
  display: inline-block;
  margin-top: 12px;
  color: #1a655c;
  text-decoration: underline;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.empty-state-link:hover,
.empty-state-link:focus-visible {
  color: var(--b);
  outline: 2px solid rgba(122,167,255,.6);
  outline-offset: 2px;
  border-radius: 4px;
}

.empty-state-tip {
  margin: 16px 0 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* Advanced Filters Accordion */
.advanced-filters-accordion {
  margin: 16px 0;
  border-radius: var(--radius);
  border: 1px solid rgba(15,23,42,.08);
  background: rgba(255,255,255,.85);
  overflow: hidden;
}

.advanced-filters-summary {
  cursor: pointer;
  padding: 12px 16px;
  background: rgba(15,23,42,.03);
  border: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.2s ease;
  min-height: 44px;
  list-style: none;
}

.advanced-filters-summary::-webkit-details-marker {
  display: none;
}

.advanced-filters-summary:hover {
  background: rgba(15,23,42,.05);
}

.advanced-filters-summary:focus-visible {
  outline: 2px solid rgba(122,167,255,.6);
  outline-offset: -2px;
  box-shadow: var(--focus);
}

.advanced-filters-summary-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.advanced-filters-summary-icon {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.advanced-filters-accordion[open] .advanced-filters-summary-icon {
  transform: rotate(180deg);
}

.advanced-filters-content {
  padding: 16px;
  border-top: 1px solid rgba(15,23,42,.08);
}

.advanced-filters-content .search-grid {
  gap: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .advanced-filters-summary,
  .advanced-filters-summary-icon {
    transition: none;
  }
  
  .advanced-filters-accordion[open] .advanced-filters-summary-icon {
    transform: none;
  }
}

/* Active Filter Chips */
.active-filters-container {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 8px 0;
  min-height: 36px;
  max-width: 100%;
  overflow: visible; /* Allow chips to wrap, don't clip */
  position: relative;
  z-index: 0; /* Below results-header */
}

.active-filters-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.active-filters-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(79,209,197,.1);
  border: 1px solid rgba(79,209,197,.25);
  border-radius: 16px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.2;
}

.active-filter-chip-label {
  font-weight: 500;
}

.active-filter-chip-remove {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  margin-left: 2px;
  cursor: pointer;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
}

.active-filter-chip-remove:hover {
  background: rgba(15,23,42,.1);
  color: var(--ink);
}

.active-filter-chip-remove:focus-visible {
  outline: 2px solid rgba(122,167,255,.6);
  outline-offset: 2px;
}

.active-filter-chip-remove:active {
  background: rgba(15,23,42,.15);
}

@media (max-width: 768px) {
  .active-filters-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .active-filters-label {
    font-size: 12px;
  }
  
  .active-filter-chip {
    font-size: 12px;
    padding: 5px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .active-filter-chip-remove {
    transition: none;
  }
}

/* Screen reader only class */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* FIX 3: Skip Link - Make it Properly Visible on Focus */
.skip-link{
  position: fixed; /* Changed from absolute to fixed */
  top: -50px; /* Start higher off screen */
  left: 10px;
  background: var(--a);
  color: white;
  padding: 12px 16px;
  z-index: 9999; /* Increase z-index significantly */
  text-decoration: none;
  font-weight: 700;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  transition: top .3s ease;
}

.skip-link:focus{
  top: 0; /* Slide down into view */
  outline: 3px solid white;
  outline-offset: 2px;
}

/* FIX 4: Card Content - Prevent Badge from Covering Text */
/* Removed padding-right for ::after badge since badge is now in badgeRow */

/* Responsive adjustment for smaller screens - badge now in badgeRow, no absolute positioning needed */
@media (max-width: 640px){
  /* Badge is now in badgeRow, so no special padding needed */
  .card[data-recent="true"] .cardTop {
    padding-right: 0 !important; /* No longer needed */
  }
  
  .card[data-recent="true"] .cardTop > div {
    max-width: 100% !important; /* Full width available */
    padding-right: 8px !important; /* Just space for expand button */
  }
  
  .card[data-recent="true"] .badgeRow {
    max-width: 100% !important; /* Full width for badges */
  }
}

/* FIX 5: Better Badge Row Wrapping */
.badgeRow{
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  margin: 0 0 10px;
  max-width: 100%; /* Full width - badge is now in badgeRow on mobile */
}

/* FIX 6: Triage Grid Responsive Improvements */
@media (max-width: 980px){
  .triage-grid{
    grid-template-columns: 1fr;
  }
  
  .triage-card{
    min-height: auto;
  }
}

/* FIX 7: Ensure Crisis Banner Doesn't Block Skip Link */
.crisis-banner{
  position: sticky;
  top: 0;
  z-index: 100; /* Lower than skip link */
  background: linear-gradient(135deg, rgba(239,68,68,.92), rgba(190,18,60,.92));
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.20);
  box-shadow: 0 10px 30px rgba(239,68,68,.18);
}

/* FIX 8: Card Hover State - Keep Badge Visible */
.card:hover{
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(79,209,197,.28);
  overflow: visible;
}

/* FIX 9: Trust Strip Better Centering on Mobile */
@media (max-width: 640px){
  .trust-grid{
    grid-template-columns: 1fr;
  }
  
  .trust-item{
    justify-content: center;
    text-align: center;
  }
}

/* ---------------------------------------------
   Website links (program cards)
   Added: 2025-12-26
---------------------------------------------- */

/* Make long URLs/domains wrap safely inside the key/value rows */
.kv .v{ word-break: break-word; overflow-wrap: anywhere; }

/* Button-like website link used inside the expanded panel */
.siteLink{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(122,167,255,.22);
  background: rgba(122,167,255,.12);
  text-decoration: none;
  font-weight: 950;
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  transition: var(--transition);
  min-height: 40px;
}
.siteLink:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15,23,42,.10);
}
.siteLink:focus{
  outline: none;
  box-shadow: var(--focus), 0 16px 34px rgba(15,23,42,.10);
}

/* Small domain hint next to website link (optional) */
.siteDomain{
  display: inline-block;
  margin-left: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* Verification source link - subtle, non-intrusive */
.verified-source{
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
  transition: color 0.2s ease;
}
.verified-source:hover{
  color: var(--a);
  border-bottom-color: var(--a);
}
.verified-source:focus{
  outline: none;
  box-shadow: var(--focus);
  border-radius: 4px;
}

/* Last verified date - subtle text */
.last-verified{
  display: inline-block;
  font-size: 11px;
  color: var(--muted2);
  margin-left: 8px;
}

/* Ensure verification source wraps cleanly on mobile */
@media (max-width: 640px){
  .verified-source, .last-verified{
    font-size: 11px;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .kv .v .verified-source{
    display: block;
    margin-top: 4px;
  }
}

/* Optional: make Website action button feel distinct but still neutral */
.linkBtn.site{
  background: rgba(255,255,255,.92);
}

/* Prevent long strings from breaking layout */
.v, .org, .pname{
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ========== New Features: Results Actions, Modals, Quick Actions ========== */

.results-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
  flex: 0 1 auto;
  overflow: visible;
}

.results-actions-primary,
.results-actions-secondary{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.results-actions-secondary .btn-icon--compact{
  padding: 10px 12px;
}

.results-actions-overflow{
  display: none;
  position: relative;
}

.results-overflow-menu{
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 180px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.98);
  box-shadow: 0 16px 40px rgba(15,23,42,.12);
}

.results-overflow-menu[hidden]{
  display: none !important;
}

.results-overflow-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
}

.results-overflow-item:hover{
  background: rgba(122,167,255,.10);
}

.results-overflow-item .badge-count{
  position: static;
  margin-left: auto;
}

/* Ensure all button children in results-actions can shrink */
.results-actions > * {
  min-width: 0;
  flex-shrink: 1;
}

.sort-group{
  position: relative;
}

.sort-select{
  padding: 10px 36px 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.92);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: var(--transition);
  min-height: 44px;
}

.sort-select:hover{
  border-color: rgba(122,167,255,.35);
  box-shadow: var(--shadow-sm);
}

.sort-select:focus{
  outline: none;
  border-color: rgba(122,167,255,.55);
  box-shadow: var(--focus);
}

.btn-icon{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.85);
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  position: relative;
  min-height: 44px;
}

.btn-icon:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15,23,42,.10);
  background: rgba(255,255,255,.95);
}

.btn-icon .icon{
  font-size: 16px;
  line-height: 1;
}

.btn-icon .badge-count{
  position: absolute;
  top: -4px;
  right: -4px;
  background: linear-gradient(135deg, rgba(239,68,68,.95), rgba(220,38,38,.95));
  color: white;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(239,68,68,.30);
}

.btn-near-me{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(79,209,197,.3);
  background: rgba(79,209,197,.12);
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  position: relative;
  min-height: 44px;
}

.btn-near-me:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15,23,42,.10);
  background: rgba(79,209,197,.2);
  border-color: rgba(79,209,197,.4);
}

.btn-near-me:focus{
  outline: none;
  box-shadow: var(--focus);
}

.btn-near-me .icon{
  font-size: 16px;
  line-height: 1;
}

/* Stop Sharing Location Button (TDPSA Compliance) */
.btn-stop-location{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(239,68,68,.3);
  background: rgba(239,68,68,.12);
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
  position: relative;
  min-height: 44px;
}

.btn-stop-location:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15,23,42,.10);
  background: rgba(239,68,68,.2);
  border-color: rgba(239,68,68,.4);
}

.btn-stop-location:focus{
  outline: none;
  box-shadow: 0 0 0 4px rgba(239,68,68,.28);
}

.btn-stop-location .icon{
  font-size: 16px;
  line-height: 1;
}

.badge.distance-badge{
  background: rgba(79,209,197,.15);
  border-color: rgba(79,209,197,.25);
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 640px){
  .btn-icon .btn-text{
    display: none;
  }
  .btn-near-me .btn-text,
  .btn-stop-location .btn-text{
    display: none;
  }
  .btn-near-me,
  .btn-stop-location{
    padding: 10px 12px;
  }
  .results-actions{
    gap: 8px;
  }
}

/* Modal Styles */
.modal{
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-left: max(20px, env(safe-area-inset-left, 0)); /* Safe area for iPhone notch */
  padding-right: max(20px, env(safe-area-inset-right, 0));
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0)); /* Safe area for home indicator */
  background: rgba(15,23,42,.60);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Lock body scroll when modal is open - improved for mobile Safari */
body.modal-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  /* Prevent iOS Safari bounce scroll */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
}

.modal[aria-hidden="false"]{
  opacity: 1;
  visibility: visible;
}

.modal-content{
  background: var(--cardSolid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 100%;
  max-height: 80dvh; /* Use dvh for mobile Safari */
  max-height: 80vh; /* Fallback */
  display: flex;
  flex-direction: column;
  transform: scale(.95) translateY(20px);
  transition: transform .25s ease;
  overflow: hidden;
  margin: auto;
}

.modal[aria-hidden="false"] .modal-content{
  transform: scale(1) translateY(0);
}

.modal-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
  min-width: 0;
}

.modal-header h2{
  margin: 0;
  font-size: 20px;
  font-weight: 950;
  letter-spacing: -.02em;
  word-wrap: break-word;
  overflow-wrap: break-word;
  flex: 1;
  min-width: 0;
}

.modal-close{
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: rgba(241,245,249,.85);
  border-radius: 12px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  padding: 0;
  flex-shrink: 0;
}

.modal-close:hover{
  background: rgba(241,245,249,1);
  color: var(--ink);
  transform: scale(1.1);
}

.modal-close:focus-visible {
  outline: 2px solid rgba(122,167,255,.85);
  outline-offset: 2px;
  color: var(--ink);
}

.modal-body{
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.modal-body .card{
  margin-bottom: 14px;
}

.modal-body .grid{
  padding: 0;
}

/* Favorites grid in modal - 2 cards per row on desktop */
/* Center cards in Saved Programs modal */
#favoritesModal .favorites-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
}

#favoritesModal .favorites-grid > .card {
  flex: 1 1 420px;
  max-width: 520px;
}

@media (max-width: 760px) {
  #favoritesModal .favorites-grid > .card {
    flex-basis: 100%;
    max-width: 100%;
  }
}

/* Prevent per-character wrapping on titles in favorites modal */
#favoritesModal .card h3,
#favoritesModal .card .title {
  word-break: normal;
  overflow-wrap: break-word;
}

/* Fix meta header layout in Saved Programs modal - prevent badge overlap */
#favoritesModal .card-meta-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-bottom: 10px;
  width: 100%;
  position: relative;
}

#favoritesModal .card-meta-header .badgeRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  max-width: 100%;
  flex: 1 1 auto;
  justify-content: center;
}

#favoritesModal .card-meta-header .badge {
  max-width: 100%;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Make "Recently Updated" badge participate in flex flow in modal (remove absolute positioning) */
#favoritesModal .card[data-recent="true"]::after {
  position: static !important;
  display: inline-flex;
  align-items: center;
  margin: 0;
  top: auto !important;
  right: auto !important;
  max-width: none;
  white-space: nowrap;
}

/* Center the meta header content when it wraps */
#favoritesModal .card[data-recent="true"] .card-meta-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* Remove padding that was added for absolute badge */
#favoritesModal .card[data-recent="true"] .cardTop {
  padding-right: 0;
}

/* Toast Notification */
.toast{
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  background: var(--cardSolid);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  transform: translateY(100px);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  pointer-events: none;
}

.toast.show{
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast.success{
  border-color: rgba(34,197,94,.35);
  background: rgba(34,197,94,.08);
  color: #15803d;
}

.toast.error{
  border-color: rgba(239,68,68,.35);
  background: rgba(239,68,68,.08);
  color: #7f1d1d;
}

/* Card Quick Actions */
.card-actions{
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(15,23,42,.10);
  flex-wrap: wrap;
}

.card-action-btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.85);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  min-height: 36px;
}

.card-action-btn:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  background: rgba(255,255,255,.95);
}

.card-action-btn.favorite.active{
  background: rgba(249,115,22,.12);
  border-color: rgba(249,115,22,.30);
  color: #9a3412;
}

.card-action-btn.favorite.active .icon{
  color: #f97316;
}

.card-action-btn .icon{
  font-size: 14px;
  line-height: 1;
}

/* Recent Searches - Less Prominent */
.recent-searches{
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(15,23,42,.05);
  opacity: 0.75;
}

.recent-searches-title{
  font-size: 11px;
  font-weight: 700;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 6px;
}

.recent-search-tags{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.recent-search-tag{
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.06);
  background: rgba(255,255,255,.60);
  color: var(--muted2);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.recent-search-tag:hover{
  background: rgba(122,167,255,.08);
  border-color: rgba(122,167,255,.15);
  color: var(--muted);
  transform: translateY(-1px);
}

/* Filter Presets */
.filter-presets:not(.filter-presets--quickstart) {
  margin-top: 12px;
}

.filter-preset-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.70);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.filter-preset-btn:hover {
  background: rgba(122,167,255,.12);
  border-color: rgba(122,167,255,.25);
  color: var(--ink);
  transform: translateY(-1px);
}

/* Smart search tips & examples */
.search-tips {
  flex: 1 1 100%;
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.search-tips summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
  list-style-position: outside;
  padding: 4px 0;
}

.search-tips summary:hover {
  color: var(--c);
}

.search-tips-body {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.72);
}

.search-tips-body p {
  margin: 0 0 8px;
  line-height: 1.45;
}

.search-tips-list {
  margin: 0 0 10px 1.1rem;
  padding: 0;
  line-height: 1.5;
}

.search-tips-list code {
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(122, 167, 255, 0.12);
}

.search-tips-examples-label {
  margin: 0 0 6px !important;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.search-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-example-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px dashed rgba(122, 167, 255, 0.45);
  background: rgba(122, 167, 255, 0.08);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.search-example-chip:hover {
  background: rgba(122, 167, 255, 0.18);
  border-style: solid;
  transform: translateY(-1px);
}

/* Comparison Styles */
.compare-btn {
  position: relative;
}

.compare-btn.active {
  background: rgba(196,181,253,.12);
  border-color: var(--c);
  color: var(--c);
}

.comparison-modal-content {
  max-width: 90vw;
  width: 100%;
  overflow: hidden;
}

.comparison-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  position: relative;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: auto;
  min-width: 600px;
}

.comparison-table th,
.comparison-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--stroke);
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 300px;
}

.comparison-table th {
  background: var(--bg1);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.comparison-table tbody tr:hover {
  background: var(--bg1);
}

.comparison-label-header {
  min-width: 180px;
  width: 180px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg1);
}

.comparison-label {
  font-weight: 600;
  color: var(--muted);
  min-width: 180px;
  width: 180px;
  background: rgba(242, 251, 255, 0.5);
}

.comparison-program-header {
  min-width: 280px;
  width: 280px;
}

.comparison-value {
  min-width: 280px;
  max-width: 400px;
  line-height: 1.6;
  position: relative;
}

.comparison-value:has(.comparison-insurance-list) {
  padding: 14px 18px;
  vertical-align: top;
  overflow: visible;
}

.comparison-value .comparison-insurance-list {
  width: 100%;
  box-sizing: border-box;
}

.comparison-link {
  color: var(--b);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.comparison-link:hover {
  border-bottom-color: var(--b);
  text-decoration: none;
}

.comparison-insurance-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  margin: 0;
  min-height: 40px;
}

.comparison-insurance-list:only-child {
  width: 100%;
}

.comparison-insurance-list::-webkit-scrollbar {
  width: 6px;
}

.comparison-insurance-list::-webkit-scrollbar-track {
  background: rgba(15,23,42,.05);
  border-radius: 3px;
}

.comparison-insurance-list::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,.15);
  border-radius: 3px;
}

.comparison-insurance-list::-webkit-scrollbar-thumb:hover {
  background: rgba(15,23,42,.25);
}

.comparison-insurance-item {
  padding: 6px 10px;
  background: rgba(122,167,255,.08);
  border: 1px solid rgba(122,167,255,.15);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
  color: var(--ink);
}

.comparison-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.comparison-header-content {
  flex: 1;
  min-width: 0;
}

.comparison-header .remove-compare {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  transition: var(--transition);
  font-weight: bold;
}

.comparison-header .remove-compare:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.comparison-header strong {
  display: block;
  margin-bottom: 6px;
  word-wrap: break-word;
  font-size: 15px;
  line-height: 1.4;
}

.comparison-org {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  word-wrap: break-word;
}

@media (max-width: 768px) {
  .comparison-modal-content {
    max-width: 95%;
    width: calc(100% - 20px); /* Changed from 100vw */
  }
  
  .comparison-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin: 0 -18px;
    padding: 0 18px;
  }
  
  .comparison-table {
    font-size: 12px;
    min-width: 500px;
  }
  
  .comparison-table th,
  .comparison-table td {
    padding: 10px 12px;
    max-width: 200px;
  }
  
  .comparison-label-header,
  .comparison-label {
    min-width: 120px;
    width: 120px;
    font-size: 11px;
  }
  
  .comparison-program-header,
  .comparison-value {
    min-width: 180px;
    max-width: 220px;
  }
  
  .comparison-header strong {
    font-size: 13px;
    word-wrap: break-word;
  }
  
  .comparison-org {
    font-size: 11px;
    word-wrap: break-word;
  }
}

/* Privacy Controls */
.privacy-controls {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.privacy-content {
  background: var(--cardSolid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  margin: auto;
}

.privacy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--stroke);
}

.privacy-header h2 {
  margin: 0;
  font-size: 20px;
}

.privacy-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: var(--transition);
}

.privacy-close:hover {
  background: var(--bg1);
  color: var(--ink);
}

.privacy-body {
  padding: 24px;
}

.privacy-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--muted);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: #64748b;
  transform: translateY(-1px);
}

.privacy-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.privacy-toggle:hover {
  background: var(--bg1);
}

.privacy-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.privacy-info {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--stroke);
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --bg0: #ffffff;
    --bg1: #ffffff;
    --card: #ffffff;
    --cardSolid: #ffffff;
    --stroke: #000000;
    --stroke2: #000000;
    --ink: #000000;
    --muted: #333333;
    --muted2: #333333;
    --a: #0066cc;
    --b: #0066cc;
    --c: #0066cc;
    --danger: #cc0000;
    --ok: #006600;
  }
  
  .card {
    border: 2px solid var(--stroke);
  }
  
  button, .btnlike, .linkBtn {
    border: 2px solid var(--stroke);
  }
  
  input, select, textarea {
    border: 2px solid var(--stroke);
  }
}

/* High Contrast Mode Toggle (manual) */
body.high-contrast {
  --bg0: #ffffff !important;
  --bg1: #ffffff !important;
  --card: #ffffff !important;
  --cardSolid: #ffffff !important;
  --stroke: #000000 !important;
  --stroke2: #000000 !important;
  --ink: #000000 !important;
  --muted: #333333 !important;
  --muted2: #333333 !important;
}

body.high-contrast .card {
  border: 2px solid var(--stroke) !important;
}

body.high-contrast button,
body.high-contrast .btnlike,
body.high-contrast .linkBtn {
  border: 2px solid var(--stroke) !important;
}

body.high-contrast input,
body.high-contrast select,
body.high-contrast textarea {
  border: 2px solid var(--stroke) !important;
}

/* Print Styles */
@media print{
  .crisis-banner,
  .search-section,
  .results-actions,
  .card-action-btn,
  .expandBtn,
  .btn-icon,
  .modal,
  .toast{
    display: none !important;
  }
  
  .card[data-open="false"] .panel{
    max-height: none !important;
    opacity: 1 !important;
    display: block !important;
  }
  
  .card{
    page-break-inside: avoid;
    margin-bottom: 20px;
  }
}

/* ========== MOBILE-FIRST LAYOUT (max-width: 640px) ========== */
/* Consolidated mobile rules - single source of truth for mobile layout */

@media (max-width: 640px){
  /* Global overflow prevention */
  html, body {
    overflow-x: clip; /* Modern */
    overflow-x: hidden; /* Fallback */
    width: 100%;
    max-width: 100%;
  }
  
  /* Container: consistent 16px padding (mobile-first) */
  .container {
    padding-left: 16px;
    padding-right: 16px;
    max-width: 100%;
    overflow-x: clip;
    overflow-x: hidden;
  }
  
  /* Prevent images and media from overflowing */
  img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
  }
  
  /* Fix results header */
  .results-header{
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    overflow: visible; /* Allow content to wrap */
  }
  
  /* Results actions: primary row + overflow menu */
  .results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    overflow: visible;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .results-actions-secondary{
    display: none;
  }

  .results-actions-overflow{
    display: block;
    margin-left: auto;
  }
  
  /* Ensure all buttons in results-actions are mobile-friendly */
  .results-actions > * {
    min-height: 44px; /* Tap target */
    min-width: 0; /* Allow shrinking */
    flex-shrink: 1;
  }

  .search-toolbar{
    flex-direction: column;
    align-items: stretch;
  }

  .search-toolbar .btn-reset-link{
    margin-left: 0;
    align-self: flex-end;
  }
  
  /* Alternative: horizontal scroll toolbar (uncomment if wrapping causes issues) */
  /*
  .results-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 8px;
  }
  .results-actions::-webkit-scrollbar {
    display: none;
  }
  */
  
  /* Ensure results count and label don't get cut off */
  .results-info {
    min-width: 0;
    flex: 1 1 auto;
    overflow: visible;
  }
  
  .results-count {
    font-size: 22px; /* Slightly smaller on mobile to prevent overflow */
  }
  
  /* Fix modal sizing - use 100dvh for mobile Safari, avoid 100vw */
  .modal-content{
    max-height: 90dvh; /* Use dvh for mobile Safari */
    max-height: 90vh; /* Fallback */
    margin: 10px;
    max-width: calc(100% - 20px); /* Changed from 100vw */
    width: calc(100% - 20px); /* Changed from 100vw */
  }
  
  .modal {
    padding: 10px;
  }
  
  .modal-header {
    padding: 16px 18px;
  }
  
  .modal-body {
    padding: 18px;
  }
  
  /* Fix toast positioning - avoid 100vw */
  .toast{
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
    width: calc(100% - 32px); /* Changed from 100vw */
    /* Safe area padding for iPhone home indicator */
    bottom: calc(16px + env(safe-area-inset-bottom, 0));
  }
  
  /* Fix header content wrapping */
  .header-content {
    flex-wrap: wrap;
  }
  
  .header-actions {
    width: 100%;
    justify-content: flex-start;
    margin-top: 12px;
  }
  
  /* Search section: mobile-first, no negative margins, natural flow */
  .search-section {
    padding: 16px;
    margin: 0 0 20px 0; /* No negative margins - natural flow below header */
    width: 100%;
    max-width: 100%;
    position: relative; /* Not sticky on mobile */
    box-shadow: none; /* Performance: remove expensive shadow */
    backdrop-filter: none; /* Performance: remove backdrop blur */
    background: rgba(255,255,255,.95);
  }
  
  /* Search simple: mobile-first grid layout - MUST override any flex */
  .search-simple {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px;
    margin-bottom: 0;
    width: 100%;
    max-width: 100%;
  }
  
  /* Input group: full width in mobile grid */
  .input-group-primary {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: none !important; /* Override flex-basis */
  }
  
  /* Input wrapper: ensure full width */
  .input-wrapper {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Search input: full width, 16px font to prevent iOS zoom */
  .input-group-primary input[type="search"],
  .input-group-primary input[type="text"],
  #q {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 16px !important; /* Critical: prevents iOS zoom on focus */
    box-sizing: border-box !important;
    min-height: 44px !important; /* Tap target */
  }
  
  /* Buttons: full width in mobile grid */
  .btn-smart-search,
  .btn-advanced,
  #findBtn {
    width: 100% !important;
    min-height: 44px !important; /* Tap target */
    box-sizing: border-box !important;
    font-size: 16px !important; /* Consistent with input */
  }
  
  /* Advanced + Reset buttons: 2-column grid if both present, else full width */
  .search-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    margin-top: 0;
  }
  
  .search-actions .btn-advanced,
  .search-actions button[data-preset="reset"] {
    width: 100%;
    min-height: 44px;
  }
  
  /* Search header: compact spacing on mobile */
  .search-header {
    margin: 8px 0 12px;
  }
  
  .search-header h3 {
    margin-bottom: 6px;
    font-size: 18px;
    line-height: 1.3;
  }
  
  .search-header p {
    margin-top: 4px;
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.5;
  }
  
  /* Results header: proper spacing from search section */
  .results-header {
    margin-top: 20px; /* Increased to prevent overlap */
    margin-bottom: 12px;
    padding-top: 12px;
    padding-bottom: 8px;
    clear: both;
  }
  
  /* Ensure results-actions has proper spacing from header */
  .results-actions {
    margin-top: 8px; /* Space from results-info */
  }
  
  /* Ensure active filters container doesn't overlap results header */
  .active-filters-container {
    margin-bottom: 12px !important;
    margin-top: 8px !important;
    max-width: 100%;
    overflow: visible; /* Allow chips to wrap, don't clip */
    clear: both; /* Ensure it's below search section */
  }
  
  /* Prevent filter chips from overlapping results */
  .active-filters-chips {
    max-width: 100%;
    overflow: visible;
  }
  
  .active-filter-chip {
    max-width: calc(100% - 16px); /* Prevent chips from being too wide */
    word-break: break-word; /* Allow long filter names to wrap */
  }
  
  /* Fix gap between sections */
  .section {
    margin-top: 8px;
  }
  
  /* Reduce gaps in cards on mobile */
  .card {
    margin-bottom: 0;
  }
  
  /* Fix grid layouts */
  .grid {
    gap: 12px;
    padding: 12px;
  }
  
  /* Fix card overflow */
  .card {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  
  /* Fix kv grid to single column */
  .kv {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .kv .k {
    margin-bottom: 4px;
  }
  
  /* Fix badge row */
  .badgeRow {
    max-width: 100%;
  }
  
  /* Fix triage cards */
  .triage-card {
    padding: 20px;
  }
  
  /* Fix trust strip — keep aligned with container padding */
  .trust-strip {
    padding: 16px;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* Fix hero section */
  .hero {
    margin-top: 12px;
  }
  
  .hero-copy {
    padding: 18px;
  }
  
  /* Fix comparison table wrapper */
  .comparison-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
  }
  
  /* Fix floating cards */
  .floating-card {
    width: min(200px, 80%);
    font-size: 11px;
  }
  
  /* Fix program detail grid */
  .program-detail-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .program-detail-label {
    margin-bottom: 4px;
  }
  
  /* Fix program detail header */
  .program-detail-header {
    padding: 18px;
  }
  
  .program-detail-title {
    font-size: 22px;
  }
  
  .program-detail-org {
    font-size: 16px;
  }
  
  /* Fix section overflow */
  .section {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
  }
  
  /* Fix input groups */
  .input-group {
    width: 100%;
    max-width: 100%;
  }
  
  .input-group-primary {
    width: 100%;
    max-width: 100%;
  }
  
  /* Optimize search simple layout on mobile */
  .search-simple {
    gap: 6px;
    margin-top: 0;
    align-items: stretch;
  }
  
  /* Optimize input group spacing on mobile */
  .input-group label,
  .input-group-primary label {
    margin-bottom: 4px;
    font-size: 13px;
  }
  
  .input-wrapper {
    margin-top: 0;
  }
  
  /* Tighten button spacing on mobile */
  .btn-smart-search,
  .btn-advanced {
    margin-top: 0;
  }
  
  /* Fix dropdown menu positioning */
  .dd-menu {
    max-width: calc(100% - 24px); /* Changed from 100vw */
    left: 0;
    right: 0;
  }
  
  /* Fix search suggestions - constrain height and enable scrolling to prevent covering buttons */
  .search-suggestions {
    max-width: calc(100% - 24px); /* Changed from 100vw */
    left: 0;
    right: 0;
    max-height: min(240px, 40vh);
    overflow-y: auto;
  }
  
  /* Fix hero bullets */
  .hero-bullets {
    width: 100%;
    max-width: 100%;
  }
  
  /* Fix filter presets (quick start centered in search-header) */
  .filter-presets:not(.filter-presets--quickstart) {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 4px !important;
    gap: 6px !important;
    margin-bottom: 6px;
  }

  .search-header .filter-presets--quickstart {
    margin-top: 12px !important;
    overflow-x: visible;
    justify-content: center !important;
    align-items: center !important;
  }

  .filter-presets--quickstart .filter-presets-buttons {
    justify-content: center !important;
  }
  
  .filter-preset-btn {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 12px;
    min-height: 44px;
  }
}

.sectionHead--with-intro .results-intro {
  margin: 10px 0 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 72ch;
}

.listing-related-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  background: rgba(241, 245, 249, 0.85);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
}

