.app-brand img {
  display: block;
  width: 390px !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain !important;
}

/* Keep the account action readable when the desktop header is viewed on a
   phone in landscape orientation or on a narrow tablet. */
.app-nav a {
  white-space: nowrap;
}

.app-nav .logout-btn {
  flex: 0 0 auto;
  min-width: 78px;
  text-align: center;
  white-space: nowrap;
}

@media (min-width: 761px) and (max-width: 1050px) {
  .app-header__inner {
    width: calc(100% - 28px) !important;
    gap: 14px !important;
  }

  .app-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .app-brand img {
    width: min(360px, 40vw) !important;
  }

  .app-nav {
    flex: 0 0 auto;
    gap: 2px !important;
  }

  .app-nav a {
    padding: 10px 8px !important;
    font-size: 13px !important;
  }

  .app-nav .logout-btn {
    min-width: 76px;
    margin-left: 3px;
    padding-right: 10px !important;
    padding-left: 10px !important;
  }
}

@media (max-width: 760px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    padding-bottom: 0 !important;
  }

  .app-header__inner {
    width: 100% !important;
    min-height: 0 !important;
    padding: 16px 14px 14px;
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    gap: 14px !important;
  }

  .app-brand {
    width: 100%;
    display: flex !important;
    justify-content: center;
    overflow: hidden;
  }

  .app-brand img {
    width: min(100%, 330px) !important;
    max-width: 330px !important;
  }

  .app-nav {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    min-height: 58px !important;
    margin: 0 !important;
    padding: 6px !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px !important;
    background: rgba(255,255,255,.96) !important;
    border: 1px solid rgba(90,70,56,.18) !important;
    border-radius: 15px !important;
    box-shadow: 0 14px 36px rgba(35,23,15,.18) !important;
  }

  .app-nav a {
    min-width: 0;
    padding: 11px 2px !important;
    color: #2c2926 !important;
    font-size: 12px !important;
    text-align: center;
    white-space: nowrap;
  }

  .app-nav .logout-btn {
    display: none !important;
  }

  .app-titlebar {
    display: none;
  }

  .app-footer {
    padding: 26px 16px 24px !important;
  }
}

/* Shared private-page heading and action layout. Page-specific button classes
   keep their colors; these utilities only standardize placement and sizing. */
.app-page-heading {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 20px !important;
  margin-bottom: 20px !important;
}

.app-page-heading > :first-child {
  flex: 1 1 320px;
  min-width: 0;
}

.app-page-actions {
  display: flex !important;
  flex: 0 0 auto;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  margin: 0 !important;
  flex-wrap: nowrap !important;
}

.app-page-actions > form {
  display: flex;
  margin: 0 !important;
}

.app-page-actions > a,
.app-page-actions > button,
.app-page-actions > form > select,
.app-page-actions > form > button {
  width: auto !important;
  min-width: 0;
  min-height: 42px !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

@media (min-width: 621px) and (max-width: 1050px) {
  .app-page-heading {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  .app-page-actions {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
  }
}

@media (max-width: 620px) {
  .app-page-heading {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  .app-page-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .app-page-actions > form,
  .app-page-actions > a,
  .app-page-actions > button,
  .app-page-actions > form > select,
  .app-page-actions > form > button {
    width: 100% !important;
  }

  .app-page-actions > a,
  .app-page-actions > button {
    padding-right: 10px !important;
    padding-left: 10px !important;
    text-align: center;
  }

  .app-page-actions > :only-child,
  .app-page-actions > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

}
