/* PRTMX V5.8: board fallback shell + fleet map safe insets.
   No ship positions/routes or native application business logic changes. */
body.prtmx-unified-ui{
  --prtmx-ui-header-h:70px;
  --prtmx-ui-dock-h:76px;
  --v58-frame:#d6e4f0;
  --v58-ink:#23445f;
  --v58-shadow:0 3px 0 #d4e3ee,0 8px 20px rgba(35,77,108,.12);
}
@media(max-width:700px){body.prtmx-unified-ui{--prtmx-ui-header-h:80px!important;--prtmx-ui-dock-h:70px!important}}
/* For board the header and dock are rendered in HTML, so there is no
   dependence on a successful V5.2 Javascript bootstrap. */
body.prtmx-unified-ui[data-prtmx-ui-route="board"]{
  padding-top:var(--prtmx-ui-header-h)!important;
  padding-bottom:calc(var(--prtmx-ui-dock-h) + 35px + env(safe-area-inset-bottom,0px))!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] > header:not(#prtmx-ui-v52-header),
body.prtmx-unified-ui[data-prtmx-ui-route="board"] > .header:not(#prtmx-ui-v52-header),
body.prtmx-unified-ui[data-prtmx-ui-route="board"] > .site-header,
body.prtmx-unified-ui[data-prtmx-ui-route="board"] > .app-header,
body.prtmx-unified-ui[data-prtmx-ui-route="board"] > .topbar,
body.prtmx-unified-ui[data-prtmx-ui-route="board"] > .navbar,
body.prtmx-unified-ui[data-prtmx-ui-route="board"] > nav:not(.prtmx-ui-dock),
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .v2-bottom-nav,
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .bottom-nav,
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .mobile-bottom-nav,
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .footer-nav,
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-v58-native-nav{
  display:none!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-ui-header{
  height:var(--prtmx-ui-header-h)!important;
  min-height:var(--prtmx-ui-header-h)!important;
  max-height:var(--prtmx-ui-header-h)!important;
  background:#f9fcff!important;
  box-shadow:0 2px 0 #dbe7f2!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-ui-header-inner{
  height:100%!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-ui-top-links a,
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-ui-top-menu{
  border-radius:7px!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-ui-dock{
  border-radius:10px!important;
  bottom:calc(7px + env(safe-area-inset-bottom,0px))!important;
  box-shadow:var(--v58-shadow)!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-ui-dock a,
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-ui-dock button{
  border-radius:7px!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-ui-sheet-panel{
  border-radius:10px!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-v58-board-card{
  border:1px solid var(--v58-frame)!important;
  border-radius:9px!important;
  box-shadow:var(--v58-shadow)!important;
  background:#fff!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-v58-company-tag{
  display:inline-flex!important;align-items:center!important;gap:6px!important;
  vertical-align:middle!important;
  padding:3px 7px!important;
  margin:4px 0 4px 10px!important;
  border:1px solid var(--v58-company-line,#b4cddb)!important;
  border-radius:6px!important;
  box-shadow:0 2px 0 #e1eaf2!important;
  background:#f8fbfe!important;
  color:#345a75!important;
  font:650 11px/1.35 system-ui,-apple-system,"Segoe UI",sans-serif!important;
  white-space:nowrap!important;
  max-width:100%!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-v58-company-tag::before{
  content:"";display:inline-block;flex:none;width:8px;height:8px;
  background:var(--v58-company-color,#3580b5);border-radius:2px;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-v53-time-pair{
  display:flex!important;flex-wrap:wrap!important;align-items:center!important;gap:6px 12px!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] :is(input,select,button){border-radius:7px!important}
/* Fleet map overlays must be inside the two permanent navigation bars,
   regardless of Leaflet's own fixed/absolute control layout. */
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v58-map-stats{
  position:fixed!important;
  top:calc(var(--prtmx-ui-header-h) + 11px)!important;
  left:12px!important;right:auto!important;bottom:auto!important;
  max-width:calc(100vw - 24px)!important;
  margin:0!important;transform:none!important;
  display:flex!important;align-items:center!important;flex-wrap:wrap!important;gap:3px!important;
  z-index:2700!important;
  background:rgba(250,253,255,.98)!important;
  border:1px solid #d4e5f0!important;border-radius:7px!important;
  padding:7px 10px!important;
  box-shadow:0 3px 0 #d7e5ef,0 8px 20px #1e4e721b!important;
  color:#3c7080!important;font:600 12px/1.3 system-ui,-apple-system,"Segoe UI",sans-serif!important;
  white-space:normal!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v58-map-panel{
  position:fixed!important;
  left:12px!important;right:auto!important;
  top:auto!important;
  bottom:calc(var(--prtmx-ui-dock-h) + 42px + env(safe-area-inset-bottom,0px))!important;
  width:min(348px,calc(100vw - 24px))!important;
  max-width:calc(100vw - 24px)!important;
  max-height:calc(100dvh - var(--prtmx-ui-header-h) - var(--prtmx-ui-dock-h) - 56px)!important;
  margin:0!important;transform:none!important;
  overflow-y:auto!important;
  z-index:2700!important;
  box-sizing:border-box!important;
  border:1px solid var(--v58-frame)!important;border-radius:9px!important;
  background:rgba(250,253,255,.98)!important;
  box-shadow:0 3px 0 #d7e5ee,0 8px 23px #254b6d29!important;
  scrollbar-width:thin;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v58-map-panel :is(button,input,select,a){border-radius:6px!important;}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v58-map-panel :is(li,.prtmx-v54-map-item){padding:9px 10px!important;border-bottom:1px solid #e7eef4!important;}
@media(max-width:700px){
  body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v58-map-stats{font-size:11px!important;top:calc(var(--prtmx-ui-header-h) + 10px)!important;left:10px!important}
  body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v58-map-panel{
    left:8px!important;bottom:calc(var(--prtmx-ui-dock-h) + 28px + env(safe-area-inset-bottom,0px))!important;
    width:calc(100vw - 16px)!important;max-height:calc(100dvh - var(--prtmx-ui-header-h) - var(--prtmx-ui-dock-h) - 48px)!important;
  }
  body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-v58-company-tag{font-size:10px!important;margin-left:8px!important}
}
/* The board fallback remains usable even if the older shell stylesheet was
   cached incorrectly. These overrides apply to the board route only. */
body.prtmx-unified-ui[data-prtmx-v58-server="1"] > #prtmx-ui-v52-header{
  display:block!important;position:fixed!important;top:0!important;left:0!important;right:0!important;
  z-index:2800!important;border-bottom:1px solid #d8e5f0!important;
  padding:0!important;margin:0!important;
}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] #prtmx-ui-v52-header .prtmx-ui-header-inner{
  display:flex!important;align-items:center!important;gap:13px!important;
  width:min(1340px,calc(100% - 28px))!important;margin:0 auto!important;
}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-logo{display:flex!important;flex:none!important;align-items:center!important;min-width:0!important;}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-logo img{
  display:block!important;width:170px!important;height:54px!important;object-fit:contain!important;
}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-brand-label{
  flex:none!important;padding:5px 9px!important;border:1px solid #d9e5f0!important;
  background:#eff6fc!important;border-radius:6px!important;color:#64809a!important;
  white-space:nowrap!important;font:750 12px/1.2 system-ui,sans-serif!important;
}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-top-links{display:flex;align-items:center;justify-content:flex-end;gap:4px;flex:1;min-width:0;}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-top-links a{
  display:inline-flex;align-items:center;gap:6px;padding:8px 10px;
  text-decoration:none;white-space:nowrap;color:#385674;font:700 12px/1.2 system-ui,sans-serif;
}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-top-links svg{height:16px;width:16px;}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-top-links a.active{background:#e1effa;color:#1e6ea4;}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-top-menu{display:none;place-items:center;flex:none;width:42px;height:42px;margin-left:auto;background:#eef5fb;border:1px solid #d9e5ee;color:#456882;}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-top-menu svg{width:22px;height:22px;}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] > .prtmx-ui-dock{
  position:fixed!important;left:50%!important;transform:translateX(-50%)!important;
  width:min(570px,calc(100% - 24px))!important;
  height:var(--prtmx-ui-dock-h)!important;z-index:2800!important;
  display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;
  padding:6px!important;box-sizing:border-box!important;align-items:center!important;
  background:rgba(250,253,255,.97)!important;border:1px solid #d5e4ef!important;
}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-dock :is(a,button){
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;
  min-width:0;min-height:50px;border:0;padding:5px 2px;background:none;
  text-decoration:none;color:#607c93;font:700 11px/1.2 system-ui,sans-serif;
}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-dock :is(a,button) svg{width:22px;height:22px;}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-dock a.active{background:#e1effa;color:#1e6fa6;}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-sheet[hidden]{display:none!important;}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-sheet:not([hidden]){
  position:fixed!important;inset:0!important;z-index:3100!important;
  display:flex!important;justify-content:center!important;align-items:center!important;
  padding:16px!important;background:rgba(24,51,76,.46)!important;
}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-sheet-panel{
  display:flex;flex-direction:column;gap:8px;max-height:90dvh;overflow-y:auto;
  width:min(420px,100%);padding:16px;background:#fff;border:1px solid #dce8f1;
  border-radius:10px!important;box-shadow:0 18px 55px #15365333;
}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:10px;}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-sheet-panel>a{display:flex;gap:10px;align-items:center;padding:12px 13px;border:1px solid #e0eaf2;border-radius:6px;text-decoration:none;color:#2b526e;background:#f9fcff;}
body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-sheet-panel svg{width:20px;height:20px;}
@media(max-width:1050px){
  body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-top-links{display:none!important;}
  body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-top-menu{display:grid!important;}
}
@media(max-width:700px){
  body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-logo img{width:140px!important;height:50px!important;}
  body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-header-inner{gap:7px!important;width:calc(100% - 24px)!important;}
  body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-brand-label{font-size:10px!important;max-width:calc(100vw - 214px);overflow:hidden;text-overflow:ellipsis;}
  body.prtmx-unified-ui[data-prtmx-v58-server="1"] .prtmx-ui-dock :is(a,button){font-size:10px!important;}
}
