/* Shared browser ergonomics. Keep desktop layout and manual pinch zoom intact.
   Loaded last so module styles cannot shrink mobile form controls again. */
.sales-app > .workspace,
.sales-app > .sidebar {
  min-width: 0;
}

.mobile-nav-toggle {
  display: none;
}

@media screen and (max-width: 900px) {
  .sales-app {
    align-content: start;
  }

  .desktop-modules {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
  }

  .desktop-modules > a,
  .desktop-modules > .desktop-sales-group {
    width: 100%;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
  }

  .mobile-nav-toggle[aria-expanded="true"] {
    border-color: var(--green);
    color: var(--green);
  }
}

@media screen and (max-width: 900px), screen and (pointer: coarse) {
  /* A readable native control size also avoids Safari's focus auto-zoom. */
  html body input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]),
  html body select,
  html body textarea {
    font-size: 16px !important;
    min-width: 0;
    max-width: 100%;
  }

  html body input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]),
  html body select,
  html body button,
  html body .button,
  html body .primary-button,
  html body .secondary-button {
    min-height: 44px !important;
  }

  button,
  a,
  input,
  select,
  textarea {
    touch-action: manipulation;
  }

  .workspace-header {
    flex-wrap: wrap;
  }

  .workspace-header > div {
    min-width: 0;
    max-width: 100%;
  }

  html body .workspace-header .button,
  html body .logout-button {
    font-size: 13px;
  }

  .workspace-header .button {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .desktop-modules a,
  .desktop-sales-parent > button {
    min-height: 44px;
  }

  /* dvh follows the changing browser bars; vh remains the fallback. Keep
     native Safari safe-area containment (no viewport-fit=cover opt-in). */
  .desktop-dialog,
  .trial-modal-dialog,
  .partner-login-dialog {
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding-block: 20px;
  }

  .desktop-dialog .dialog-actions {
    flex-wrap: wrap;
    gap: 10px;
  }

  .sales-app,
  .login-panel {
    min-height: 100vh;
    min-height: 100dvh;
  }
}
