/* Responsive refinements for phones and tablets. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body { min-width: 320px; }
img,
svg { max-width: 100%; }

.container {
  width: min(1160px, calc(100% - 40px));
  min-width: 0;
}

.operator-grid,
.operator-grid > article,
.hero-grid > *,
.quote-card > *,
.about-grid > *,
.hapvida-comparison,
.unimed-comparison,
.amil-comparison,
.sulamerica-comparison,
.bradesco-comparison,
.promedica-comparison {
  min-width: 0;
  max-width: 100%;
}

.hapvida-table-wrap {
  width: 100%;
  max-width: 100%;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #eef2f7;
}

.hapvida-table-wrap::-webkit-scrollbar { height: 9px; }
.hapvida-table-wrap::-webkit-scrollbar-track { background: #eef2f7; }
.hapvida-table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid #eef2f7;
  border-radius: 999px;
  background: #94a3b8;
}

.hapvida-table th:first-child,
.hapvida-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  box-shadow: 8px 0 14px -12px rgba(15, 23, 42, .55);
}

.hapvida-table thead th:first-child { z-index: 2; }
.sulamerica-table thead th:first-child { background: #eaf1ff; }
.bradesco-table thead th:first-child { background: #fff0f2; }
.amil-table thead th:first-child { background: #f3e8ff; }
.unimed-table thead th:first-child { background: #eaf4ff; }
.promedica-table thead th:first-child { background: #f1f5f9; }

@media (max-width: 1024px) {
  .amil-network,
  .amil-copay-grid,
  .unimed-network,
  .copay-grid,
  .sulamerica-network,
  .sulamerica-copay-grid,
  .bradesco-network,
  .bradesco-copay-grid,
  .promedica-network,
  .promedica-copay-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .hero-grid { gap: 36px; padding: 48px 0; }
  .hero-text { text-align: center; }
  .hero-actions,
  .proof-row { justify-content: center; }
  .cards-grid.four,
  .testimonial-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operator-grid { grid-template-columns: minmax(0, 1fr); }
  .logo-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hospitals-hero { width: 100%; }
  .hospital-montage { height: 390px; transform: none; }
}

@media (min-width: 641px) and (max-width: 820px) {
  .hospital-montage {
    height: auto;
    grid-template-columns: 1fr;
  }
  .hospital-tile { height: 220px; }
}

@media (max-width: 720px) {
  .hapvida-title,
  .unimed-title,
  .amil-title,
  .sulamerica-title,
  .bradesco-title,
  .promedica-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .hapvida-hospitals,
  .unimed-network,
  .copay-grid,
  .amil-network,
  .amil-copay-grid,
  .sulamerica-network,
  .sulamerica-copay-grid,
  .bradesco-network,
  .bradesco-copay-grid,
  .promedica-network,
  .promedica-copay-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hapvida-comparison,
  .unimed-comparison,
  .amil-comparison,
  .sulamerica-comparison,
  .bradesco-comparison,
  .promedica-comparison {
    padding: 18px 12px;
    border-radius: 20px;
  }

  .hapvida-table-wrap::before {
    content: "Deslize para o lado para ver todos os planos →";
    position: sticky;
    left: 0;
    display: block;
    width: 100%;
    padding: 10px 12px;
    background: #f8fafc;
    color: #64748b;
    font-size: .73rem;
    font-weight: 800;
  }

  .hapvida-table { font-size: .82rem; }
  .hapvida-table th,
  .hapvida-table td {
    padding: 11px 12px;
    white-space: nowrap;
  }

  .plan-subtitle { white-space: normal; }
  .tables-heading {
    font-size: clamp(28px, 8.5vw, 40px);
    line-height: 1.08;
    letter-spacing: .03em;
    overflow-wrap: anywhere;
  }
  .tables-disclaimer { margin-top: -12px; }
  .minimum-lives { white-space: normal; }
  .hapvida-cta {
    display: flex;
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  .final-cta-card { padding: 26px 17px; border-radius: 24px; }
  .final-cta-button { min-height: 84px; padding: 15px; }
  .form-callout { padding: 18px 15px; }
  .testimonial { padding: 24px 18px; }
}

@media (max-width: 640px) {
  .container { width: min(1160px, calc(100% - 28px)); }
  .nav { gap: 10px; }
  .brand { min-width: 0; gap: 7px; }
  .brand span { min-width: 0; }
  .brand strong { display: block; font-size: 13px; line-height: 1.15; }
  .brand small { display: none; }
  .btn-small {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 9px 12px;
    font-size: 12px;
  }
  .hero-grid { padding: 38px 0 34px; gap: 28px; }
  .hero h1 {
    font-size: clamp(34px, 10vw, 42px);
    line-height: 1.02;
    letter-spacing: -.045em;
  }
  .hero p { font-size: 16px; line-height: 1.6; }
  .hero-actions .btn { padding: 14px 16px; }
  .hospital-tile { height: 160px; }
  .hero .network-disclaimer { padding: 0 6px; }
  .cards-grid.four,
  .testimonial-grid,
  .faq-grid { grid-template-columns: minmax(0, 1fr); }
  .quote-card { padding: 18px; }
  .form-box { padding: 20px 16px; }
  .section-padding { padding: 54px 0; }
  .cards-grid article,
  .operator-card,
  .testimonial { padding: 20px; }
}

@media (max-width: 420px) {
  .hapvida-table { min-width: 640px; }
  .amil-table { min-width: 900px; }
  .unimed-table { min-width: 800px; }
  .sulamerica-table { min-width: 820px; }
  .bradesco-table,
  .promedica-table { min-width: 690px; }
  .hapvida-badge,
  .unimed-badge,
  .amil-badge,
  .sulamerica-badge,
  .bradesco-badge,
  .promedica-badge {
    max-width: 100%;
    white-space: normal;
    line-height: 1.3;
  }
}

@media (max-width: 380px) {
  .container { width: min(1160px, calc(100% - 22px)); }
  .brand-logo-img { width: 54px; }
  .brand strong { font-size: 12px; }
  .btn-small { padding: 8px 10px; font-size: 11px; }
  .hero h1 { font-size: 32px; }
  .quote-card { padding: 15px; }
  .form-box { padding: 18px 13px; }
}
