:root{--pfi-top:max(6px,env(safe-area-inset-top));--pfi-rail-height:calc(var(--pfi-top) + 54px)}
html body{padding-top:var(--pfi-rail-height)}
header.pfi-home-rail,.pdf-head.pfi-home-rail,.joint-document-bar.pfi-home-rail{box-sizing:border-box;position:fixed;z-index:125;inset:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:10px;height:var(--pfi-rail-height);margin:0;padding:var(--pfi-top) max(16px,env(safe-area-inset-right)) 6px max(16px,env(safe-area-inset-left));color:white;background:#143649;border:0}
.pfi-home-rail>a.pfi-home-key{display:inline-flex;align-items:center;box-sizing:border-box;height:48px;flex:none;gap:6px;margin:0;padding:0;border:0;color:white;background:transparent;font:750 clamp(16px,2.8vw,26px)/1.25 system-ui,sans-serif;letter-spacing:0;text-decoration:none;white-space:nowrap}
.pfi-home-key::before{content:'‹';font:400 32px/1 system-ui}
header.pfi-home-rail>a.pfi-home-key::before{content:'';display:block;flex:none;width:32px;height:32px;border-radius:7px;background:#fff url('/pfi-icon-180.png?v=airpremia-ci') center/contain no-repeat}
.pfi-home-rail>a{color:white}.pfi-home-rail>span{font:600 12px/1.3 system-ui;letter-spacing:.06em}
.pfi-home-rail nav.pfi-dropdown{position:static;margin:0 0 0 auto;padding:0;border:0;background:transparent}.pfi-home-rail .pfi-dropdown-list{left:auto;right:0}
header.pfi-home-rail .pfi-dropdown summary{background:white;color:#143649}.joint-document-bar.pfi-home-rail h3{color:inherit}
#pa-pdf[open],dialog.joint-document[open]{box-sizing:border-box;padding-top:var(--pfi-rail-height)}
main.joint-aio-workspace,.pdf-reader-app.pdf-reader-app{height:calc(100dvh - var(--pfi-rail-height))}
dialog.record-action-dialog[open]{display:grid;place-items:center;position:fixed;inset:0;width:100%;max-width:none;height:100%;max-height:none;margin:0;padding:var(--pfi-rail-height) 12px 12px;box-sizing:border-box;border:0;border-radius:0;background:transparent;box-shadow:none}
.record-action-card{background:#fff;color:#18384b;padding:24px;border-radius:12px;width:min(100%,480px)}
@media(max-width:600px){header.pfi-home-rail>span:not(:last-child){display:none}}
@media(max-width:400px){header.pfi-home-rail{gap:6px;padding-inline:8px}header.pfi-home-rail>a.pfi-home-key::before{width:24px;height:24px}.pfi-home-rail>a.pfi-home-key{font-size:14px;gap:4px}}

.pfi-home-rail>a.pfi-app-close,.pfi-app-window header button{display:inline-flex;align-items:center;justify-content:center;flex:none;min-height:44px;margin:0;padding:0 12px;border:1px solid #98b3bf;border-radius:8px;background:transparent;color:white;font:650 16px/1.1 system-ui,sans-serif;text-decoration:none;white-space:nowrap;cursor:pointer}
dialog.pfi-app-window[open]{position:fixed;inset:0;display:flex;flex-direction:column;padding:0;border:0;border-radius:0;margin:0;width:100%;max-width:none;height:100dvh;max-height:none;background:#f5f8f9;color:#17394d}
.pfi-app-window>header{position:static;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:max(7px,env(safe-area-inset-top)) 16px 7px;background:#143649;color:white}
.pfi-window-actions{padding:8px 16px}.pfi-window-actions p{margin:8px 0}.pfi-window-actions a{display:inline-flex;align-items:center;min-height:44px;font-weight:650;text-decoration:underline;color:#164f64}
.pfi-app-window iframe{flex:1;min-height:0;width:100%;border:0;background:white}

.pfi-closed-home[open]{position:fixed;inset:0;display:grid;place-items:center;width:100vw;height:100dvh;max-width:none;max-height:none;margin:0;border:0;background:#f4f7fa;color:#182d40;text-align:center}
.pfi-closed-home::backdrop{background:#f4f7fa}
.pfi-closed-home h1{font-size:1.45rem;margin:0 0 1.2rem}
.pfi-closed-home button{min-height:44px;border:0;border-radius:7px;padding:0 18px;background:#143649;color:white;font:650 16px system-ui;cursor:pointer}

/* Keep the current mode and its opposite action visible when the app beneath scrolls. */
@media screen {
  body:has(.portal-mode-bar:not(.portal-mode-dialog-bar)) {
    /* The mode bar already covers the safe area. */
    --pfi-top: 6px;
    --pfi-rail-height: 60px;
    padding-top: calc(var(--pfi-rail-height) + var(--portal-mode-height));
  }
  body:has(.portal-mode-bar:not(.portal-mode-dialog-bar)) :is(header.pfi-home-rail,.pdf-head.pfi-home-rail,.joint-document-bar.pfi-home-rail) {top:var(--portal-mode-height)}
}
.portal-offline-status:empty {display:none}

/* A single bottom app dock keeps navigation reachable without stacking headers. */
@media screen {
  body:has(.crew-app-workspace) {padding-bottom:calc(56px + env(safe-area-inset-bottom, 0px));}
  body:has(.crew-app-workspace) .crew-app-tabs {
    position:fixed;inset:auto 0 0;top:auto;z-index:130;height:calc(56px + env(safe-area-inset-bottom,0px));box-sizing:border-box;
    display:flex;flex-wrap:nowrap;gap:2px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;
    padding:3px max(8px,env(safe-area-inset-right)) calc(3px + env(safe-area-inset-bottom, 0px)) max(8px,env(safe-area-inset-left));
    border-top:1px solid #6a8999;box-shadow:0 -3px 14px #17364718;
  }
  body:has(.crew-app-workspace) .crew-app-tabs button {
    flex:1 0 auto;min-height:48px;padding:8px 16px;font-size:.9375rem;
    border-bottom:0;border-top:3px solid transparent;
  }
  body:has(.crew-app-workspace) .crew-app-tabs button[aria-selected="true"] {border-top-color:#ff9178;}
  body:has(.crew-app-workspace) .crew-app-workspace .pfi-home-rail {top:var(--portal-mode-height,0px);}
  body:has(.crew-app-workspace[data-embedded="true"]) {
    padding-top:var(--portal-mode-height,0px);padding-bottom:0;overflow:hidden;
  }
  body:has(.crew-app-workspace[data-embedded="true"]) .account-strip {display:none;}
  :is(body,div):has(> .crew-app-workspace[data-embedded="true"]) {
    display:flex;flex-direction:column;
    height:calc(100dvh - var(--portal-mode-height,0px) - 56px - env(safe-area-inset-bottom,0px));
    min-height:0;
  }
  .crew-app-workspace[data-embedded="true"] {flex:1;min-height:0;}
  .crew-app-workspace[data-embedded="true"] > section {height:100%;}
  body:has(.crew-app-workspace) .crew-app-workspace[data-embedded="true"] .crew-app-frame {height:100%;min-height:0;}
  body:has(.crew-app-workspace) .crew-app-frame {
    height:calc(100dvh - var(--portal-mode-height,0px) - 56px - env(safe-area-inset-bottom,0px));
    min-height:160px;
  }
}

@media screen {.crew-app-tabs::-webkit-scrollbar{display:none;}}
