/* MAPENDIUM iPhone startup and navigation hotfix. */
@media (max-width: 900px) {
  :root, body[data-role="FREE"] { --utw-header-height:108px; --mapendium-header-height:108px; }
  body > header.topbar, body[data-role="FREE"] > header.topbar {
    grid-template-areas:"brand actions language" "context context context";
    grid-template-columns:minmax(112px,1fr) auto auto; grid-template-rows:48px 48px;
    gap:4px 8px; height:var(--utw-header-height); padding:5px 10px 7px;
  }
  .topbar > .brand { grid-area:brand; }
  .topbar > .topbar-language { grid-area:language; }
  .topbar > .topbar-context { grid-area:context; }
  body > header.topbar > .topbar-actions { grid-area:actions; }
  .topbar-context:has(.country-navigation) { grid-template-columns:minmax(116px,36%) minmax(0,1fr); gap:6px; width:100%; }
  .territory-switcher-trigger { height:44px; border-radius:9px; }
  .territory-switcher[open]::before { content:""; position:fixed; z-index:2790; inset:0; background:rgba(7,20,28,.58); backdrop-filter:blur(3px); }
  .territory-switcher-menu { position:fixed; z-index:2800; inset:max(8px,env(safe-area-inset-top)) 8px max(8px,env(safe-area-inset-bottom)); width:auto; max-height:none; padding:10px; border-radius:18px; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
  .territory-switcher-menu-header { position:sticky; z-index:2; top:-10px; display:flex; align-items:center; justify-content:space-between; min-height:58px; margin:-10px -10px 4px; padding:10px 12px 8px 16px; border-bottom:1px solid rgba(20,35,45,.12); background:#fffdf8; }
  .territory-switcher-menu-header > strong { color:#14232d; font:600 22px/1.1 Georgia,serif; }
  .territory-switcher-close { display:grid; place-items:center; width:44px; height:44px; padding:0; border:1px solid rgba(20,35,45,.15); border-radius:50%; color:#14232d; background:#f1eadf; font-size:28px; line-height:1; }
  .territory-switcher-search { position:sticky; z-index:2; top:52px; display:grid; gap:5px; padding:7px 4px 10px; background:#fffdf8; }
  .territory-switcher-search > span { color:#68767b; font-size:9px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
  .territory-switcher-search input { width:100%; min-height:48px; padding:0 12px; border:1px solid rgba(20,35,45,.2); border-radius:9px; color:#172731; background:#fff; font:600 16px system-ui,sans-serif; }
  .territory-switcher-country { padding-top:12px; font-size:11px; }
  .territory-switcher-region > summary { min-height:52px; padding:12px; touch-action:manipulation; }
  .territory-switcher-region > summary strong { font-size:16px; }
  .territory-switcher-region-links { margin-left:10px; }
  .territory-switcher-links a { min-height:50px; padding:12px; touch-action:manipulation; }
  .territory-switcher-links a > span { font-size:14px; white-space:normal; }
  .territory-switcher-empty { margin:8px; padding:16px; border-radius:9px; color:#68767b; background:#f1eadf; font-size:13px; text-align:center; }
  body.territory-menu-open > header.topbar { backdrop-filter:none; }
  body.mobile-panel-open > .workspace::before { content:""; position:fixed; z-index:1700; inset:var(--utw-header-height) 0 0; background:rgba(7,20,28,.42); backdrop-filter:blur(2px); }
  .map-shell > .tool-rail > [data-mobile-secondary] { display:none !important; }
  .map-shell > .tool-rail, body[data-role="FREE"] .map-shell > .tool-rail { grid-template-columns:repeat(5,minmax(48px,1fr)); }
  .map-shell > .tool-rail small[data-mobile-label] { font-size:0; }
  .map-shell > .tool-rail small[data-mobile-label]::after { content:attr(data-mobile-label); font-size:8px; }
  body.mobile-panel-open .map-shell > .tool-rail { visibility:hidden; pointer-events:none; }
  .workspace > .panel { position:fixed; z-index:1800; top:auto; right:0; bottom:env(safe-area-inset-bottom); left:0; width:100%; height:min(84dvh,800px); max-height:calc(100dvh - var(--utw-header-height) - 8px - env(safe-area-inset-bottom)); transform:translateY(calc(100% + 24px)); transition:transform .2s ease; border-radius:18px 18px 0 0; box-shadow:0 -18px 50px rgba(7,20,28,.28); }
  .workspace > .panel.is-open { transform:translateY(0); }
  .workspace > .panel:not(.is-open) { visibility:hidden; pointer-events:none; }
  .panel .panel-scroll { padding:58px 17px calc(36px + env(safe-area-inset-bottom)); }
  body > .topbar + .workspace, .workspace { height:calc(100dvh - var(--utw-header-height)); }
}
@media (max-width: 620px) {
  .map-shell > .tool-rail, body[data-role="FREE"] .map-shell > .tool-rail { grid-template-columns:repeat(5,minmax(0,1fr)); }
  .map-shell > .tool-rail > :is(button,a) > small, body[data-role="FREE"] .map-shell > .tool-rail > :is(button,a) > small { font-size:8px; }
}
@media (prefers-reduced-motion: reduce) { .workspace > .panel { transition:none; } }
