/*
 * Hi Poulta responsive layer (2026-11-04; the user: "make our entire existing AgenticOS application fully responsive …
 * no horizontal scrolling on the overall page"). Loaded on every page after its own styles: the main app, the division
 * views and their guides, the control panel, logs, explorer, account, sign-up and onboarding pages. It only adds what the
 * audit found missing; the pages' own phone rules stay as they are. Breakpoints: phone < 480, tablet 480–1023, desktop 1024+.
 * Companion: /brand/hi-poulta-responsive.js (a table wider than its card scrolls inside the card, never the page).
 */

/* a table that is wider than its card scrolls inside the card (the script marks the card) */
.hp-xscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; overscroll-behavior-x: contain; }

/* pictures and charts never wider than their box */
img, video, canvas { max-width: 100%; }
img { height: auto; }

/* grids whose columns are at least 300–400 px wide (the division views' .cards / .attn, the control panel's company cards
   .fleet, the logs page's .grid2): one column on a phone, so a card is never wider than the screen. Wider screens keep the
   pages' own grids and their own media rules. */
@media (max-width: 599px) {
  .cards, .attn, .fleet, .grid2 { grid-template-columns: minmax(0, 1fr) !important; }
}

@media (max-width: 1023px) {
  /* long ids, e-mail addresses and numbers wrap instead of pushing the page wider */
  body { overflow-wrap: break-word; }
}
@media (max-width: 767px) {
  /* the main app's code-like names (an approval's trigger "broiler.daily_mortality_breach", ids) have no break points: on a
     phone they may break anywhere rather than push their card past the screen (a cell that must stay on one line keeps
     its own white-space: nowrap) */
  .pm-main-in [style*="Plex Mono"], .pm-main-in [style*="monospace"] { overflow-wrap: break-word; }
}

/* ---- the division views' top bar (.topbar / .topright): on a phone the right side never pushes the page wider ---- */
@media (max-width: 767px) {
  .topbar { gap: 8px !important; padding-left: max(12px, env(safe-area-inset-left, 0px)) !important; padding-right: max(12px, env(safe-area-inset-right, 0px)) !important; }
  .topbar > * { min-width: 0; }
  .topright { gap: 6px !important; min-width: 0; flex: 0 1 auto; flex-wrap: nowrap !important; }
  .topright .segpill { display: none !important; }       /* the segment is the page's own heading too */
  .topright .pt-tb { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 479px) {
  .topbar .pt-pw { display: none !important; }   /* "Powered by AI" beside the logo */
  .apbtns { flex-wrap: wrap; }                     /* the views' Approve / Hold / Reject */
  .p-top { flex-wrap: wrap; row-gap: 8px; }        /* the control panel, logs, explorer and system map header */
  .modal { padding: 8px !important; }              /* the views' dialogs: more of a phone's width for the content */
}
/* the smallest phones (320–359 px): a little less side padding in the views, so a row of figures fits */
@media (max-width: 359px) {
  .app main { padding-left: 10px !important; padding-right: 10px !important; }
}

/* ---- touch: buttons and fields big enough to tap on phones and tablets (not inside table cells, which stay compact) ---- */
@media (max-width: 1023px) and (pointer: coarse) {
  .p-btn, .pt-tb, .topright button { min-height: 40px; }
  /* the views' toggles and filter pills (31 px) */
  .tg, button.pill { min-height: 40px; }
}
/* the views' help buttons (.hbtn, 20 px in table headers, 30 px elsewhere): on a touch screen the tap area is 40 px or
   more around the button, the button itself drawn as before, so tables keep their size */
@media (pointer: coarse) {
  .hbtn { position: relative; }
  .hbtn::after { content: ""; position: absolute; inset: -10px -4px; }
}
