/* Mobile layout: readable controls and bounded content at narrow widths. */
@media (min-width: 761px) and (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { min-width: 0; }
  .filters { flex-wrap: wrap; }
  .filters select, .list-head select { min-width: 0; max-width: 100%; }
  .row { grid-template-columns: 36px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) 110px; }
  .row > div { min-width: 0; overflow-wrap: anywhere; }
}
@media (max-width: 760px) {
  main, aside, .login-shell, .login-card { min-width: 0; }
  main { padding: 24px 16px; }
  aside { padding: 20px 16px; }
  nav { gap: 8px; }
  nav button { flex: 1; min-width: 0; min-height: 44px; padding: 10px 8px; font-size: 14px; }
  .aside-bottom { gap: 4px 8px; }
  .aside-bottom #sync-state, .aside-bottom #account-email { font-size: 12px; }
  .aside-bottom button, .aside-bottom .restore { min-height: 44px; display: inline-flex; align-items: center; padding: 8px; font-size: 12px; }
  #account-email { max-width: 100%; overflow-wrap: anywhere; }
  header { gap: 12px; flex-wrap: wrap; }
  header .eyebrow { font-size: 10px; line-height: 1.5; }
  #today { font-size: 12px; }
  .heading { margin: 28px 0; gap: 20px; }
  .heading p, .info, .list-head p, .service-card p { font-size: 14px; }
  button, select, input, textarea { min-height: 44px; }
  input:not([type='hidden']), select, textarea, label input, label select, label textarea { min-width: 0; max-width: 100%; font-size: 16px; }
  label { font-size: 14px; line-height: 1.5; }
  label span { font-size: 13px; }
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .month-picker { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; width: 100%; }
  .month-picker input { width: 100%; padding: 10px 4px; font-size: 16px; }
  .month-picker button { width: 44px; height: 44px; padding: 0; }
  .toolbar > button { width: 100%; max-width: none; font-size: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { min-width: 0; padding: 16px 12px; }
  .stat label { font-size: 14px; }
  .stat strong { font-size: clamp(16px, 5vw, 24px); letter-spacing: -.6px; overflow-wrap: anywhere; }
  .stat small { font-size: 12px; line-height: 1.5; }
  .list-head { align-items: stretch; flex-direction: column; gap: 16px; }
  .list-head select, .filters select { width: 100%; max-width: none; }
  .filters { flex-direction: column; align-items: stretch; gap: 12px; }
  #statuses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  #statuses button { min-width: 0; padding: 10px 4px; font-size: 14px; }
  .row { grid-template-columns: 32px minmax(0, 1fr) minmax(0, 110px); padding: 16px 12px; gap: 10px; }
  .row > div { min-width: 0; overflow-wrap: anywhere; }
  .row strong { font-size: 15px; line-height: 1.45; }
  .row small { font-size: 12px; line-height: 1.5; }
  .row .date-col strong { font-size: 14px; }
  .row .money strong { font-size: 14px; }
  .row button { font-size: 14px; padding: 8px 4px; }
  .status { font-size: 12px; }
  .service-card { min-width: 0; }
  .service-card > div { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .service-card button { min-height: 44px; font-size: 14px; }
  dialog { width: calc(100vw - 24px); max-width: 520px; max-height: calc(100dvh - 24px); padding: 20px; overflow-y: auto; overscroll-behavior: contain; }
  dialog form { min-width: 0; }
  .dialog-title { position: sticky; top: -20px; z-index: 2; margin-top: -8px; padding: 8px 0; background: white; }
  .dialog-title h2 { font-size: 20px; }
  .dialog-title button { width: 44px; height: 44px; flex-shrink: 0; }
  dialog form > p { font-size: 14px; }
  .dialog-actions { position: sticky; bottom: -20px; z-index: 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; background: white; padding: 14px 0 max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
  .dialog-actions button { min-width: 0; font-size: 14px; line-height: 1.4; }
  .hint, .field-help, #service-feedback, #upload-status, .footnote, .email-reminder-status { font-size: 13px !important; line-height: 1.6; overflow-wrap: anywhere; }
  .photo-section h3 { font-size: 16px; }
  .photo-section h3 span { font-size: 13px; }
  .photo-file { width: 100%; font-size: 14px !important; padding: 8px; }
  .photo-file::file-selector-button { min-height: 44px; padding: 10px; font-size: 14px; }
  .upload-button { min-height: 48px; font-size: 16px; }
  .photo-grid, #photo-list { gap: 12px; }
  .photo-grid span, #photo-list span { font-size: 12px; }
  .reminder-help, .reminder-help p { font-size: 14px; }
  .reminder-help summary { min-height: 44px; padding: 10px 0; line-height: 1.5; }
  footer { font-size: 12px; line-height: 1.6; }
  #toast { left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: auto; transform: none; padding: 14px 16px; font-size: 14px; overflow-wrap: anywhere; }
  .login-card { width: 100%; padding: 36px 24px; }
  .login-card .brand { margin-bottom: 36px; }
  .login-card > p, .login-card #login-message { font-size: 16px; }
  .login-card small, .login-card #login-code-form p { font-size: 13px; line-height: 1.6; }
  .login-card button { min-height: 48px; font-size: 16px; }
}
@media (max-width: 480px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  label input[type='date'] { width: 100%; appearance: none; -webkit-appearance: none; }
  .form-grid label { min-width: 0; }
  .form-grid select { width: 100%; }
}
@media (max-width: 350px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat strong { font-size: 26px; }
  .row { grid-template-columns: 28px minmax(0, 1fr) minmax(0, 100px); gap: 8px; }
}
