/* Screen layout only: document sheets keep their fixed print and PDF geometry. */
@media screen {
  .layout, .bank-layout, .home-view, .students-view, .employees-view,
  .project-toolbar, .preview-wrap, .editor, .bank-panel,
  .home-projects, .home-all-tools, .today-work {
    min-width: 0;
    max-width: 100%;
  }
  .layout > *, .bank-layout > *, .home-view > *,
  .home-launch-grid > *, .home-all-tools .home-quick-tools > *,
  #homeActivitySlot .today-columns > *, .grid > *,
  .students-filters > *, .employee-filters > * { min-width: 0; }
  .preview-wrap, .teaching-preview-scroll, .gradebook-preview-scroll,
  .timetable-scroll, .timetable-edit-wrap, .excel-preview-scroll,
  .employee-import-scroll, .roster-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .project-toolbar, .project-toolbar > div, .qtop, .qactions,
  .bank-actions, .bank-files, .student-actions, .student-row-actions,
  .converter-head, .converter-foot { flex-wrap: wrap; }
  .project-toolbar > div > button, .student-row-actions > button,
  .student-actions > button { min-width: 0; }
  .project-toolbar :is(span, button), .section-head, .preview-title,
  .bank-item-top, .official-template-bar { overflow-wrap: anywhere; }
  dialog { max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  dialog :is(input:not([type=checkbox]):not([type=radio]), select, textarea) {
    max-width: 100%;
  }
  .auth-shell, .auth-panel, .auth-card, .auth-intro { min-width: 0; }
}

@media screen and (max-width: 1050px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .preview-wrap { position: static; }
}

@media screen and (max-width: 760px) {
  body .top { flex-wrap: wrap; }
  .top > div, .top-actions { min-width: 0; }
  .top-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .top-actions button { min-height: 44px; white-space: normal; }
  .project-toolbar > div { flex-wrap: wrap; }
  .home-view .school-dashboard-header > * { min-width: 0; }
  .home-view .school-dashboard-header h1,
  .home-view .school-dashboard-header p { overflow-wrap: anywhere; }
  .home-view #resumeDraft { max-width: 100%; }
  .home-all-tools .home-quick-tools,
  .home-tools-section > .home-launch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .students-view .students-filters, .employees-view .employee-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .students-view .students-filters > .field:first-child,
  .employees-view .employee-filters > .field:first-child { grid-column: 1 / -1; }
  .student-rosters-dialog, .excel-students-dialog, .employee-import-dialog,
  .converter-dialog, .import-dialog { max-height: calc(100dvh - 16px); }
}

@media screen and (max-width: 520px) {
  .layout, .bank-layout { padding-inline: 12px; }
  .home-view, .students-view, .employees-view { padding-inline: 10px; }
  .project-toolbar { padding-inline: 12px; }
  .project-toolbar > div { width: 100%; }
  .project-toolbar > div > button { flex: 1 1 130px; }
  .preview-title, .bank-heading, .students-heading, .school-student {
    flex-wrap: wrap;
  }
  .preview-title > button { min-height: 44px; }
  .student-actions > button, .student-row-actions > button { flex: 1 1 120px; }
  .students-view .students-filters, .employees-view .employee-filters,
  .bank-controls, .converter-options { grid-template-columns: minmax(0, 1fr); }
  .students-view .students-filters > *, .employees-view .employee-filters > *,
  .bank-controls > * { grid-column: auto !important; }
  .home-all-tools .home-quick-tools,
  .home-tools-section > .home-launch-grid { gap: 8px; }
  .home-all-tools .home-card { padding-inline: 9px; }
  dialog { max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .auth-panel { padding-inline: 18px; }
}

@media screen and (max-width: 360px) {
  .home-all-tools .home-quick-tools,
  .home-tools-section > .home-launch-grid { grid-template-columns: minmax(0, 1fr); }
  .top-actions { width: 100%; }
  .top-actions button { flex: 1 1 120px; }
}
