/* PRTMX 5.7 recovery + true squared voxel UI. The broken 5.6 assets
   MUST be disconnected by install.py. No global button/Leaflet selectors. */
body.prtmx-unified-ui{
  --prtmx-ui-header-h:70px!important;
  --prtmx-ui-radius:10px!important;
  --v57-line:#d4e3f0;
  --v57-step:#cfdfee;
  --v57-shadow:0 3px 0 var(--v57-step),0 10px 21px #25466312;
  color:#243f5b;
  /* Header geometry and document padding must agree exactly. */
  padding-top:var(--prtmx-ui-header-h)!important;
  scroll-padding-top:calc(var(--prtmx-ui-header-h) + 10px)!important;
}
body.prtmx-unified-ui > .prtmx-ui-header,
body.prtmx-unified-ui header#prtmx-ui-v52-header{
  height:var(--prtmx-ui-header-h)!important;
  min-height:var(--prtmx-ui-header-h)!important;
  max-height:var(--prtmx-ui-header-h)!important;
  box-sizing:border-box!important;
  border-radius:0!important;
  box-shadow:0 2px 0 #d7e6f2!important;
}
body.prtmx-unified-ui .prtmx-ui-header-inner{
  height:100%!important;
  min-height:0!important;
  box-sizing:border-box!important;
  width:min(1340px,calc(100% - 30px))!important;
  margin:auto!important;
}
body.prtmx-unified-ui .prtmx-ui-logo img{width:170px!important;height:54px!important;object-fit:contain!important;}
body.prtmx-unified-ui .prtmx-ui-brand-label{border-radius:6px!important;box-shadow:0 2px 0 #dae7f1!important;}
body.prtmx-unified-ui .prtmx-ui-top-links a,
body.prtmx-unified-ui .prtmx-ui-top-menu{
  border-radius:6px!important;
  box-shadow:0 2px 0 #d8e6f1!important;
}
body.prtmx-unified-ui .prtmx-ui-top-links a{height:36px!important;min-height:36px!important;box-sizing:border-box!important;}
body.prtmx-unified-ui > .prtmx-ui-dock{
  border-radius:10px!important;
  border:1px solid #cedfec!important;
  box-shadow:0 3px 0 #d0dfed,0 12px 24px #284f6f1f!important;
}
body.prtmx-unified-ui .prtmx-ui-dock :is(a,button){border-radius:6px!important;box-shadow:none!important;}
body.prtmx-unified-ui .prtmx-ui-dock :is(a,button).active{background:#dfeefa!important;}
body.prtmx-unified-ui .prtmx-ui-sheet-panel,
body.prtmx-unified-ui .prtmx-ui-sheet-panel>a,
body.prtmx-unified-ui .prtmx-ui-cookie{border-radius:10px!important;}

/* Home. Do not edit the hero image, only its frame and grid components. */
body.prtmx-unified-ui#prtmxPortalHome .hero{
  border-radius:11px!important;
  overflow:hidden!important;
  margin-top:16px!important;
  border:1px solid var(--v57-line)!important;
  box-shadow:var(--v57-shadow)!important;
}
body.prtmx-unified-ui#prtmxPortalHome :is(.section-card,.feature-card,.section-link,.company-card){
  border-radius:9px!important;
  border:1px solid var(--v57-line)!important;
  box-shadow:var(--v57-shadow)!important;
}
body.prtmx-unified-ui#prtmxPortalHome .company-symbol{
  border-radius:5px!important;
  box-shadow:inset -2px -2px 0 #173e5c25,0 2px 0 #c3d9ea!important;
}

