/*
 * ISS Track on a phone: an app-like layout.
 * A plum bar along the top with the page title, back, My actions and chat; a white tab bar along the bottom
 * with a raised Add photo button; the full menu as a sheet that slides up; tables shown as cards;
 * filters folded away. Everything here only applies on screens up to 860px wide.
 */
.m-back,.m-logo,.m-acts,.m-handle,.m-install,.m-filters > summary{display:none}

@media screen and (max-width:860px){
  html{-webkit-tap-highlight-color:transparent}
  body{background:var(--mist,#EEF1F4);padding-bottom:calc(72px + env(safe-area-inset-bottom))!important}
  a,button,summary,label,select,input[type=checkbox],input[type=radio]{touch-action:manipulation}
  .shell{display:block;background:none}

  /* ----------------------------------------------------------- top bar */
  .top{position:sticky;top:0;z-index:35;display:flex;align-items:center;gap:6px;flex-wrap:nowrap;
    margin:0;padding:calc(env(safe-area-inset-top) + 8px) 8px 8px 8px;min-height:56px;box-sizing:content-box;
    background:var(--plum,#092A45);color:#fff;border:0;box-shadow:0 1px 0 rgba(0,0,0,.08),0 8px 20px -14px rgba(20,29,39,.6)}
  .top .menu-btn{display:none!important}
  .top > form{display:none}
  .m-back,.m-ic{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;position:relative;width:44px;height:44px;
    padding:0;border:0;border-radius:14px;background:none;color:#fff;cursor:pointer;text-decoration:none}
  .m-back[hidden],.m-ic[hidden]{display:none}
  .m-back:active,.m-ic:active{background:rgba(255,255,255,.14)}
  .m-ic.on{background:rgba(255,255,255,.16)}
  .m-logo{display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;width:40px;height:44px}
  .m-logo img{width:30px;height:30px}
  .has-back .m-logo{display:none}
  .m-title{flex:1 1 auto;min-width:0;padding:0 4px}
  .top .m-title h1,.top h1{margin:0;font-size:1.22rem!important;line-height:1.2;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;letter-spacing:0}
  .top .ctx{margin:1px 0 0;font-size:.76rem;line-height:1.3;color:#DCE6EE;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .top .ctx a{color:#fff}
  .m-acts{display:flex;flex:0 0 auto;gap:2px}
  .m-n{position:absolute;top:4px;right:2px;min-width:18px;height:18px;padding:0 5px;box-sizing:border-box;border-radius:9px;
    background:var(--lilac,#A4CAE1);color:#071F33;font:800 .68rem/18px var(--sans);text-align:center}
  .m-n[hidden]{display:none}

  /* ------------------------------------------------------- page body */
  .wrap{padding:1rem .85rem 1.4rem}
  main.wrap > .ph:first-child h2:first-child{margin-top:0}
  .panel{border-radius:20px}
  footer.wrap{padding:.4rem 1rem 1.4rem;font-size:.76rem;line-height:1.6;text-align:center}
  .btn:active,.pill:active,.tabs a:active,.rag button:active{transform:scale(.97)}
  .btn,.tabs a,.rag button{transition:transform .08s}

  /* --------------------------------------------------------- tab bar */
  .mbar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:30;align-items:stretch;
    background:rgba(255,255,255,.96);-webkit-backdrop-filter:saturate(1.6) blur(14px);backdrop-filter:saturate(1.6) blur(14px);
    border-top:1px solid var(--line,#DCE7EF);padding:0 4px env(safe-area-inset-bottom);box-shadow:0 -10px 24px -18px rgba(20,29,39,.35)}
  .mbar a,.mbar button{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
    min-height:64px;padding:6px 2px 8px;border:0;background:none;color:#566B7E;text-decoration:none;font:700 .7rem/1.1 var(--sans);cursor:pointer}
  .mbar a.on{color:var(--plum,#092A45);background:none;border:0}
  .mbar i{display:flex;align-items:center;justify-content:center;width:56px;height:30px;border-radius:15px;transition:background .15s}
  .mbar i svg{width:24px;height:24px}
  .mbar a.on i{background:#EAF2F5}
  .mbar a:active i,.mbar button:active i{background:#DDE3E9}
  .mbar span{white-space:nowrap}
  .mbar a.cam{color:var(--plum,#092A45)}
  .mbar a.cam i{width:56px;height:56px;margin-top:-26px;border-radius:50%;background:var(--plum,#092A45);color:#fff;
    box-shadow:0 0 0 5px #fff,0 10px 22px -8px rgba(20,29,39,.7)}
  .mbar a.cam i svg{width:28px;height:28px;padding:0;margin:0;background:none}
  .mbar a.cam:active i{background:var(--plum-deep,#071F33)}
  .mbar a.cam.on i{background:var(--plum-deep,#071F33)}

  /* ------------------------------------------------- the menu sheet */
  .side{position:fixed;left:0;right:0;top:auto;bottom:0;z-index:60;width:auto;height:auto;max-height:88vh;max-height:88dvh;
    display:flex;flex-direction:column;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
    border-radius:26px 26px 0 0;padding:0 0 calc(12px + env(safe-area-inset-bottom));
    transform:translateY(105%);transition:transform .28s cubic-bezier(.2,.8,.2,1);visibility:hidden}
  .side.open{transform:none;visibility:visible;box-shadow:0 0 0 100vmax rgba(14,22,32,.45),0 -10px 30px rgba(0,0,0,.2)}
  .side.dragging{transition:none}
  .m-handle{display:block;position:sticky;top:0;z-index:2;flex:0 0 auto;height:26px;background:inherit;cursor:grab}
  .m-handle::before{content:"";position:absolute;left:50%;top:10px;width:44px;height:5px;margin-left:-22px;border-radius:3px;background:rgba(255,255,255,.4)}
  .side .brand{padding:.2rem 1.3rem .9rem}
  .side nav{flex:0 0 auto}
  .side nav a{padding:.8rem 1.3rem;font-size:1rem;min-height:48px;box-sizing:border-box;display:flex;align-items:center;justify-content:space-between}
  .side .m-switch{margin:0 1.1rem .8rem;padding:.8rem;border-radius:16px;background:rgba(255,255,255,.08)}
  .side .m-switch label{display:block;margin:0 0 .35rem;color:#DCE6EE;font-size:.78rem;font-weight:700}
  .side .m-switch select{width:100%;margin:0}
  .m-install:not([hidden]){display:block;margin:0 1.1rem .9rem;padding:.8rem;border-radius:16px;background:rgba(255,255,255,.1);color:#EAF2F5}
  .m-install .btn{width:100%;background:#fff;color:var(--plum,#092A45)}
  .m-install p{margin:.5rem 0 0;color:#EAF2F5}
  html.sheet-open,html.sheet-open body{overflow:hidden}

  /* ------------------------------------------------ tables as cards */
  table.m-cards,table.m-cards tbody,table.m-cards tr,table.m-cards td{display:block;width:auto}
  table.m-cards{border:0;background:none}
  table.m-cards thead{display:none}
  table.m-cards tr{background:#fff;border:1px solid var(--line,#DCE7EF);border-radius:16px;padding:.75rem .9rem;margin:0 0 .6rem}
  table.m-cards tr:hover td{background:none}
  table.m-cards tr{border-bottom:1px solid var(--line,#DCE7EF)}
  table.m-cards td{border:0!important;padding:.18rem 0!important;display:flex;gap:.7rem;align-items:baseline;text-align:left!important;min-width:0}
  table.m-cards td::before{content:attr(data-label);flex:0 0 34%;font-size:.74rem;font-weight:700;color:#6E7A86;text-transform:none}
  table.m-cards td[data-label=""]::before{display:none}
  table.m-cards td > *{min-width:0}
  table.m-cards td:first-child{display:block;font-size:1rem;font-weight:700;padding-bottom:.35rem!important}
  table.m-cards td:first-child::before{display:none}
  table.m-cards td:empty{display:none}
  .panel:has(> table.m-cards),.panel.flush:has(> table.m-cards){background:none;border:0;box-shadow:none;padding:0}
  .tablewrap:has(table.m-cards),.scrollx:has(table.m-cards){overflow:visible}

  /* ------------------------------------------------ filters folded */
  details.m-filters{margin:0 0 1rem;border-radius:16px;background:#fff;border:1px solid var(--line,#DCE7EF)}
  details.m-filters > summary{display:flex;align-items:center;gap:.6rem;min-height:48px;padding:0 1rem;font-weight:700;color:var(--plum,#092A45);cursor:pointer;list-style:none}
  details.m-filters > summary::-webkit-details-marker{display:none}
  details.m-filters > summary::after{content:"";margin-left:auto;width:9px;height:9px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg) translateY(-3px);transition:transform .15s}
  details.m-filters[open] > summary::after{transform:rotate(-135deg) translateY(-2px)}
  details.m-filters > summary b{font-weight:700;background:#EAF2F5;border-radius:999px;padding:.1rem .55rem;font-size:.78rem}
  details.m-filters > form{padding:0 1rem .9rem;margin:0!important;position:static!important;background:none!important}

  /* -------------------------------------------- chat and back to top */
  .cb-bubble{display:none!important}
  .cb-panel{top:calc(env(safe-area-inset-top) + 8px)!important;bottom:calc(80px + env(safe-area-inset-bottom))!important}
  .to-top,.to-top.with-chat{right:14px;bottom:calc(84px + env(safe-area-inset-bottom))}
  .chat-toast{bottom:calc(84px + env(safe-area-inset-bottom))}
}

@media (prefers-reduced-motion:reduce){
  .side,.btn,.tabs a,.rag button,.mbar i{transition:none!important}
}
