/* Admin-only phone layout. Desktop styles are unchanged. */
@media (max-width: 767px) {
  #content, #content-main { min-width: 0; max-width: 100%; }

  /* Long shortcut rows should wrap inside the phone viewport. */
  .catalog-heading > div:last-child { flex-wrap: wrap !important; min-width: 0; max-width: 100%; }
  .catalog-heading .catalog-create { min-height: 40px; }

  /* Unfold's compact mobile row height clips custom multi-row actions. */
  #content-main #result_list td.field-actions,
  #content-main #result_list td.field-row_actions,
  #content-main #result_list td.field-theme_preview,
  #content-main #result_list td.field-timeline_preview {
    height: auto !important;
    min-height: 58px;
    overflow: visible !important;
    align-items: flex-start;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  #content-main #result_list td.field-actions::before,
  #content-main #result_list td.field-row_actions::before {
    align-self: flex-start;
    padding-top: 8px;
  }
  #content-main #result_list td.field-actions > *,
  #content-main #result_list td.field-row_actions > * { min-width: 0; max-width: 100%; }

  /* The 16:9 theme preview needs its full height on a mobile record card. */
  #content-main #result_list td.field-theme_preview,
  #content-main #result_list td.field-timeline_preview { flex-direction: column; align-items: flex-start; gap:8px; }
  #content-main #result_list td.field-theme_preview > a,
  #content-main #result_list td.field-theme_preview > a > span { max-width: 100%; }

  .tournament-action { min-height: 40px; }
  .device-row-actions { flex-wrap: wrap; justify-content: flex-end; white-space: normal; }
  .device-row-actions button, .device-row-actions a { min-height: 40px; }

  /* Compact tournament selectors and terminal OTA details belong on the value side. */
  #content-main #result_list td.field-theme > div,
  #content-main #result_list td.field-devices_display > div {
    margin-left: auto;
    margin-right: 0;
  }
  #content-main #result_list td.field-ota_progress .device-ota-progress {
    align-items: flex-end;
    text-align: right;
  }

  /* Bulk delete stays in a fixed action bar so selecting rows never moves the list. */
  #content-main [data-delete-selected] {
    position: fixed;
    z-index: 50;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 16px;
    width: calc(100% - 32px);
    min-height: 48px;
    justify-content: center;
    box-shadow: 0 8px 24px #7f1d1d38;
  }
  #content-main:has(#result_list) { padding-bottom: 72px; }

  /* Move the real select-all checkbox beside search instead of spending a table row on it. */
  #content-main.mobile-list-selection-ready #result_list thead { display: none; }
  #content-main #toolbar.mobile-list-toolbar { display: flex; align-items: center; gap: 8px; min-width: 0; }
  #content-main .invite-toolbar.mobile-list-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
  #content-main #toolbar.mobile-list-toolbar #changelist-search { flex: 1 1 auto; min-width: 0; }
  #content-main .invite-toolbar.mobile-list-toolbar .invite-search,
  #content-main .invite-toolbar.mobile-list-toolbar .member-filters { flex: 1 1 auto; min-width: 0; }
  #content-main .mobile-select-slot { flex: none; }
  #content-main .mobile-select-slot label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--club-line, #d1d5db);
    border-radius: 9px;
    background: #fff;
    color: var(--club-ink, #334155);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
  }
  #content-main .mobile-select-slot label:has(input:checked) {
    border-color: #206b52;
    background: #eaf4ee;
    color: #176849;
  }
  .dark #content-main .mobile-select-slot label { background: #1f2937; color: #e2e8f0; }

  /* Prevent iOS Safari from zooming the whole form when a field gets focus. */
  #content-main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  #content-main select, #content-main textarea { font-size: 16px; }
}
