/* Galaxy Tab backend overrides.
   Loaded after backend-theme.css and inline theme to protect the 800px tablet layout. */

@media (hover: none) and (pointer: coarse) and (min-width: 700px) and (max-width: 900px) {
  html {
    scroll-padding-top: 118px;
  }

  body {
    overflow-x: hidden;
  }

  .shell {
    width: min(100% - 18px, 100%);
    padding-top: 10px;
  }

  .topbar {
    position: sticky;
    top: 8px;
    z-index: 1200;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "brand actions"
      "title title";
    align-items: center !important;
    justify-items: stretch !important;
    gap: 8px 12px;
    min-height: 78px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 16px;
    overflow: visible;
  }

  .topbar-branding {
    grid-area: brand;
    min-width: 0;
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 10px;
    text-align: left !important;
  }

  .topbar-logo {
    flex: 0 1 auto;
    min-width: 0;
  }

  .topbar-logo img {
    max-height: 48px !important;
    max-width: min(44vw, 300px) !important;
    width: auto;
  }

  .topbar-copy {
    display: inline-block !important;
    min-width: 0;
    max-width: 160px;
    font-size: 0.82rem;
    line-height: 1.15;
    white-space: normal;
  }

  .topbar-title {
    grid-area: title;
    display: block !important;
    justify-self: start !important;
    text-align: left !important;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    opacity: 0.72;
  }

  .topbar-actions {
    grid-area: actions;
    width: auto !important;
    min-width: 0;
    justify-self: end !important;
    justify-content: flex-end !important;
    display: flex !important;
  }

  .topbar-actions form {
    display: inline-flex !important;
    width: auto;
  }

  .topbar-actions .btn,
  .topbar-actions .btn-small {
    width: auto;
    min-width: 92px;
    max-width: 176px;
    min-height: 42px;
    padding: 8px 10px;
    font-size: 0.78rem;
    line-height: 1.12;
    white-space: normal;
  }

  .backend-subnav-panel {
    margin-top: 10px;
    margin-bottom: 16px;
    padding: 10px;
    overflow: visible;
  }

  .backend-subnav-actions {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
    padding: 0 !important;
    overflow: visible;
    white-space: normal;
  }

  .backend-subnav-actions .btn,
  .backend-subnav-actions .btn-small {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px;
    padding: 8px 7px;
    font-size: 0.78rem;
    line-height: 1.14;
    white-space: normal;
  }

  .backend-superuser-badge {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    font-size: 0.76rem;
  }

  .panel,
  .plain-panel {
    padding: 16px 12px;
    border-radius: 16px;
  }

  .actions,
  .button-row {
    gap: 8px;
  }

  .actions .btn,
  .button-row .btn,
  .table-actions .btn {
    min-height: 42px;
    white-space: normal;
    line-height: 1.16;
  }
}

@media (hover: none) and (pointer: coarse) and (min-width: 700px) and (max-width: 760px) {
  .backend-subnav-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-copy {
    display: none !important;
  }

  .topbar-actions .btn,
  .topbar-actions .btn-small {
    max-width: 138px;
  }
}
