/* Keep the client sign-in and account forms at a readable line length. */
#loginCard.portal-card,
#inviteCard.portal-card,
#changePwCard.portal-card {
  max-width: 480px;
}

.portal-card #passwordRow[hidden] {
  display: none;
}

.set-section-picker {
  display: none;
}

/* Contact filters should stay inside the content column even when open. */
.ve-ca-contact-filter-options > * {
  min-width: 0;
}

.ve-ca-contact-filter-options .fgroup,
.ve-ca-contact-filter-options select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 960px) {
  .settings .set-nav > :not(.set-section-picker) {
    display: none;
  }

  .settings .set-nav {
    position: static;
    padding: 12px;
  }

  .set-section-picker {
    display: grid;
    gap: 6px;
  }

  .set-section-picker select {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
    appearance: auto;
  }
}

@media (max-width: 900px) {
  .sidebar {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .drawer .dr-tabs {
    flex-wrap: wrap;
  }

  .ci-fab,
  .ci-update-toast {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .ci-toast {
    bottom: calc(144px + env(safe-area-inset-bottom, 0px));
  }

  .ci-opener-wrap {
    padding: 12px 16px calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .ci-opener {
    max-height: calc(100dvh - 88px - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
  }

  .ve-ca-contact-filters[open] {
    grid-column: 1 / -1;
  }

  .ve-ca-contact-filters[open] > summary {
    width: fit-content;
    margin: 0 0 8px auto;
  }

  .ve-ca-contact-filters .ve-ca-contact-filter-options {
    position: static;
    width: 100%;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .view .g-3:has(> .kpi),
  .view .g-4:has(> .kpi),
  .view .g-6:has(> .kpi) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .toolbar .tb-row > .fgroup,
  .toolbar .fgroup > .sel {
    min-width: 0;
    max-width: 100%;
  }

  .drawer .dr-tab {
    min-height: 40px;
  }

  #v-reports .card-head:has(> .hint) {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .portal-shell {
    padding: 12px;
  }

  .portal-card {
    padding: 20px 16px;
  }
}
