/* The phone app's frame (2026-11-13, phone app: Android + PWA): on a phone the portal looks and moves like a native app -
   a bottom tab bar (core/static/tabbar.js), every dialog a bottom sheet with a grab handle, the notch and the home bar
   kept clear (viewport-fit=cover + safe-area insets), big touch targets. Laptop and tablet are untouched. Colours are the
   portal's own tokens (portal.css), so light and dark both follow. */
.tabbar{display:none}
@keyframes tb-sheet-up{from{transform:translateY(100%)}to{transform:none}}
@keyframes tb-rise{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}

@media (max-width:640px){
  body.app-tabs{--tabbar-h:62px;-webkit-tap-highlight-color:transparent}

  /* the bar */
  body.app-tabs .tabbar{position:fixed;left:0;right:0;bottom:0;z-index:57;display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);
    align-items:center;height:calc(var(--tabbar-h) + env(safe-area-inset-bottom));padding:0 6px env(safe-area-inset-bottom);
    background:color-mix(in srgb,var(--panel) 90%,transparent);-webkit-backdrop-filter:saturate(1.8) blur(18px);backdrop-filter:saturate(1.8) blur(18px);
    border-top:1px solid var(--line);box-shadow:0 -8px 24px rgba(13,18,32,.06)}
  .tabbar .tb{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;min-height:52px;
    margin:0;padding:5px 0 4px;border:0;border-radius:16px;background:none;box-shadow:none;color:var(--muted);cursor:pointer;
    font:inherit;font-size:11px;font-weight:620;letter-spacing:.01em;line-height:1.1;text-decoration:none;transition:color .18s}
  .tabbar .tb:hover{text-decoration:none;color:var(--ink-2)}
  .tabbar .tb-ico{display:grid;place-items:center;width:56px;height:30px;border-radius:999px;transition:background .22s,transform .22s}
  .tabbar .tb-lbl{max-width:100%;padding:0 2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .tabbar .tb.on{color:var(--brand)}
  .tabbar .tb.on .tb-ico{background:var(--brand-soft)}
  .tabbar .tb:active .tb-ico{transform:scale(.92)}
  .tabbar .tb:focus-visible{outline:none}
  .tabbar .tb:focus-visible .tb-ico{box-shadow:var(--ring)}

  /* the page makes room: the notch on top, the bar and the home bar below; the side menu's burger gives way to More */
  body.app-tabs .main{padding:calc(12px + env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) calc(var(--tabbar-h) + 34px + env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left))}
  body.app-tabs #burger,body.app-tabs .side,body.app-tabs .side.open{display:none}
  body.app-tabs .topbar{gap:4px;margin:0 0 14px}
  body.app-tabs .topbar > button.icon,body.app-tabs .topbar .usermenu .who{min-width:40px;min-height:40px}
  body.app-tabs .pd{bottom:calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom))}
  body.app-tabs .toasts{bottom:calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom))}
  body.app-tabs .jobpanel{bottom:calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom))}
  body.app-tabs input,body.app-tabs select,body.app-tabs textarea{font-size:16px}   /* an iPhone zooms into a smaller box */

  /* every dialog is a bottom sheet: full width, rounded top, a grab handle, Close still pinned in its header */
  /* 2026-11-14: one row the height of the screen - an auto row grew to a tall dialog's content and pushed the sheet off the
     bottom (max-height 100% of a row that grows with it); guard in selfcheck.py */
  .backdrop{place-items:end stretch;padding:env(safe-area-inset-top) 0 0;grid-template-rows:minmax(0,1fr)}
  .modal{width:100% !important;max-height:min(92dvh,100%);border-bottom:0;border-radius:22px 22px 0 0;
    animation:tb-sheet-up 280ms cubic-bezier(.2,.8,.2,1);padding-bottom:env(safe-area-inset-bottom)}
  .modal > header{border-radius:22px 22px 0 0;padding-top:22px}
  .modal > header::before{content:"";position:absolute;top:8px;left:50%;width:40px;height:4px;margin-left:-20px;border-radius:4px;background:var(--line-2)}
  .modal > footer{border-radius:0}
  .modal > footer button{min-height:46px;flex:1 1 auto}

  /* More: the whole menu as big rows */
  .tb-more{display:flex;flex-direction:column;gap:2px}
  .tb-more a{min-height:50px;font-size:15px;border-radius:14px;padding:10px 12px}
  .tb-more .sep{margin:14px 12px 4px}

  /* the install card: one card above the bar, never over the page's own buttons for long */
  .tb-install{position:fixed;left:12px;right:12px;z-index:58;bottom:calc(var(--tabbar-h,0px) + 12px + env(safe-area-inset-bottom));
    display:grid;grid-template-columns:44px minmax(0,1fr);gap:10px 12px;align-items:center;padding:14px;border-radius:20px;
    background:var(--panel);border:1px solid var(--line);box-shadow:var(--shadow-3);animation:tb-rise 260ms cubic-bezier(.2,.8,.2,1)}
  .tb-install img{width:44px;height:44px;border-radius:12px}
  .tb-install .tb-i-txt{display:grid;gap:2px;min-width:0}
  .tb-install .tb-i-txt b{font-size:15px;color:var(--ink)}
  .tb-install .tb-i-txt span{font-size:12.5px;color:var(--muted)}
  .tb-install .tb-i-acts{grid-column:1/-1;display:flex;gap:8px}
  .tb-install .tb-i-acts button{flex:1 1 0;min-height:44px;justify-content:center}
}

/* the iPhone steps (any width) */
.tb-steps{list-style:none;margin:0;padding:0;display:grid;gap:12px}
.tb-steps li{display:flex;gap:12px;align-items:center;font-size:15px}
.tb-num{display:grid;place-items:center;flex:none;width:30px;height:30px;border-radius:999px;background:var(--brand-soft);color:var(--brand);font-weight:700}

/* installed (PWA) or inside ValueStore: no browser chrome above, so the top bar keeps clear of the status bar */
@media (display-mode:standalone){
  body{overscroll-behavior-y:none}
}
@media (prefers-reduced-motion:reduce){.modal,.tb-install{animation:none}}