/* Catalog: original DOM order and native rendering preserved. */
body.prtmx-unified-ui[data-prtmx-ui-route="catalog"] :is(#prtmxCatalogTools,.prtmx-company-filters,.prtmx-catalog-tools){
  border-radius:10px!important;
  box-shadow:0 3px 0 #dce8f2!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="catalog"] #prtmxCatalogTools [data-company],
body.prtmx-unified-ui[data-prtmx-ui-route="catalog"] .prtmx-company-filters button{
  border-radius:6px!important;
  padding:8px 12px!important;
  min-height:34px!important;
  border:1px solid #d0e0ec!important;
  box-shadow:0 3px 0 #d5e3ee!important;
  background:linear-gradient(180deg,#fff 0%,#f3f8fc 100%)!important;
  color:#355571!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="catalog"] #prtmxCatalogTools [data-company]:is(.selected,.active,[aria-pressed="true"]),
body.prtmx-unified-ui[data-prtmx-ui-route="catalog"] .prtmx-company-filters button:is(.selected,.active,[aria-pressed="true"]){
  border-color:#89b7db!important;
  background:#dfedf9!important;
  color:#1167a7!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="catalog"] :is(.ship-fleet-item,.ship-fleet-card,.schedule-card,.day-card,.stop-card,.stop-row){
  border-radius:9px!important;
  border:1px solid var(--v57-line)!important;
  box-shadow:var(--v57-shadow)!important;
}

/* Board. Remove previous tight title/badge visual collision with margins;
   never wrap, move, clone or reparent title and badge nodes. */
body.prtmx-unified-ui[data-prtmx-ui-route="board"] :is(.board-row,.board-card,.ship-board-item,.board-ship,.stop-card,.stop-row){
  border-radius:9px!important;
  box-shadow:var(--v57-shadow)!important;
  border:1px solid var(--v57-line)!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] :is(.board-row,.board-card,.ship-board-item,.stop-card,.stop-row)
  :is(.prtmx-brand,.prtmx-company-badge,.ship-company-badge,.brand-badge){
  margin-inline-start:12px!important;
  margin-inline-end:2px!important;
  margin-block:4px!important;
  padding:4px 7px!important;
  border-radius:5px!important;
  vertical-align:middle!important;
  white-space:nowrap!important;
  box-shadow:0 2px 0 #d8e5f0!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] .prtmx-v53-time-pair{
  display:flex!important;
  align-items:center!important;
  flex-wrap:wrap!important;
  gap:5px 12px!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] :is(input,select,button){
  border-radius:7px!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="board"] button{box-shadow:0 2px 0 #d5e4f0!important;}

/* Shared native badges. Do not create duplicates. */
body.prtmx-unified-ui :is(.prtmx-brand,.prtmx-company-badge,.ship-company-badge,.brand-badge){
  border-radius:6px!important;
  vertical-align:middle!important;
  margin-inline-start:8px!important;
  box-shadow:0 2px 0 #dce7ef!important;
}

/* Fleet map: avoid the global selector that inadvertently restyled map
   controls, metadata and independent route map. */
body.prtmx-unified-ui[data-prtmx-ui-route="map"] :is(.prtmx-v54-map-panel,.prtmx-v55-map-panel,.prtmx-v57-map-panel){
  border-radius:9px!important;
  box-shadow:var(--v57-shadow)!important;
  background:#fafdff!important;
  border:1px solid var(--v57-line)!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] :is(.prtmx-v54-map-panel,.prtmx-v57-map-panel) :is(input,button,a){
  border-radius:6px!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v54-map-item{
  border-bottom:1px solid #e0eaf2!important;
  background:#fff!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .leaflet-control-zoom{
  border-radius:7px!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .leaflet-popup-content-wrapper{
  border-radius:8px!important;
}

/* One visual label for ship name and company if both are in the same divIcon.
   The ship glyph and Leaflet marker's position/anchor stay untouched. */
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .leaflet-marker-icon.prtmx-v57-joined{
  overflow:visible!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .leaflet-marker-icon.prtmx-v57-joined > .prtmx-v57-card{
  position:absolute!important;
  top:calc(100% + 6px)!important;
  left:50%!important;
  transform:translateX(-50%)!important;
  width:max-content!important;
  min-width:96px!important;
  max-width:min(204px,48vw)!important;
  border:1px solid #d3e1ec!important;
  border-radius:7px!important;
  padding:6px 8px!important;
  background:rgba(255,255,255,.98)!important;
  box-shadow:0 3px 0 #d9e5ee,0 8px 18px #29476323!important;
  color:#24455f!important;
  text-align:center!important;
  pointer-events:none!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:center!important;
  gap:5px!important;
  line-height:1.25!important;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:normal!important;
  hyphens:none!important;
  z-index:1;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v57-title{
  font:750 12px/1.25 system-ui,-apple-system,'Segoe UI',sans-serif!important;
  word-break:keep-all!important;
  white-space:normal!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v57-company{
  font:650 10px/1.2 system-ui,-apple-system,'Segoe UI',sans-serif!important;
  display:inline-flex!important;
  align-items:center!important;
  gap:5px!important;
  border:1px solid #e2ebf3!important;
  border-radius:5px!important;
  padding:3px 6px!important;
  background:#f3f8fc!important;
  white-space:nowrap!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v57-company::before{
  content:'';
  display:block;
  width:7px;
  height:7px;
  flex:0 0 7px;
  background:var(--prtmx-v57-color,#3e88ba);
  border-radius:2px;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v57-original-hide{display:none!important;}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .leaflet-marker-icon .prtmx-v57-card.prtmx-v57-hidden{visibility:hidden!important;}

/* Detailed route map widget (Статус и маршрут): style its existing panel;
   preserve its position, expanded state, route polyline and all controls. */
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v57-route-panel{
  border:1px solid #d6e3ee!important;
  border-radius:9px!important;
  background:#fbfdff!important;
  box-shadow:0 3px 0 #d7e5ee,0 9px 20px #29496220!important;
  color:#25435d!important;
  overflow:visible!important;
}
body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v57-route-panel :is(button,input,select,a){border-radius:6px!important;}

@media(max-width:700px){
  body.prtmx-unified-ui{--prtmx-ui-header-h:80px!important;}
  body.prtmx-unified-ui > .prtmx-ui-header,
  body.prtmx-unified-ui header#prtmx-ui-v52-header{
    height:var(--prtmx-ui-header-h)!important;
    min-height:var(--prtmx-ui-header-h)!important;
    max-height:var(--prtmx-ui-header-h)!important;
  }
  body.prtmx-unified-ui .prtmx-ui-header-inner{width:calc(100% - 24px)!important;}
  body.prtmx-unified-ui .prtmx-ui-logo img{width:140px!important;height:51px!important;}
  body.prtmx-unified-ui > .prtmx-ui-dock{
    border-radius:9px!important;
    width:calc(100% - 16px)!important;
  }
  body.prtmx-unified-ui .prtmx-ui-dock :is(a,button){border-radius:6px!important;}
  body.prtmx-unified-ui#prtmxPortalHome .hero{
    margin-top:15px!important;
    border-radius:9px!important;
  }
  body.prtmx-unified-ui[data-prtmx-ui-route="catalog"] :is(.ship-fleet-item,.ship-fleet-card){
    border-radius:9px!important;
  }
  body.prtmx-unified-ui[data-prtmx-ui-route="map"] .leaflet-marker-icon.prtmx-v57-joined > .prtmx-v57-card{
    max-width:min(165px,44vw)!important;
    min-width:104px!important;
  }
  body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v57-title{font-size:11px!important;}
  body.prtmx-unified-ui[data-prtmx-ui-route="map"] .prtmx-v57-company{font-size:9.5px!important;}
}
@media(prefers-reduced-motion:reduce){body.prtmx-unified-ui *{transition:none!important;}}
