/* Keep touch inputs readable without disabling the user's pinch-to-zoom. */
@media screen and (max-width: 980px), screen and (hover: none) {
  :root body :is(input, select, textarea) {
    font-size: max(16px, var(--ssc-font-control, 16px)) !important;
    min-width: 0;
    max-width: 100%;
  }
  #ssc-auth-gate, #ssc-auth-gate * { box-sizing: border-box; }
  #ssc-auth-gate { overflow-y: auto; }
  #ssc-auth-gate .ssc-auth-card { min-width: 0; max-width: 100%; }
}

@media screen and (max-width: 720px) {
  /* Sales header: separate the brand from account actions instead of squeezing
     both into a fixed-height desktop row. The collections header is untouched. */
  #sales-sidebar ~ .main-content > .topbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    min-height: 0;
    gap: 10px;
    padding-block: 12px;
  }
  #sales-sidebar ~ .main-content .topbar .system-brand {
    width: 100%;
    min-width: 0;
    gap: 10px;
    align-items: center;
  }
  #sales-sidebar ~ .main-content .topbar .system-brand > div {
    flex: 1;
    min-width: 0;
  }
  #sales-sidebar ~ .main-content .topbar .system-brand strong {
    font-size: max(16px, var(--ssc-font-body, 16px));
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  #sales-sidebar ~ .main-content .topbar .system-mark {
    flex: 0 0 38px;
    width: 38px;
  }
  #sales-sidebar ~ .main-content .topbar .header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }
  #sales-sidebar ~ .main-content .topbar .session-time { display: none; }
  #sales-sidebar ~ .main-content .topbar :is(#system-search-button, #theme-toggle, .notification, #menu-button) {
    display: inline-grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
  }
  #sales-sidebar ~ .main-content .topbar .language-select {
    flex: 0 0 auto;
    width: auto;
    height: 44px;
  }
  #sales-sidebar ~ .main-content .topbar #ssc-auth-logout {
    flex: 0 0 auto;
    min-height: 44px;
    white-space: nowrap;
  }
  #sales-sidebar ~ .main-content .dashboard-welcome { min-height: 0; padding-bottom: 22px; }
  #sales-sidebar ~ .main-content .quick-actions {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    margin-top: 18px;
    overflow: visible;
  }
  #sales-sidebar ~ .main-content .quick-actions > button {
    min-width: 0;
    min-height: 44px;
    padding: 10px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media screen and (max-width: 480px) {
  #ssc-auth-gate { padding: 16px; }
  #ssc-auth-gate .ssc-auth-card { padding: 22px 18px; }
  #ssc-auth-gate .ssc-auth-card-head { flex-wrap: wrap; }
}
