/* Blocco 1.2.6 — contenimento reale delle dashboard autenticate su Safari/iPhone. */
@media (max-width: 800px), (max-device-width: 800px) {
  html,
  body,
  .top,
  .topin,
  .wrap,
  #coachView,
  #studentView,
  #coachView > .grid,
  #studentView > .grid {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .topin,
  .wrap {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .topin > div,
  .header-actions,
  .global-rating,
  .nav,
  #coachView > .grid > *,
  #studentView > .grid > *,
  .student-overview-grid,
  .student-overview-card,
  .player-metrics-card,
  .student-home-hero,
  .coach-home-hero,
  .focus-hero,
  .focus-list,
  .focus-row {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
  }

  .header-actions,
  .global-rating,
  .nav { width: 100%; }

  .global-rating { min-width: 0; }

  .nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav .btn {
    width: 100%;
    min-width: 0;
  }

  #coachView > .grid,
  #studentView > .grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  #coachView > .section-tabs,
  #studentView > .section-tabs {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
  }

  #coachView > .section-tabs .btn,
  #studentView > .section-tabs .btn {
    width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #coachView > .grid > :is(.c3, .c4, .c6, .c8, .c12),
  #studentView > .grid > :is(.c3, .c4, .c6, .c8, .c12) {
    grid-column: 1 / -1;
  }

  .student-overview-grid,
  .student-mini-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .student-overview-card > .row,
  .metric-bar-head,
  .focus-bar-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .student-overview-card h3,
  .rating-delta,
  .focus-title,
  .focus-meta,
  .focus-reasons,
  .home-last {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .focus-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .focus-row > .actions { grid-column: 2; }

  .environment-badge {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    max-width: calc(100vw - max(24px, env(safe-area-inset-left) + env(safe-area-inset-right)));
  }
}
