/* 484 · The phone.
 *
 * Every screen carries its own styles, written for a desk with a wide monitor.
 * On a phone the header row — brand, hotel, dates, quick links, Menu — was
 * wider than the glass, and the Menu button, the only way to any other screen,
 * sat past the right-hand edge. Forty-two screens scrolled sideways.
 *
 * This file is loaded by every screen after its own styles and changes nothing
 * above 760px. Below it: the header wraps with Home/Menu on the first line,
 * the page never scrolls sideways (a wide table scrolls inside itself, and
 * mobile.js wraps the ones that did not), dialogs fit the glass, and a finger
 * gets a target it can hit.
 */
@media screen and (max-width:760px){
  html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
  html,body{max-width:100%;overflow-x:hidden}

  /* ---- the header: two or three short rows instead of one long one ---- */
  body > header, body > .bar{
    height:auto!important;min-height:52px;flex-wrap:wrap!important;
    row-gap:8px;column-gap:8px!important;padding:8px 10px!important;
    position:relative!important;       /* a three-row bar must not ride over the page */
  }
  body > header > *{white-space:normal}
  body > header .brand{order:0;flex:0 1 auto;min-width:0;font-size:.95rem!important;display:block!important}
  body > header .brand span{display:none!important}
  /* the .sp group gives its children to the header so they can be ordered */
  body > header .sp, body > .bar .sp{display:contents!important}
  body > header .navstrip, body > .bar .navstrip{order:1;margin-left:auto;flex:0 0 auto;display:flex;gap:6px}
  /* everything the page put in the bar — hotel, dates, month — on row two */
  body > header > select, body > header > label, body > header > input,
  body > header > button, body > header > div:not(.brand):not(.sp):not(.navstrip){
    order:2;flex:1 1 auto;min-width:0;max-width:100%!important;
  }
  body > header > button{flex:0 0 auto}
  body > header > select{flex-basis:100%}
  body > header > label{display:flex;align-items:center;gap:6px;flex:1 1 40%}
  body > header > label input{flex:1;min-width:0;width:auto!important}
  /* quick links, the business date, Shift: a strip on row three */
  body > header .sp > a, body > header .sp > span:not(.navstrip),
  body > header .sp > button, body > header .sp > select{order:3;flex:0 0 auto;font-size:.8rem!important}
  body > header .bd{flex-basis:100%!important;opacity:.8}
  body > header a.cal span{display:none}

  /* a tab strip stuck under a 56px header: the header no longer sticks */
  .tabs{top:0!important;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .tabs::-webkit-scrollbar{display:none}
  .tabs > *{flex:0 0 auto}

  /* ---- the page ---- */
  img, video, canvas, svg{max-width:100%}
  pre, code{white-space:pre-wrap;word-break:break-word}
  .m-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
  .m-scroll > table{min-width:100%}

  /* forms: fields take the width; side-by-side rows stack */
  input:not([type=checkbox]):not([type=radio]), select, textarea{max-width:100%}
  .row, .form-row, .fields, .grid2, .grid3, .two, .three{flex-wrap:wrap}

  /* the reservation calendar: a narrower room column leaves room for days,
     and the grid takes the whole glass once the header has scrolled away */
  #grid .lbl, .wrap > table .lbl{min-width:104px!important;max-width:104px!important;padding:0 6px!important}
  body:has(#grid) .wrap{max-height:calc(100dvh - 8px)!important}

  /* the restaurant till: menu over the order, not a 392px order beside a sliver */
  .app:has(> .left + .right){flex-direction:column;height:auto!important}
  .app > .left{border-right:0!important;min-height:55vh}
  .app > .right{width:100%!important;border-top:1px solid #E6E2DE}
  .app .grid{grid-template-columns:repeat(auto-fill,minmax(112px,1fr))!important}
  #sub{white-space:normal!important}
  /* a list-beside-the-page screen (reports): the list above, short, scrolling */
  .app:has(> .side){flex-direction:column;height:auto!important}
  .app > .side{width:100%!important;max-height:40vh;overflow:auto;border-right:0!important;border-bottom:1px solid #E6E2DE}
  .app > .main{min-height:60vh}

  /* ---- dialogs fit the glass ---- */
  .modal, .overlay, .dlg, .backdrop, [role=dialog]{align-items:flex-start!important;padding:8px!important}
  .modal > .card, .modal .card, .overlay > .card, .dlg > .card, [role=dialog] > .card, .modal-card, .sheet{
    width:auto!important;max-width:calc(100vw - 16px)!important;min-width:0!important;
    max-height:calc(100dvh - 16px);overflow:auto;margin:0 auto!important;
  }
}

/* a screen that is waiting for its data says so with a turning ring, not a
   bare word. Every page that loads this file gets it: <span class="pms-loading">. */
.pms-loading{display:inline-flex;align-items:center;gap:8px;color:#6B6B6B;font-size:.92em;line-height:1.4;vertical-align:middle}
.pms-loading > i{width:14px;height:14px;flex:0 0 auto;border:2px solid #E6E2DE;border-top-color:#0C272F;border-radius:50%;animation:pms-spin .8s linear infinite}
@keyframes pms-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.pms-loading > i{animation-duration:2.4s}}

/* a finger is not a mouse pointer */
@media screen and (max-width:760px) and (pointer:coarse){
  button, .btn, .act, select, a.chip, header a, .tabs button, .tabs a{min-height:36px}
  input[type=checkbox], input[type=radio]{width:20px;height:20px}
}
