/* The four `body { zoom }` rules that used to sit here are gone, and almost
   every measurement in this application was wrong because of them.

   They scaled the whole page by 0.5, 0.7, 0.75 and 0.9 inside four narrow
   width bands - 910-920px, 1360-1370px, 1500-1900px and 1910-4500px - which
   did three things:

     1. Nothing landed on a whole pixel. A 16px gap became 12px at one width
        and 14.4px at another, a 14px label became 10.5px, and the audit found
        29 different font sizes in use on screens that only ever asked for six.
     2. The bands do not touch. Between 921px and 1359px, and again between
        1371px and 1499px, there was no zoom at all, so dragging a window wider
        made the entire interface jump smaller, then jump back.
     3. It scaled *down* as the screen got *bigger*, which is backwards: the
        text was smallest on the largest monitors.

   Responsiveness is a layout that changes at a breakpoint, not a page that is
   photographed and shrunk. What replaces this is in erp-theme.css section 9. */

/* What is left of the original sheet, folded onto the system's breakpoints -
   480 / 768 / 1024 / 1200 / 1440, UI-DESIGN-SYSTEM.md section 9 - instead of
   the eleven overlapping bands with arbitrary edges it used to carry (447,
   448-556, 448-767, 768-991, 992-1023, and six empty ones above that).

   Everything that only restated an erp-theme.css rule is gone, and so is the
   stacked-card table layout, which keyed off `.e-thead` / `.e-tbody` - classes
   that appear in none of the 270 views. What is left is the handful of
   behaviours the theme does not cover: the sign-in card on a phone, the OTP
   field, the old icon rail before js/sidebar.js replaces it, and the chat
   panel. */

/* ---- sign-in, phone --------------------------------------------------- */

@media only screen and (max-width: 479.98px) {

  /* The form fills the card instead of sitting at its desktop width inside it.
     The card itself is already capped by erp-theme.css at min(440px, 92vw). */
  .e-form-container .e-signin-from-container {
    width: auto;
  }

  /* The old icon rail, for the moment before js/sidebar.js reads this markup
     and replaces it with .erp-nav. Nothing in erp-theme.css styles it. */
  .layout-sidebar-large .sidebar-left .navigation-left {
    width: 100px;
  }

  .layout-sidebar-large .sidebar-left-secondary.open {
    left: 100px;
  }
}

@media only screen and (max-width: 767.98px) {

  .e-bg-gradient .e-signin-content {
    padding: var(--s5);
  }

  .e-form-container .e-signin-from-container {
    padding: var(--s4);
  }

  /* The OTP field is one <input> whose six boxes are drawn with letter-spacing
     over a repeating underline, so the whole thing has to be re-measured for a
     narrow screen rather than scaled. #divOuter is the window it scrolls in. */
  #divOuter {
    width: 190px;
    overflow: hidden;
  }

  #partitioned {
    padding-left: 13px;
    letter-spacing: 22px;
    background-size: 31px 2px;
    background-position-x: 30px;
    width: 220px;
    min-width: 220px;
  }

  /* ---- chat panel ----
     Added 1 Aug 2026; phone full-screen 24 Aug 2026.

     On a phone the panel takes the whole screen: a 50%-wide slide-over on a
     390px display is a 195px column, which is not a chat window. On anything
     wider the desktop slide-over is left exactly as it was.

     The panel is position:fixed with top and bottom pinned, so full width is
     all that is needed for full screen - but left is pinned too rather than
     relying on width alone, and the shadow and rounding are dropped because
     there is nothing beside it to cast onto.

     One column at a time at this width: the contact list, or the conversation.
     The class the panel's own JS toggles decides which, and the back arrow that
     only appears here is the way back to the list. */
  .chat-panel {
    width: 100%;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
  }

  /* The backdrop has nothing left to reveal once the panel is full-bleed, and
     on a phone it only ever caught taps meant for the panel itself. */
  .chat-panel-backdrop {
    display: none !important;
  }

  .chat-panel-header {
    padding: var(--s3) 15px;
  }

  .chatpage-sidebar {
    width: 100%;
    min-width: 100%;
    border-right: none;
  }

  .chatpage-main {
    display: none;
  }

  .chatpage-wrap.chatpage-mobile-thread-open .chatpage-sidebar {
    display: none;
  }

  .chatpage-wrap.chatpage-mobile-thread-open .chatpage-main {
    display: flex;
  }

  .chatpage-mobile-back-btn {
    display: inline-flex;
  }

  .chat-attachment-image img,
  .chat-attachment-video video,
  .chat-attachment-doc {
    max-width: 100%;
  }

  /* Thumb-sized targets. The filter chips and the media tabs are the two rows a
     phone user actually taps, and 6px of padding is not a tap target. */
  .chatpage-filter {
    padding: 0 var(--s3) var(--s3) var(--s3);
  }

  .chatpage-filter-btn,
  .chatpage-media-tab {
    padding: 9px var(--s4);
    font-size: 0.82rem;
  }

  .chatpage-search,
  .chatpage-media-search {
    padding: var(--s3);
  }

  .chatpage-thread,
  .chatpage-media-body {
    padding: 14px var(--s3);
  }

  .chatpage-input-bar {
    padding: 10px var(--s3);
  }

  /* On a phone the media browser is the whole screen, so its Back arrow is the
     only way out - the thread underneath is hidden at this width. */
  .chatpage-media-header {
    padding: var(--s3) 15px;
  }

  .chatpage-media-item {
    padding: var(--s3) var(--s1);
  }

  .chatpage-media-tabs {
    padding: 0 var(--s3) var(--s3) var(--s3);
  }

  /* The bar wraps onto two rows rather than squeezing the message into a column
     of two words; the button stays full width so it is still a target. */
  .notify-optin-bar {
    flex-wrap: wrap;
    padding: 10px var(--s3);
    font-size: 0.8rem;
  }

  .notify-optin-text {
    flex: 1 1 100%;
    order: 3;
  }

  .notify-optin-btn {
    flex: 1 1 auto;
    order: 4;
    margin-top: var(--s2);
  }
}

/* ---- tablet and below -------------------------------------------------- */

@media only screen and (max-width: 1023.98px) {

  /* Wide enough for the six OTP boxes to sit side by side, narrow enough that
     they should be centred in the card rather than pinned to its left edge. */
  .e-otp-container {
    justify-content: center;
  }
}

/* A phone held sideways is still a phone: 812x375 never matches a max-width of
   767, so without this a landscape handset would get the desktop slide-over in
   a 375px-tall window. */
@media only screen and (max-width: 1023.98px) and (max-height: 500px) and (orientation: landscape) {

  .chat-panel {
    width: 100%;
    left: 0;
    right: 0;
    box-shadow: none;
  }

  .chat-panel-backdrop {
    display: none !important;
  }

  .chat-panel-header {
    padding: var(--s2) 15px;
  }
}
