:root { --photo-map-width: calc(var(--workspace-width, 480px) * 2 / 3); }

body.photo-map-open #mapApplication {
  width: calc(100% - var(--photo-map-width));
  transform: translateZ(0);
  overflow: hidden;
  container-type: inline-size;
}
body.photo-map-open #mapApplication .navbar-brand-text { font-size: clamp(18px, 2.6cqw, 28px); }
body.photo-map-open #mapApplication .brand-partner-logo-link { display: none; }
#btnPhotoMap[aria-expanded=true] { background:var(--ui-selected,#e8f0fe); color:var(--ui-link,#164783); border-color:var(--ui-border,#c9d8e9); }
body.then-there-open #btnPhotoMap { visibility: hidden; }

.photo-map-panel {
  --pm-media-inset: 8px;
  --pm-copy-inset: 14px;
  --pm-surface: var(--ui-surface,#fff);
  --pm-base: var(--ui-recess,#f5f7fa);
  --pm-ink: var(--ui-text,#202936);
  --pm-muted: var(--ui-muted,#4e6375);
  --pm-line: var(--ui-border,#d6dfe8);
  --pm-active: var(--ui-selected,#e4eefb);
  --pm-link: var(--ui-link,#164783);
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  width: var(--photo-map-width);
  height: var(--app-height,100dvh);
  max-height: 100dvh;
  box-sizing: border-box;
  background: var(--pm-surface);
  color: var(--pm-ink);
  border-inline-start: 1px solid var(--pm-line);
  box-shadow: -8px 0 32px #10253c21;
  font: 14px/1.45 var(--font-body,system-ui,sans-serif);
}
.photo-map-panel[hidden], .photo-map-panel [hidden] { display: none !important; }
@media (min-width: 701px) {
  html:not(:is([data-app-layout=phone],[data-app-layout=tablet])) body.workspace-open.photo-map-open #mapApplication {
    width: calc(100% - var(--workspace-width) - var(--photo-map-width));
  }
  html:not(:is([data-app-layout=phone],[data-app-layout=tablet])) body.workspace-open.photo-map-open .photo-map-panel {
    right: var(--workspace-width);
  }
}
.photo-map-panel *, .photo-map-panel *::before, .photo-map-panel *::after { box-sizing: border-box; }
.photo-map-panel :is(h2,h3,p) { margin: 0; }
.photo-map-panel button { color: inherit; font: inherit; cursor: pointer; }
.photo-map-panel button:disabled { cursor: default; opacity: .43; }
.photo-map-panel :is(button,a):focus-visible { outline: 2px solid var(--pm-link); outline-offset: 2px; }
.pm-header { display: flex; align-items: center; gap: 9px; min-height: 62px; padding: 9px 14px; border-bottom: 1px solid var(--pm-line); }
.pm-header .pm-heading { flex: 1; font-size: 19px; font-weight: 670; letter-spacing: -.02em; }
.pm-header > .pm-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--pm-active); color: var(--pm-link); }
.pm-icon { display: inline-grid; place-items: center; flex: none; }
.pm-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.pm-icon-button {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent;
}
.pm-icon-button:hover:not(:disabled), .pm-text-button:hover:not(:disabled) { background: var(--pm-active); color: var(--pm-link); }
.pm-icon-button[aria-pressed=true], .pm-icon-button[aria-pressed=mixed], .pm-button[aria-pressed=true] { background: var(--pm-active); color: var(--pm-link); }
.pm-icon-button[aria-pressed=mixed]::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pm-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; padding-block: 15px 20px; padding-inline: var(--pm-media-inset); }
.pm-body > * { flex-shrink: 0; }
.pm-body > :not(.pm-album-grid,.pm-photo-grid,.pm-detail-image) { margin-inline: calc(var(--pm-copy-inset) - var(--pm-media-inset)); }
.pm-heading { font-size: 21px; font-weight: 680; letter-spacing: -.025em; overflow-wrap: anywhere; }
.pm-heading:focus { outline: none; }
.pm-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-height: 28px; color: var(--pm-muted); font-size: 12px; }
.pm-crumbs .pm-icon svg { width: 12px; height: 12px; }
.pm-crumbs .pm-text-button { min-height: 28px; padding: 2px 4px; text-align: start; }
.pm-text-button, .pm-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 34px; padding: 5px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--pm-link); font-weight: 620; }
.pm-text-button .pm-icon svg, .pm-button .pm-icon svg { width: 16px; height: 16px; }
.pm-button { min-height: 38px; border: 1px solid var(--pm-line); background: var(--pm-base); }
.pm-button:hover:not(:disabled) { background: var(--pm-active); color: var(--pm-link); }
.pm-album-grid, .pm-photo-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 9px; row-gap: 13px; }
.pm-album-card, .pm-photo-card { min-width: 0; position: relative; }
.pm-album-open, .pm-photo-open { display: block; width: 100%; padding: 0; border: 0; border-radius: 9px; background: transparent; text-align: start; }
.pm-album-open:hover .pm-album-info strong, .pm-photo-open:hover .pm-photo-name { color: var(--pm-link); text-decoration: underline; }
.pm-album-cover, .pm-photo-thumb, .pm-detail-image { position: relative; display: grid; place-items: center; overflow: hidden; width: 100%; aspect-ratio: 1.22; border-radius: 9px; background: var(--pm-base); color: var(--pm-muted); }
.pm-album-cover > .pm-icon svg, .pm-detail-image > .pm-icon svg { width: 26px; height: 26px; }
.pm-album-cover.is-folder { border-bottom: 3px solid var(--pm-line); }
.pm-album-cover img, .pm-photo-thumb img, .pm-detail-image img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.pm-album-cover.is-folder:has(img + img) img:first-of-type { width: calc(58% - 1px); }
.pm-album-cover.is-folder:has(img + img) img + img { left: 58%; width: 42%; }
.pm-album-info { display: grid; gap: 1px; padding: 7px 8px 0; }
.pm-album-info strong { font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.pm-album-info small { color: var(--pm-muted); font-size: 11px; }
.pm-album-card > .pm-album-toggle, .pm-photo-card > .pm-icon-button, .pm-detail-image > .pm-icon-button {
  position: absolute; top: 5px; right: 5px; z-index: 1;
  width: 33px; height: 33px; border-color: var(--pm-line); background: var(--pm-surface); color: var(--pm-muted); box-shadow: 0 1px 6px #1425392d;
}
.pm-album-card > .pm-album-toggle[aria-pressed=true], .pm-album-card > .pm-album-toggle[aria-pressed=mixed], .pm-photo-card > .pm-icon-button[aria-pressed=true] { background: var(--pm-active); color: var(--pm-link); }
.pm-photo-thumb { aspect-ratio: 1.08; }
.pm-photo-name { display: block; min-width: 0; padding: 5px 8px 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.pm-album-tools, .pm-detail-tools { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pm-album-tools { color: var(--pm-muted); border-bottom: 1px solid var(--pm-line); font-size: 12px; }
.pm-detail-tools { justify-content: start; flex-wrap: wrap; }
.pm-detail-image { min-height: 56px; aspect-ratio: auto; border-radius: 0; }
.pm-detail-image > .pm-icon { position: absolute; inset: 0; }
.pm-detail-image img { position: relative; height: auto; }
.pm-detail-image:focus-visible { outline-offset: -3px; }
.pm-detail-image > .pm-icon-button { top: auto; bottom: 6px; }
.pm-photo-meta, .pm-status { color: var(--pm-muted); font-size: 12px; }
.photo-map-overlay .pm-marker-unplaced { border-color: #db9222; }
.photo-map-overlay .pm-marker-moved { border-color: #fff; }
.photo-map-picking .photo-map-overlay .ws-photo-map-marker { pointer-events: none; }
.pm-photo-original { display: block; border-radius: 9px; }
.pm-status { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pm-footer { flex: none; border-top: 1px solid var(--pm-line); padding: 7px 10px; background: var(--pm-surface); }
.pm-footer-row { display: flex; align-items: center; gap: 3px; }
.pm-footer-row .pm-text-button { padding-inline: 5px; font-size: 12px; white-space: nowrap; }
.pm-map-count { flex: 1; min-width: 0; color: var(--pm-muted); font-size: 12px; }
.pm-placement-footer { display: grid; gap: 4px; padding-block-end: 4px; }
.pm-inline-location-actions, .pm-photo-navigation { display: flex; align-items: center; gap: 5px; }
.pm-inline-location-actions { flex-wrap: wrap; justify-content: flex-end; }
.pm-inline-coordinates { flex: 1; color: var(--pm-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pm-photo-navigation { justify-content: space-between; }
.pm-photo-navigation .pm-text-button { min-height: 34px; padding-inline: 4px; font-size: 12px; }
.pm-photo-navigation [data-pm-focus="next-photo"] .pm-icon { order: 1; }
.photo-map-overlay .photo-map-thumbnail-unavailable img { display: none; }
.photo-map-overlay .photo-map-thumbnail-unavailable::before { content: '▣'; color: #2d3339; }
.pm-edit-button { align-self: flex-start; }
.pm-edit-form { display: grid; gap: 10px; }
.pm-edit-form fieldset { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.pm-edit-location { display: grid; justify-items: start; gap: 6px; padding: 10px; border: 1px solid var(--pm-line); border-radius: 9px; background: var(--pm-base); }
.pm-edit-location small, .pm-edit-coordinates { color: var(--pm-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pm-edit-field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.pm-edit-field :is(input,textarea) { width: 100%; min-height: 38px; padding: 6px 8px; border: 1px solid var(--pm-line); border-radius: 7px; background: var(--pm-surface); color: var(--pm-ink); font: 400 15px/1.4 var(--font-body,system-ui,sans-serif); }
.pm-edit-field textarea { min-height: 76px; resize: vertical; }
.pm-edit-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 8px 0; background: var(--pm-surface); }
.photo-map-panel .pm-save-photo { background: var(--ui-accent,#164783); border-color: transparent; color: var(--ui-accent-ink,#fff); }
.photo-map-panel .pm-save-photo:hover:not(:disabled) { background: color-mix(in srgb,var(--ui-accent,#164783) 86%,var(--pm-ink)); color: var(--ui-accent-ink,#fff); }
.pm-location-overlay { position: absolute; inset: 0; z-index: 301; pointer-events: none; }
.pm-location-pin { position: absolute; width: 38px; height: 48px; padding: 0; border: 0; background: none; transform: translate(-50%,-100%); touch-action: none; cursor: grab; pointer-events: auto; filter: drop-shadow(0 2px 2px #1425396b); }
.pm-location-pin[hidden] { display: none; }
.pm-location-pin:active { cursor: grabbing; }
.pm-location-pin:focus-visible { outline: 2px solid #0e316e; outline-offset: 2px; border-radius: 10px; }
.pm-location-pin svg { display: block; width: 100%; height: 100%; fill: #ca4821; stroke: #fff; stroke-width: 2; }
.pm-location-pin circle { fill: #fff; }
.photo-map-overlay .pm-location-thumbnail { cursor: grab; touch-action: none; }
.photo-map-overlay .pm-location-thumbnail:active { cursor: grabbing; }
.photo-map-overlay .pm-location-thumbnail:disabled { cursor: wait; }
.photo-map-overlay .pm-location-thumbnail[hidden] { display: none; }

.pm-photo-viewer .tt-photo-viewer-header { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 8px; }
.pm-photo-viewer .tt-photo-viewer-header h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-photo-viewer .tt-photo-viewer-close { justify-self: end; }
.pm-photo-viewer .tt-photo-viewer-controls { position: static; transform: none; max-width: none; gap: 3px; padding: 3px; border-radius: 7px; font-size: 13px; }
.pm-photo-viewer .tt-photo-viewer-control { min-width: 32px; min-height: 32px; padding: 3px 6px; }
.pm-photo-viewer .tt-photo-viewer-zoom-level { min-width: 37px; }

@media (prefers-reduced-motion:no-preference) {
  .photo-map-panel:not([hidden]) { animation: workspace-panel-open 220ms cubic-bezier(.2,.8,.2,1) both; }
}
@media (min-width: 681px) {
  html:is([data-app-layout=phone],[data-app-layout=tablet]) body.photo-map-open #mapApplication { width: calc(100% - var(--photo-map-width)) !important; }
}
@media (max-width: 680px) {
  html body.photo-map-open #mapApplication { width: 100%; height: calc(var(--app-viewport-height,100dvh) * .48) !important; }
  .photo-map-panel { inset: auto 0 0; width: 100%; height: calc(var(--app-viewport-height,100dvh) * .52); max-height: 58dvh; border: 0; border-top: 1px solid var(--pm-line); border-radius: 18px 18px 0 0; }
  .pm-header { min-height: 48px; padding-block: 4px; }
  .pm-body { padding-block: 8px 14px; }
  .pm-photo-viewer .tt-photo-viewer-header { column-gap: 5px; padding-inline: 8px; }
  .pm-photo-viewer .tt-photo-viewer-close { padding-inline: 7px; }
  .pm-photo-viewer .tt-photo-viewer-control { min-height: 36px; }
  .pm-album-grid, .pm-photo-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .pm-footer { padding-bottom: max(7px,var(--app-safe-bottom,0px)); }
  .pm-edit-field :is(input,textarea) { font-size: 16px; }
  body.photo-map-open #mobileAppShell :is(.app-bottom-dock,.app-main-view-toggle,.app-map-logo,.app-location-status,.app-centre-cross) { visibility: hidden; }
}

body.photo-menu-open #photoMapPanel {
  inset: var(--pm-menu-top,56px) auto auto var(--pm-menu-left,10px);
  width: min(224px, calc(100vw - 20px));
  height: auto;
  max-height: min(62dvh, 500px);
  border: 1px solid var(--pm-line);
  border-radius: 12px;
  overflow: hidden;
}
.pm-hover-preview {
  position: fixed;
  inset: 56px 12px auto auto;
  z-index: 4900;
  max-width: 30vw;
  margin: 0;
  pointer-events: none;
  color: var(--ui-text);
}
.pm-hover-preview {
  width: max-content;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px #13223933;
}
.pm-hover-preview figcaption { contain: inline-size; overflow-wrap: anywhere; }
.pm-text-preview figcaption { contain: none; }
#photoMapPanel .pm-header { min-height: 44px; padding-block: 4px; }
#photoMapPanel .pm-heading { font-size: 15px; }
#photoMapPanel .pm-album-grid { grid-template-columns: 1fr; gap: 2px; }
#photoMapPanel .pm-album-open {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) 14px;
  align-items: center;
  gap: 8px;
  padding: 6px;
  color: var(--pm-ink);
}
#photoMapPanel .pm-album-open:hover, #photoMapPanel .pm-album-open:focus-visible { background:var(--pm-active); }
#photoMapPanel .pm-album-cover { height: 34px; aspect-ratio:auto; border:0; }
#photoMapPanel .pm-album-info { padding:0; }
.pm-hover-preview :is(img,canvas) { display: block; max-width: 30vw; max-height: 60vh; margin-left: auto; }
.pm-hover-preview figcaption { background: var(--ui-surface); padding: 6px 10px; }
.pm-hover-preview p { margin: 2px 0 0; }
.pm-photo-viewer, .pm-photo-viewer :is(header,.tt-photo-viewer-details,.tt-photo-viewer-controls,button) {
  background: var(--ui-surface,#fff); color: var(--ui-text,#202936);
}
.pm-photo-viewer .tt-photo-viewer-stage { background: var(--ui-recess,#f5f7fa); }

body.photo-menu-open #photoMapPanel {
  width: max-content; max-width: calc(100vw - 16px);
  border: 0; box-shadow: none; background: transparent;
  padding-top: 16px; pointer-events: none;
}
#photoMapPanel::before {
  content: ''; position: absolute; left: var(--pm-root-x,50%); top: 0;
  height: 16px; border-left: 2px solid var(--pm-link);
}
#photoMapPanel .pm-body { padding: 0 3px 4px; gap: 0; pointer-events: auto; }
#photoMapPanel .pm-album-grid {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100px,100%),1fr));
  gap: 0 5px; border-top: 1px solid var(--pm-line);
}
#photoMapPanel .pm-album-card { padding: 10px 0; }
#photoMapPanel .pm-album-card::before, #photoMapPanel .pm-branch-active::after {
  content: ''; position: absolute; left: 50%; top: 0; height: 10px;
  border-left: 1px solid var(--pm-line);
}
#photoMapPanel .pm-branch-active::after { top: auto; bottom: 0; border-color: var(--pm-link); }
#photoMapPanel .pm-album-open {
  height: 100%; grid-template-columns: 1fr; justify-items: center; text-align: center;
  gap: 4px; padding: 6px; border: 1px solid var(--pm-line); background: var(--pm-surface);
}
#photoMapPanel .pm-branch-active > button { border-color: var(--pm-link); background: var(--pm-active); }
#photoMapPanel .pm-album-cover { width: 40px; height: 28px; }
#photoMapPanel .pm-footer:not(:empty), #photoMapPanel .pm-status { pointer-events: auto; background:var(--pm-surface); }
#photoMapPanel:focus { outline:none; }
#photoMapPanel .pm-footer:empty { display: none; }
.photo-map-overlay .ws-photo-map-marker:not(.pm-location-thumbnail) { left: 0; top: 0; }

#photoMapPanel .pm-album-grid { display:flex; flex-wrap:wrap; justify-content:center; gap:0; border:0; }
#photoMapPanel .pm-album-card { position:relative; padding:10px 3px 0; border:0; background:none; }
#photoMapPanel .pm-album-card::before { inset:0 0 auto; width:auto; height:10px; border:0; border-top:1px solid var(--pm-link); background:linear-gradient(var(--pm-link),var(--pm-link)) center / 1px 100% no-repeat; }
#photoMapPanel .pm-branch-active::after { display:none; }
#photoMapPanel .pm-album-open { display:inline-flex; align-items:center; width:auto; height:32px; gap:5px; padding:4px 10px; border-radius:999px; }
#photoMapPanel .pm-album-info strong { font-size:12px; font-weight:550; }
#photoMapPanel .pm-album-cover { flex:none; width:17px; height:17px; border-radius:50%; overflow:hidden; }
#photoMapPanel .pm-album-cover img { width:100%; height:100%; object-fit:cover; }
#photoMapPanel .pm-child-branch { position:relative; width:max-content; max-width:100%; flex-direction:column; align-items:flex-start; padding-top:8px; }
#photoMapPanel .pm-child-branch::before { content:''; position:absolute; top:0; left:0; width:var(--branch-offset); height:8px; border-bottom:1px solid var(--pm-link); border-right:1px solid var(--pm-link); }
#photoMapPanel .pm-child-branch .pm-album-card { padding:3px 0 3px 14px; }
#photoMapPanel .pm-child-branch .pm-album-card::before { inset:0 auto 0 0; width:14px; height:auto; border:0; border-left:1px solid var(--pm-link); background:linear-gradient(var(--pm-link),var(--pm-link)) left center / 100% 1px no-repeat; }
#photoMapPanel .pm-child-branch .pm-album-card:last-child::before { bottom:50%; background-position:left bottom; }

#photoMapPanel .pm-root-albums { width:max-content; flex-wrap:nowrap; }
#photoMapPanel .pm-root-albums > .pm-album-card { flex:none; }
#photoMapPanel .pm-root-albums .pm-album-open { white-space:nowrap; }
.pm-hover-preview.pm-locked {
  pointer-events: auto;
  width: min(24rem, 90vw);
  max-height: 80vh;
  overflow-y: auto;
  background: var(--ui-surface);
}
.pm-locked .pm-edit-form { padding: .75rem; }

.pm-admin-preview { pointer-events: auto; }
