/* AGFA Finance — Mobile-Retrofit (≤900px). Desktop bleibt unverändert. */

@media (max-width: 900px) {
  html, body { overflow-x: hidden !important; max-width: 100vw; }
  body { position: relative; }
  section, main, header, footer, aside { min-width: 0; overflow-x: clip; }
  section > div { max-width: 100% !important; }
  div[style*="grid-template-columns"] > * { min-width: 0; }
  h1, h2, h3, p { overflow-wrap: break-word; }
  img, svg { max-width: 100%; }
  input, select, textarea, button { max-width: 100%; }

  /* Abstände */
  section { padding-left: 20px !important; padding-right: 20px !important; }
  main { padding-left: 16px !important; padding-right: 16px !important; }
  footer { padding-left: 20px !important; padding-right: 20px !important; }

  /* Typo-Skalierung */
  h1 { font-size: clamp(32px, 9.5vw, 46px) !important; line-height: 1.12 !important; }
  h2 { font-size: clamp(26px, 7.5vw, 36px) !important; line-height: 1.16 !important; }
  h3 { font-size: clamp(19px, 5.8vw, 25px) !important; }

  /* Grids: standardmäßig eine Spalte */
  div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  /* Ausnahmen: Wählfeld (Softphone) bleibt 3-spaltig, Kennzahlen 2-spaltig */
  div[style*="repeat(3, 1fr)"][style*="gap:8px"] { grid-template-columns: repeat(3, 1fr) !important; }
  div.agfa-dialpad { grid-template-columns: repeat(3, 1fr) !important; gap: 10px !important; }
  div.agfa-dialpad > button { aspect-ratio: 1.35 / 1; min-height: 56px; font-size: 20px !important; }
  div[style*="repeat(4, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
  div[style*="repeat(4, 1fr)"][style*="gap:8px"] { grid-template-columns: repeat(2, 1fr) !important; }

  /* Seitenleisten (Portal/Admin/Cockpit) stapeln statt kleben */
  aside { position: static !important; height: auto !important; min-height: 0 !important; }

  /* Flex-Reihen dürfen umbrechen (Hero-Statistiken, CTA-Reihen, Badges) */
  div[style*="gap:56px"] { flex-wrap: wrap !important; gap: 26px !important; }
  div[style*="gap:52px"] { flex-wrap: wrap !important; gap: 18px !important; }
  div[style*="display:flex"][style*="gap:18px"],
  div[style*="display:flex"][style*="gap:16px"],
  div[style*="display:flex"][style*="gap:14px"] { flex-wrap: wrap; }
  footer div[style*="justify-content:space-between"] { flex-wrap: wrap; gap: 12px; }

  /* Dekorative Hero-Visuals ausblenden (absolute Karten-Kompositionen) */
  div[style*="height:560px"][style*="position:relative"] { display: none !important; }
  div[style*="height:360px"][style*="position:relative"] { display: none !important; }
  /* Timeline-Linie (Über uns) */
  div[style*="top:7px"][style*="height:1px"] { display: none !important; }

  /* Fixe Header-Innenbreite */
  header > div { padding: 0 18px !important; gap: 14px !important; }

  /* Tabellenartige Zeilen: gestapelte Karten mit etwas Luft */
  div[style*="grid-template-columns:1.3fr"],
  div[style*="grid-template-columns:1.4fr"],
  div[style*="grid-template-columns:1.5fr"],
  div[style*="grid-template-columns:1.6fr"] { row-gap: 8px !important; }
}

@media (max-width: 480px) {
  section { padding-left: 16px !important; padding-right: 16px !important; }
  h1 { font-size: clamp(29px, 10vw, 38px) !important; }
}
