.gama-page-count :is(#mapNotice,#globalNotice,#toast,.session small,.modal-card p) {
  overflow-wrap: anywhere;
}

#countList .item {
  grid-template-columns: minmax(0,1fr) 44px minmax(0,clamp(230px,28vw,315px));
}

#countList .item > div {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

#countList .item input.quantity {
  width: 100%;
  min-inline-size: 0;
  height: 54px;
  font-size: clamp(20px,2.3vw,26px);
  font-variant-numeric: tabular-nums;
}

#mapFilteredItems .map-filtered-list {
  grid-template-columns: minmax(0,1fr);
}

#mapFilteredItems :is(article,article > div,.map-filtered-qty > span) {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

#mapFilteredItems article > div:first-child { align-items: flex-start; }

#mapFilteredItems article > div:first-child > b {
  min-inline-size: 0;
}

#mapFilteredItems article > div:first-child > .badge {
  flex-shrink: 0;
}

#mapFilteredItems .map-filtered-qty {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,132px),1fr));
  gap: 8px;
  margin-block: 10px;
}

#mapFilteredItems .map-filtered-qty b {
  display: block;
  margin-inline-start: 0;
  font-variant-numeric: tabular-nums;
}

.gama-page-count main:has(#mapFront.is-row-view:not(.hidden)) { max-width: 1360px; }

.map-row-viewport {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 16px;
  scrollbar-width: thin;
  background: radial-gradient(ellipse at center, var(--subtle), var(--map-floor));
}

.map-row-viewport:focus-visible {
  outline: 2px solid var(--active-border);
  outline-offset: -2px;
}

.map-row-canvas {
  --row-gap: 18px;
  --rack-min: 252px;
  display: flex;
  align-items: flex-start;
  gap: var(--row-gap);
  padding: 18px 16px 24px;
}

.map-row-rack {
  --fit-width: calc((100% - var(--row-gap) * var(--row-gaps)) / var(--row-slots));
  flex: 0 0 calc(clamp(var(--rack-min), var(--fit-width), 560px) * var(--row-zoom));
  min-width: 0;
  scroll-snap-align: start;
}

.map-row-rack .map-row-rack-link {
  display: block;
  margin: 0 auto 5px;
  min-height: 34px;
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

#mapRowCanvas .map-row-rack-link:hover { background: var(--panel); }
#mapRowCanvas .map-shelf-stage { min-width: 0; }
#mapRowCanvas .map-roof {
  width: 100%; min-width: 0; max-width: 100%;
  margin: 0 0 12px; padding: 0;
  border: 0; border-radius: 0; background: transparent;
}
#mapRowCanvas .map-roof > b {
  margin: 0 0 4px; font-size: 10px; line-height: 1.2; letter-spacing: .05em;
}
#mapRowCanvas .map-roof-boxes {
  gap: 0; overflow: hidden;
  background: var(--subtle); border: 1px solid var(--line);
  border-bottom: 4px solid #59665d; border-radius: 3px;
}
#mapRowCanvas .map-roof-boxes > button {
  min-height: 30px; height: 30px; padding: 1px 2px; gap: 1px;
  background: transparent; border: 0; border-inline-end: 1px solid var(--line); border-radius: 0;
}
#mapRowCanvas .map-roof-boxes > button:last-child { border-inline-end: 0; }
#mapRowCanvas .map-roof-boxes button > span:first-child { font-size: 9px; line-height: 1.1; }
#mapRowCanvas .map-box { gap: 2px; padding: 1px; }
#mapRowCanvas .map-box-number { font-size: 9px; padding: 2px 4px; border-radius: 4px; }
#mapRowCanvas .map-shelf-stage:not(.bins9,.bins6) .map-box-number { font-size: 11px; }
#mapRowCanvas .map-symbol { min-width: 16px; min-height: 16px; padding: 1px 3px; font-size: 10px; border-radius: 5px; }
#mapRowCanvas .map-symbol:is(.map-missing,.map-excess) { font-size: 14px; }
#mapRowCanvas .map-roof .map-symbol { min-width: 13px; min-height: 13px; padding: 0 2px; font-size: 10px; line-height: 1; }
#mapRowCanvas .map-height-label b { font-size: 9px; padding: 1px 3px; }

.map-row-viewport.is-hanger-row125 { scroll-snap-type: none; }
.is-hanger-row125 .hanger-assembly125 { flex: 0 0 max(680px, 100%); }

@media (max-width: 850px) {
  .map-row-canvas { --rack-min: min(320px, calc(100vw - 60px)); --row-gap: 14px; }
  .map-row-viewport { scroll-padding-inline: 12px; }
  .map-row-canvas { padding-inline: 12px; }
  .map-row-rack .map-row-rack-link { min-height: 44px; }
}

@media (max-width: 800px) {
  #countList .item {
    grid-template-columns: minmax(0,1fr) 42px;
    padding: 16px;
    min-height: 0;
  }

  #countList .item input.quantity { grid-column: 1 / -1; }
  #countList .item .note-button { align-self: start; }
}

@media (max-width: 700px) {
  #sessions .session .line {
    display: grid;
    grid-template-columns: minmax(0,1fr);
    justify-items: start;
    gap: 7px;
  }

  #sessions .session .line strong { line-height: 1.35; }
  .gama-page-count .modal-card .actions { flex-wrap: wrap; }

  body.is-shelf-view #mapFront:not(.hidden) {
    display: block;
    box-sizing: border-box;
    height: 100dvh;
    padding: 10px 10px calc(16px + env(safe-area-inset-bottom));
    overflow: auto;
    overscroll-behavior: contain;
  }

  body.is-shelf-view .map-front-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  body.is-shelf-view .map-front-heading,
  body.is-shelf-view #mapShelfSummary {
    margin-block: 10px;
  }

  body.is-shelf-view #mapShelfContext {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.is-shelf-view .map-front-grid {
    display: block;
    height: auto;
  }

  body.is-shelf-view .map-shelf-panel,
  body.is-shelf-view .map-shelf-scroll {
    display: block;
    height: auto;
    min-height: 0;
  }

  body.is-shelf-view #mapPhotoViewport {
    width: 100%;
    height: clamp(220px, 47dvh, 420px);
    overflow: auto;
  }

  body.is-shelf-view .map-shelf-aside {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 10px;
    overflow: visible;
  }

  body.is-shelf-view .map-shelf-aside > .panel {
    margin: 0;
  }
}
@media (max-width: 620px) {
  #overallForm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #overallForm > label { min-width: 0; }
}

@media (max-width: 360px) {
  #overallForm { grid-template-columns: minmax(0, 1fr); }
}
