/* ═══════════════════════════════════════════
   Responsive — Mobile-first breakpoints
   ═══════════════════════════════════════════ */

/* ── Tablet (768px+) ── */
@media (min-width: 768px) {
  /* 379 — Seitenleiste, Kopf und untere Leiste kommen aus `.wd-shell` (Haltepunkt 1024 px). */
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .grid-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .sheet {
    max-width: 560px;
    margin: 0 auto;
    border-radius: var(--r-xl);
    margin-bottom: var(--sp-lg);
  }

  .overlay {
    align-items: center;
    justify-content: center;
  }
}

/* ── Desktop (1024px+) ── */
@media (min-width: 1024px) {
  .grid-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Calendar Mobile Overrides ── */
@media (max-width: 767px) {
  .cal-day-layout {
    grid-template-columns: 1fr;
  }

  .cal-week-h {
    min-height: 400px;
  }

  .cal-day-col-header {
    font-size: 9px;
  }

  .cal-time-col { width: 32px; }
  .cal-time-label { font-size: 8px; }

  .cal-month-cell { min-height: 56px; }
  .cal-month-grid { grid-template-columns: 28px repeat(7, 1fr); }
  .cal-month-header-row { grid-template-columns: 28px repeat(7, 1fr); }

  .cal-month-v-grid { grid-template-columns: 40px repeat(6, 1fr) !important; }
  .cal-mv-cell { min-height: 56px; }

  .calendar-controls { flex-wrap: wrap; gap: var(--sp-xs); justify-content: center; }
  .calendar-separator { display: none; }
  .cal-nav-btn { min-width: 64px; font-size: 11px; padding: 6px 8px; }
  .calendar-nav-row { gap: var(--sp-2xs); }
  .calendar-nav-title { font-size: var(--fs-xs); min-width: 80px; }
  .calendar-view-btn { padding: 4px 8px; font-size: 11px; }

  .calendar-day-entries { flex-wrap: nowrap; padding: var(--sp-xs); gap: var(--sp-xs); }
  .calendar-day-entries-date { font-size: var(--fs-xs); }

  .cal-week-h { height: 500px; }

  .cal-event-overlay { font-size: 9px; padding: 2px 3px; }

  .report-nav { flex-wrap: wrap; justify-content: center; }
  .report-date { flex-basis: 100%; text-align: center; order: -1; }
  .report-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Large (1440px+) ── */
@media (min-width: 1440px) {
  .grid-cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ── iOS-Zoom (399 A-018.2): Safari zoomt in jedes Feld unter 16 px Schrift und lässt die Seite danach seitlich
   scrollen. `!important`, weil einzelne Felder die Schrift inline setzen (dashboard.js, aufgaben.js: --fs-xs) und
   Inline-Style jede Selektor-Spezifität schlägt. Fällt es weg, kehrt der Zoom für genau diese Felder zurück.
   `(pointer: coarse)`: auch das iPad (820 px) zoomt, ist aber breiter als 767 px. Ohne die Touch-Bedingung
   bliebe es dort bei 13 px.
   Das viewport-Meta bleibt unberührt: Zoomen mit zwei Fingern soll erlaubt bleiben. */
@media (max-width: 767px), (pointer: coarse) {
  .input,
  textarea,
  select,
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=button]):not([type=submit]):not([type=reset]):not([type=hidden]) {
    font-size: 16px !important;
  }
}

/* ── page-heute: Schnellerfassung (Schritt 9.0, Variante B) ── */
/* EIN Render-Pfad (kein Doppel-DOM mehr): heute.js rendert .tile-quick genau
   einmal im Grid und bleibt auf jeder Breite im Fluss der Seite: sie scrollt mit
   dem Inhalt (399 A-021, Christian 30.10.: fest/fixed klebte am Platz). Kein
   position: fixed/sticky — bei offener Tastatur scrollt der Browser das Feld selbst ins Bild;
   ein eigenes Festhalten (A-020) kämpfte dagegen. */
@media (max-width: 767px) {
  /* Seitenende: die Menüleiste (BottomNav, fix am unteren Rand) darf die letzte Kachel nicht verdecken.
     --bottom-nav-h enthält die Safe-Area bereits (tokens.css/leiste.js). */
  .heute-raster {
    padding-bottom: calc(var(--bottom-nav-h) + var(--sp-lg));
  }
}

