/* Shared small-screen layout. Keep actions readable instead of hiding labels. */
@media (max-width: 700px) {
  body .page-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }
  body .page-heading > div { min-width: 0; }
  body .page-heading h1 { overflow-wrap: anywhere; line-height: 1.2; }
  body .page-heading > .button-row {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
    gap: 10px;
  }
  body .page-heading > .button,
  body .page-heading > .button-row .button {
    flex: 1 1 auto;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 44px;
    margin-top: 0;
    padding: 11px 14px;
    font-size: 13px;
    line-height: 1.4;
    white-space: normal;
    text-align: center;
  }
  body .page-heading > .button { align-self: flex-start; }
  body .page-heading .button-row .button .icon { width: 17px; height: 17px; flex-shrink: 0; }
  body .main-content .button { min-height: 44px; white-space: normal; }
  body .builder-ux .page-heading > .button-row .button { flex: 1 1 150px; }
  body .main-content .button-row { gap: 10px; }
  body .main-content .panel-heading,
  body .main-content .section-title { flex-wrap: wrap; gap: 12px; }
  body .main-content .panel-heading > *,
  body .main-content .section-title > *,
  body .form-grid > *,
  body .settings-grid > * { min-width: 0; }
  body .field input,
  body .field select,
  body .field textarea,
  body .search-input input {
    min-width: 0;
    max-width: 100%;
    font-size: 16px; /* Avoid automatic zoom when focusing inputs on iOS. */
  }
  body .field input:not([type=checkbox]):not([type=radio]),
  body .field select { min-height: 44px; }
  body .search-input { min-height: 44px; height: auto; }
  body .search-input input { width: 100%; min-height: 42px; }
  body .segmented button,
  body .admin-tabs .button,
  body .builder-tabs button { min-height: 44px; font-size: 12px; }
  body .builder-ux .builder-tabs { flex-wrap: wrap; }
  body .builder-ux .builder-tabs button { flex: 1 1 100px; }
  body .pagination { flex-wrap: wrap; gap: 10px; }
  body .main-content .filter-submit .button { width: 100%; }
  body .main-content .filter-submit > a { display: inline-flex; align-items: center; min-height: 44px; }
  body .topbar { height: auto; min-height: 64px; padding: 10px 16px; }
  body .topbar .breadcrumb { min-width: 0; }
  body .topbar .breadcrumb strong { overflow-wrap: anywhere; }
  body .topbar .icon-button { min-width: 40px; min-height: 44px; }
  body .topbar .top-actions { gap: 5px; }
  body .topbar .avatar { flex-shrink: 0; }
  body .theme-switch select { min-height: 44px; }
  body dialog { max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; }
}

@media (max-width: 700px) {
  body .app-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
  }
  body .app-footer > span:first-child { order: 2; font-size: 11px; }
  body .app-footer > span:nth-child(2) { order: 0; }
  body .app-footer .legal-footer-links {
    order: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 440px;
    gap: 4px 16px;
    padding-block: 12px;
    border-block: 1px solid var(--line);
    font-size: 13px;
  }
  body .app-footer .legal-footer-links a,
  body .app-footer .legal-footer-links button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    text-align: center;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }
  body .app-footer .legal-footer-links > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

@media (max-width: 480px) {
  body .topbar .breadcrumb strong { display: none; }
  body .page-heading > .button-row > form { flex: 1 1 auto; }
  body .page-heading > .button-row > form .button { width: 100%; }
}
