/* Phone interaction defaults; desktop layout starts at 1024px. */
:root {
  --touch-target: 44px;
  --mobile-nav-height: 69px;
  --focus-ring: 2px solid var(--primary);
}
.report-mobile-list { display: none; }
@media (width < 1024px) {
  html { scrollbar-width: none; scroll-padding-top: 84px; scroll-padding-bottom: 160px; }
  .topbar { min-height: calc(60px + env(safe-area-inset-top)); height: calc(60px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
  main, .page-home, .page-settings, .page-attendance, .page-student, .page-lesson-new { min-height: calc(100dvh - 60px - env(safe-area-inset-top)); }
  .topbar .icon-button, .detail-back, .detail-menu > summary { min-width: var(--touch-target); min-height: var(--touch-target); }
  .detail-back { justify-content: center; }
  .back-link, .profile-link { min-height: var(--touch-target); }
  .detail-toolbar-actions .button { min-height: var(--touch-target); font-size: 13px; }
  .detail-menu > div > a, .detail-menu > div > button { min-height: var(--touch-target); display: flex; align-items: center; white-space: normal; font-size: 13px; }
  .page-heading .compact, .button, .expiry-widget .button { min-height: var(--touch-target); }
  .page-heading .compact { font-size: 12px; }
  .expiry-widget .button { font-size: 12px; }
  .filter-tabs button, .attendance-tabs button { min-height: var(--touch-target); font-size: 12px; line-height: 1.5; }
  .filter-tabs button { white-space: normal; }
  input:not([type='checkbox']):not([type='radio']), select, textarea,
  .report-filters input, .report-filters select,
  .lesson-create-card input:not([type='checkbox']), .lesson-create-card select,
  .student-note-field textarea { font-size: 16px; }
  input, select, textarea { scroll-margin-top: 84px; scroll-margin-bottom: 170px; }
  input::placeholder, textarea::placeholder,
  .search-box input::placeholder { font-size: 13px; }
  .field { font-size: 13px; }
  .lesson-create-card .field, .report-filters .field { font-size: 13px; }
  .week-heading h2 { text-transform: none; }
  .week-actions .icon-button { width: var(--touch-target); height: var(--touch-target); }
  .week-today { min-height: var(--touch-target); padding-inline: 10px; font-size: 12px; }
  .day { font-size: 11px; }
  .day small { font-size: 10px; }
  .lesson-row small, .timeline-row .grow > small, .timeline-time small { font-size: 11px; }
  .expiry-line { height: auto; min-height: 22px; font-size: 12px; line-height: 1.7; }
  .expiry-line > span { font-size: 11px; }
  .student-table tr { grid-template-columns: minmax(0, 1fr) auto; }
  .table-person { min-height: var(--touch-target); }
  .table-person strong { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
  .student-code, .student-balance, .student-package-status .badge { font-size: 11px; }
  .attendance-comment, .attendance-status-toggle { width: var(--touch-target); min-height: var(--touch-target); }
  .attendance-entry-heading { min-height: var(--touch-target); }
  .attendance-person-name h3 { font-size: 14px; }
  .attendance-entry .status-option > span { min-height: var(--touch-target); font-size: 12px; }
  .attendance-bulk-help { font-size: 11px; }
  .attendance-extra, .attendance-entry.status-open .attendance-extra { font-size: 11px; flex-wrap: wrap; }
  .attendance-extra .text-link { min-height: var(--touch-target); font-size: 12px; }
  .attendance-save-bar { min-height: 68px; }
  .attendance-save-bar .button { min-height: var(--touch-target); font-size: 13px; }
  .attendance-save-bar > span { font-size: 11px; }
  .attendance-session-note > summary { min-height: var(--touch-target); font-size: 12px; }
  .page-attendance { padding-bottom: calc(182px + env(safe-area-inset-bottom)); }
  .attendance-tabs button:focus-visible, .filter-tabs button:focus-visible { outline: var(--focus-ring); outline-offset: -3px; }
  .status-option:has(input:focus-visible) > span { outline: var(--focus-ring); outline-offset: 2px; }
  .package-toggle { min-height: var(--touch-target); }
  .profile-package .package-edit { min-height: var(--touch-target); font-size: 11px; }
  .identity-meta > span:first-child, .profile-contact { font-size: 12px; }
  .profile-facts > div, .profile-history .history-row strong { font-size: 12px; }
  .profile-history .history-row small { font-size: 11px; }
  .profile-notes > summary { min-height: var(--touch-target); font-size: 13px; }
  .profile-contact > summary { min-height: var(--touch-target); }
  .repeat-checkbox, .roster-disclosure { min-height: var(--touch-target); }
  .roster-search-row .button { min-height: var(--touch-target); font-size: 11px; }
  .lesson-create-card .checkbox-person { min-height: 52px; }
  .roster-count, .roster-remaining, .lesson-create-card .field-help { font-size: 11px; }
  .settings-grid select { min-height: 48px; }
  .system-theme { min-height: var(--touch-target); font-size: 12px; }
  .theme-option > span:last-child { font-size: 14px; }
  .report-filters .apply-report { min-height: var(--touch-target); font-size: 13px; }
  .report-stats .stat-card > span { display: block; min-height: 33px; font-size: 11px; line-height: 1.5; }
  .table-frame:has(.report-table) { display: none; }
  .report-mobile-list { display: grid; gap: 12px; }
  .report-mobile-card { padding: 12px; }
  .report-card-top { display: flex; align-items: center; gap: 12px; }
  .report-card-person { display: flex; align-items: center; gap: 8px; min-height: var(--touch-target); min-width: 0; flex: 1; }
  .report-card-person strong { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
  .report-card-person > .icon { width: 14px; height: 14px; margin-left: auto; color: var(--muted); }
  .report-card-rate { color: var(--primary); font-size: 18px; font-weight: 600; text-align: right; }
  .report-card-rate small { font-size: 10px; line-height: 1.5; font-weight: 400; }
  .report-card-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); text-align: center; }
  .report-card-counts dt { min-height: 33px; color: var(--muted); font-size: 11px; line-height: 1.5; }
  .report-card-counts dd { margin: 0; font-size: 20px; line-height: 1.6; font-weight: 600; text-align: center; }
  .report-card-total { margin-top: 6px; color: var(--muted); font-size: 11px; text-align: right; }
  .report-caption, .report-footnote { font-size: 11px; }
  .report-expiry-row { min-height: 48px; flex-wrap: wrap; font-size: 12px; }
  .report-expiry-row .badge, .report-expiry-row .subtle { font-size: 11px; }
  .report-expiry-row > .grow { flex-basis: 45%; overflow-wrap: anywhere; }
}
@media (max-width: 360px) {
  .page-heading .compact { padding-inline: 8px; font-size: 11px; }
  .week-heading h2 { font-size: 13px; }
  .week-actions { gap: 3px; }
  .week-today { padding-inline: 7px; font-size: 11px; }
  .attendance-tabs button { font-size: 11px; }
  .attendance-person-name h3 { font-size: 13px; }
  .attendance-save-bar .button { padding-inline: 10px; font-size: 12px; }
  .attendance-save-bar > span { font-size: 10px; }
  .table-person strong { font-size: 12px; }
}
@media print {
  .report-mobile-list { display: none !important; }
  .table-frame:has(.report-table) { display: block !important; }
}
