/* ==========================================================================
   <= 900px  tablets in portrait and everything smaller
   ========================================================================== */
@media (max-width: 900px) {

  /* ----- website header: brand + menu button, links drop down below ----- */
  header {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    padding: 10px 20px;
  }
  header .petsmart {
    order: 1;
    min-width: 0;
  }
  header .nav-toggle {
    display: inline-flex;
    order: 2;
  }
  header nav {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    flex-direction: column;
    padding: 8px 0 4px;
  }
  header.has-toggle nav {
    display: none;
  }
  header.has-toggle.nav-open nav {
    display: flex;
  }
  header nav ul {
    flex-direction: column;
    width: 100%;
  }
  header nav ul li {
    width: 100%;
  }
  header nav a {
    display: block;
    padding: 12px 16px;
  }
  /* "Services" sub-links: shown open, indented, instead of a hover pop-up */
  header nav .menu {
    display: block;
    position: static;
    min-width: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 0 0 0 14px;
  }
  header nav .menu a {
    padding: 10px 16px;
  }

  /* ----- landing + homepage ----- */
  #home {
    position: relative;   /* so the soft white wash covers this whole section */
  }
  .home-container {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .texth {
    padding: 28px 28px 0;
    margin-bottom: 0;
  }
  .imgh {
    justify-content: center;
    padding: 0 28px 28px;
  }
  .imgh img {
    padding-top: 0;
  }
  .contact {
    flex: 1 1 100%;
    min-width: 0;
  }

  /* ----- admin: sidebar becomes a slide-in drawer ----- */
  .dashboard-wrapper {
    display: block;
    min-height: 100vh;
  }
  .dashboard-wrapper > .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: auto;
    width: min(280px, 86vw);
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-y: auto;
    z-index: 1200;
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
    box-shadow: none;
  }
  .dashboard-wrapper > .sidebar .side-nav {
    flex-direction: column;
    flex-wrap: nowrap;
  }
  body.sidebar-open .dashboard-wrapper > .sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.25s ease, visibility 0s;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 26, 29, 0.55);
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.sidebar-open {
    overflow: hidden;
  }
  .admin-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 16px;
    background: var(--navy, #1c2b30);
  }
  .admin-topbar .sidebar-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1.5px solid var(--teal, #6FC2BB);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .admin-topbar .sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--teal, #6FC2BB);
  }
  .admin-topbar .brand {
    margin: 0;
    /* .admin-topbar is a row flex container, and js/responsive.js clones
       the sidebar's .brand (logo + name + the alert bell) straight into
       it. On the desktop sidebar, .brand lives in a COLUMN flex
       container, so it stretches to the sidebar's full width by default
       and the bell's `margin-left: auto` has room to push it to the
       right edge. In a ROW container a flex item only takes its own
       content width, so with nothing added here .brand sat exactly as
       wide as "PetSmart" + logo, leaving no space for the auto-margin to
       push into -- the bell landed right next to the text instead of at
       the screen edge. flex: 1 lets .brand claim the rest of the
       topbar's width so the bell can actually reach the right side;
       min-width: 0 lets it shrink instead of forcing the topbar wider
       than the screen. */
    flex: 1;
    min-width: 0;
  }
  .main-content {
    padding: 20px 20px 28px;
  }

  /* dashboard + reports grids */
  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .charts-row,
  .bottom-row {
    grid-template-columns: minmax(0, 1fr);
  }
}
