/* =========================
   Mobile Dashboard Layout
   ========================= */
@media (max-width: 768px) {
  /* =========================
     Header / Hero Area
     ========================= */
  #information-widgets {
    margin: 0.625rem;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
  }

  #widgets-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .information-widget-greeting {
    width: 100%;
  }

  .information-widget-greeting span {
    margin-right: 0;
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
  }

  #information-widgets-right {
    display: flex;
    width: 100%;
    margin: 0;
    border-radius: 0.25rem;
    background: linear-gradient(90deg, rgb(15 23 42 / 0.22), rgb(15 23 42 / 0.08));
    backdrop-filter: blur(0.5rem);
  }

  #information-widgets-right .widget-container {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 0.625rem;
  }

  .information-widget-datetime > div {
    justify-content: flex-start;
  }

  .information-widget-datetime span {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .information-widget-datetime .hero-time {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.05;
  }

  .information-widget-datetime .hero-date {
    margin-top: 0.1875rem;
    color: rgb(226 232 240 / 0.82);
    font-size: 0.75rem;
    line-height: 1.2;
  }

  #services,
  #bookmarks {
    margin: 0.625rem;
    margin-top: 0.375rem;
  }

  .services-group,
  .bookmark-group {
    padding: 0.25rem;
  }

  .services-group h2,
  .bookmark-group h2 {
    font-size: 1.125rem;
    line-height: 1.25;
  }

  .services-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 7rem;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }

  .service-card {
    height: 100%;
    min-height: 6.5rem;
    margin-bottom: 0;
  }

  .service-title {
    height: 100%;
    min-height: 0;
    flex-direction: column;
    justify-content: center;
  }

  .service-icon {
    width: 100%;
    height: 3.5rem;
    padding-top: 0.25rem;
  }

  .service-icon img,
  .service-icon svg {
    width: 3rem !important;
    height: 3rem !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .service-title-text {
    width: 100%;
    flex: 0 0 auto;
    justify-content: center;
  }

  .service-name {
    padding: 0.125rem 0.5rem 0.625rem;
    font-size: 0.9375rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
    text-align: center;
  }

  .service-description {
    display: none;
  }

  /* Centre an unpaired final service without turning it into an oversized card. */
  .services-list > .service:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    width: calc((100% - 0.5rem) / 2);
    justify-self: center;
  }

  /* The single Admin bookmark remains a full-width, easy-to-tap tile. */
  #bookmarks .bookmark-list {
    margin-top: 0.5rem;
  }

  #bookmarks .bookmark a {
    min-height: 5.5rem;
    margin-bottom: 0;
  }

  #bookmarks .bookmark-icon {
    width: 3.5rem;
    font-size: 0.9375rem;
  }

  #bookmarks .bookmark-name {
    font-size: 0.875rem;
    overflow-wrap: anywhere;
  }

  #bookmarks .bookmark-description {
    display: none;
  }

  /* Present the Admin bookmark as compact utility navigation, not a service tile. */
  #bookmarks .bookmark-list {
    display: block;
  }

  #bookmarks .bookmark {
    width: 100%;
  }

  #bookmarks .bookmark a {
    display: block;
    min-height: 3.5rem;
    margin-bottom: 0;
    border-radius: 0.375rem;
    background-color: rgb(15 23 42 / 0.22);
    box-shadow: none;
  }

  #bookmarks .bookmark a > div {
    width: 100%;
    min-height: 3.5rem;
    flex-direction: row;
    align-items: center;
  }

  #bookmarks .bookmark-icon {
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    margin-left: 0.625rem;
    border-radius: 0.375rem;
    background-color: rgb(30 41 59 / 0.35);
    font-size: 0.75rem;
  }

  #bookmarks .bookmark-text {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    overflow: visible;
  }

  #bookmarks .bookmark-name {
    padding: 0 0.625rem;
    font-size: 0.875rem;
    line-height: 1.2;
    text-align: left;
  }

  #bookmarks .bookmark-text::after {
    content: "\203A";
    padding-right: 0.75rem;
    color: rgb(226 232 240 / 0.72);
    font-size: 1.25rem;
    line-height: 1;
  }
}

/* Keep two columns down to compact phones; below that, prefer legibility. */
@media (max-width: 319px) {
  .services-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .services-list > .service:last-child:nth-child(odd) {
    grid-column: auto;
    width: auto;
  }
}

/* Touch devices should not retain desktop hover backgrounds. */
@media (hover: none) {
  .service-card:hover,
  #bookmarks .bookmark a:hover {
    background-color: rgb(255 255 255 / 0.05);
  }
}

/* =========================
   Family Dashboard Group Icons
   ========================= */
/* Homepage renders layout icons natively for service groups. Bookmarks have no
   native group-icon slot, so Admin mirrors Homepage's MDI mask treatment. */
#bookmarks .bookmark-group > button::before {
  content: "";
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 1.75rem;
  margin-right: 0.5rem;
  background: linear-gradient(180deg, rgb(var(--color-logo-start)), rgb(var(--color-logo-stop)));
  mask: url("https://cdn.jsdelivr.net/npm/@mdi/svg@latest/svg/shield-account-outline.svg") center / contain no-repeat;
}
