/* Prompt 17: touch targets on the phone. Every control a finger has to hit is at least 44 x 44 px (the size Apple and Google both ask for) at 640 px and below.
   Plain CSS, loaded last by the panel (app.html), the login page and the customer/public pages. The desktop (1024 px and up) is not touched.
   tests/p17_mobile_audit.cjs measures it (375 px, dark). Rules are written with `html body` in front so the compiled Tailwind utilities (h-9, w-9, py-1.5...) do not win. */
@media (max-width: 640px) {
  /* buttons, tabs, selects and fields */
  html body :is(button, [role="button"], [role="tab"], summary, select, textarea, input:is([type="text"], [type="search"], [type="email"], [type="tel"], [type="password"], [type="number"], [type="date"], [type="time"], [type="url"], [type="datetime-local"], :not([type]))) { min-height: 44px; }
  html body :is(button, [role="button"], [role="tab"]):not(.fc-event):not(.fc-button) { min-width: 44px; }
  html body :is(summary, button.linkbtn, a.hm-more, button.hm-more) { display: inline-flex; align-items: center; }
  html body summary { list-style-position: inside; }
  /* a checkbox or radio is hit through its label: the whole row is the target */
  html body :is(label:has(> input[type="checkbox"]), label:has(> input[type="radio"]), label:has(> span > input[type="checkbox"])) { min-height: 44px; display: flex; align-items: center; }
  html body :is(input[type="checkbox"], input[type="radio"]):not(:is(label > input)) { min-width: 44px; min-height: 44px; }
  /* standalone links (not in the middle of a sentence) */
  html body :is(a.hn-line, a.set-nav-item, a.brand, a.login, nav a, footer a, .hm-more) { min-height: 44px; }
  html body :is(a.hn-line, a.set-nav-item, a.brand, a.login, nav a, footer a):not(.flex):not(.grid) { display: inline-flex; align-items: center; }
  /* the top bar of the panel: logo, search, bell, account */
  html body :is(#gs-open, #bell, #acct-btn) { width: 44px; height: 44px; }
  /* tables whose rows open something */
  html body tbody tr { min-height: 44px; }   /* P23: a MINIMUM (it was a fixed height: the admin page stacks its rows as blocks taller than 44 px, which spilled over the next section at 375 px) */
}

@media (max-width: 640px) {
  /* the compiled `html #shell .bt-btn` sets 40 px: same weight, so it is repeated here, later */
  html body #shell :is(.bt-btn, .ds-btn, .bt-btn.sm, .ds-btn.sm) { height: 44px; min-height: 44px; }
  html body #shell :is(.bt-btn, .ds-btn) { min-width: 44px; }
  html body :is(input[type="range"], input[type="color"]) { min-height: 44px; }
  /* links that look like buttons or stand alone */
  html body a:is(.inline-flex, .rounded-lg, .rounded-xl, .rounded-full, .text-center) { min-height: 44px; }
  html body a.text-center { display: flex; align-items: center; justify-content: center; }
  html body a[class~="hover:text-brand-500"], html body :is(a[href^="tel:"], a[href^="mailto:"]) { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
  html body :is(a.flex.items-center.gap-2, a.brand) { min-width: 44px; }
  /* the month grid is 7 columns of ~50 px: an event is a 44 px tap target whose text wraps (no time, no cut) */
  html body #shell .fc-daygrid-event, html body #shell .fc-daygrid-block-event { min-height: 44px; display: flex; align-items: center; }
  html body #shell .fc-daygrid-event .fc-event-time { display: none; }
  html body #shell .fc-daygrid-event :is(.fc-event-title, .fc-event-main, .fc-event-main-frame) { white-space: normal; overflow: visible; overflow-wrap: anywhere; font-size: 10px; line-height: 1.15; }
}

@media (max-width: 640px) {
  html body #shell .qp-actions > :is(.ds-btn, .bt-btn) { min-width: 44px; }
  html body :is(.foot-in a, .foot .linkbtn, a.login, a.brand) { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  html body input[type="color"] { min-width: 44px; flex: none; }
}

@media (max-width: 640px) {
  html body a:has(> img) { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
}

@media (max-width: 640px) {
  /* nothing may push the page sideways, not even for a moment while the header is still being built (the bar showed 488 px for ~1 s on opening) */
  html, html body { overflow-x: clip; max-width: 100%; }
}
