/* Touch-friendly controls and contained scrolling on phones and tablets. */
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; }
  main { padding: 20px 12px; }
  button, input, select { min-height: 44px; }
  input:not([type="checkbox"]):not([type="color"]), select, textarea,
  .filters input, .filters select, .sequence-content textarea,
  .day-date input, .event-time input { font-size: 16px; }
  input[type="checkbox"] { min-height: 22px; width: 22px; height: 22px; flex-shrink: 0; }
  .checkbox { min-height: 44px; line-height: 1.5; }
  .sidebar { padding: 14px 12px 8px; }
  nav { scrollbar-width: thin; scroll-snap-type: x proximity; }
  nav button { flex-shrink: 0; scroll-snap-align: start; font-size: 12px; }
  .topbar { height: auto; min-height: 56px; padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
  .topbar-right { gap: 12px; margin-left: auto; }
  .slash { margin: 0 6px; }
  .page-head { flex-wrap: wrap; gap: 12px; }
  .page-head > div { min-width: 0; }
  .page-head .primary { font-size: 13px; }
  .notice { flex-wrap: wrap; font-size: 12px; }
  .notice button { margin-left: 0; }
  .form-panel, .channel-card, .rank .panel { padding: 18px; }
  .card-grid, .rank, .two-cols, .stats { min-width: 0; }
  .card-grid > *, .rank > *, .two-cols > *, fieldset { min-width: 0; }
  .filters { flex-wrap: wrap; }
  .filters input, .filters select { flex: 1 1 130px; max-width: none; }
  .table-wrap { max-width: 100%; }
  .calendar-key { flex-wrap: wrap; gap: 12px; }
  .month-controls { flex-wrap: wrap; gap: 5px; }
  .month-controls button { min-width: 44px; }
  .kanban { grid-template-columns: repeat(5, minmax(240px, 80vw)); scroll-snap-type: x proximity; }
  .kanban-column { scroll-snap-align: start; }
  .row-actions button, .kanban-card button { min-height: 44px; padding: 10px; font-size: 12px; }
  .group-list code, .history-item, .delivery, .report-row { overflow-wrap: anywhere; }
  .report-row { gap: 16px; }
  dialog { width: calc(100% - 16px); max-width: none; max-height: calc(100dvh - 16px); }
  .dialog-head { padding: 14px; gap: 10px; }
  .dialog-head h2 { font-size: 20px; }
  .dialog-head .icon-button { min-width: 44px; flex-shrink: 0; }
  .dialog-actions { position: sticky; bottom: 0; padding: 12px 14px max(12px, env(safe-area-inset-bottom)); flex-wrap: wrap; z-index: 1; }
  .dialog-actions button { flex: 1; }
  #history-body { padding: 16px; }
  #toast { right: 12px; left: 12px; bottom: max(16px, env(safe-area-inset-bottom)); max-width: none; overflow-wrap: anywhere; }
  .day-date { width: 100%; gap: 4px; }
  .day-date > button { min-width: 44px; padding: 8px; }
  .day-date label { flex: 1; min-width: 135px; }
  .day-date input { width: 100%; }
  .day-numbers { flex-wrap: wrap; gap: 10px; }
  .day-toolbar > button { width: 100%; }
  .section-heading { flex-wrap: wrap; }
  .section-heading > div { flex: 1; min-width: 130px; }
  .section-heading > button { font-size: 12px; }
  .library-actions, .sequence-footer { flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
  .text-button { font-size: 12px; }
  .day-asset small, .day-hint, .section-heading p, .day-summary > small { font-size: 12px; }
  .day-asset > div > button { min-width: 44px; }
  .sequence-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; }
  .sequence-order { grid-column: 1; grid-row: 1 / 3; width: 44px; }
  .sequence-order button { width: 44px; }
  .sequence-thumb, .sequence-text-icon { grid-column: 2; grid-row: 1; }
  .sequence-content { grid-column: 2 / 4; grid-row: 2; }
  .sequence-content strong { max-width: 100%; white-space: normal; overflow-wrap: anywhere; font-size: 13px; }
  .sequence-row > .icon-button { grid-column: 3; grid-row: 1; }
  .sequence-content textarea { min-height: 88px; }
  .round-time { padding: 8px; gap: 0; }
  .round-time > button { min-width: 32px; }
  .round-time input { padding: 8px 2px; }
  .saved-round-heading { flex-wrap: wrap; gap: 12px; }
  .saved-round-heading label { flex-direction: row; flex-wrap: wrap; font-size: 12px; }
  .day-event { display: grid; grid-template-columns: 110px minmax(0, 1fr); }
  .event-time { width: 110px; grid-column: 1; }
  .event-thumb { grid-column: 2; }
  .event-content { grid-column: 1 / -1; min-width: 0; }
  .event-content p { font-size: 14px; max-height: none; }
  .event-content > strong { font-size: 14px; }
  .event-status { grid-column: 1 / -1; flex-wrap: wrap; gap: 8px; }
  .event-status .row-actions { justify-content: flex-start; }
  .day-change-bar { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .day-change-bar > div { flex-wrap: wrap; }
  .day-change-bar button { flex: 1; font-size: 12px; }
}
@media (max-width: 360px) {
  .day-assets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .round-times { grid-template-columns: 1fr; }
}
