@layer aios.utilities {
  .subject-card-actions .secondary {
    padding-inline: 4px;
  }

  @media (max-width: 768px) {
    .air-page :where(button, input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
      min-height: 44px;
    }

    .air-page .air-icon-button {
      width: 44px;
      min-width: 44px;
    }

    .direction-classes-v2 :where(button, summary, input, select) {
      min-width: 44px;
      min-height: 44px;
    }

    .direction-classes-v2 .dc-detail-tabs button {
      flex: 0 0 auto;
      width: auto;
    }

    .aios-analytics2 button,
    .aios-analytics2 select {
      min-height: 44px;
    }

    .teacher-resource-layout button,
    .teacher-resource-more {
      width: 44px;
      min-width: 44px;
      height: 44px;
      min-height: 44px;
    }

    .teacher-resource-quick button {
      flex: 0 0 auto;
      width: auto;
      min-width: 44px;
      min-height: 44px;
    }
  }

  @media (max-width: 375px) {
    .teacher-resources-header > div:last-child {
      grid-template-columns: 1fr;
    }
  }

}

/* Shared phone ergonomics, scoped to the authenticated workspace. */
@layer legacy {
  @media (max-width: 820px) {
    #app .app-shell:not(.chat-shell) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]), select, textarea),
    #app #modal-root :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]), select, textarea) {
      font-size: 16px !important;
      min-height: 44px !important;
      font-weight: 400 !important;
      max-width: 100%;
    }
    .app-shell :is(.form-grid, .field, .form-field, .section-title > div) { min-width: 0; }
    .app-shell :is(.toolbar, .filter-bar, .page-actions) { flex-wrap: wrap; gap: 8px; }
    .app-shell :is(.toolbar, .filter-bar, .page-actions) > * { min-width: 0; max-width: 100%; }
    .app-shell .table-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
    .app-shell :is(input, select, textarea, button, summary):focus-visible { scroll-margin-block: 72px; }
    .app-shell:not(.chat-shell) > .main > .content { padding-bottom: max(24px, env(safe-area-inset-bottom)) !important; }
  }
}

/* Teacher Create: outlined AI glyph and a single centered icon/label row. */
@layer legacy {
  #app .teacher-create-ai-workbench .tls-ai-assist > summary > svg {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: inherit !important;
  }
  #app .teacher-learning-studio button[data-tls-action="new-chapter"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    line-height: 1.4;
  }
  #app .teacher-learning-studio button[data-tls-action="new-chapter"] > svg {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin: 0;
  }
}
