.full { width: 100%; margin-top: .7rem; }
.separated { margin-top: 1.25rem; }
.filter-title { margin: .8rem 0 .35rem; font-size: 1rem; }
.search-form { display: grid; gap: .45rem; margin: .75rem 0; }
.search-form label { font-weight: 750; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
.product-list, .position-list { display: grid; gap: .55rem; }
.product-card, .position-card { width: 100%; min-height: 66px; display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; color: #123f60; background: #fff; border: 2px solid #9bb0bf; text-align: left; box-shadow: none; }
.product-card img { width: 56px; height: 56px; flex: 0 0 56px; object-fit: contain; border-radius: .4rem; background: #fff; }
.product-card span { min-width: 0; display: grid; gap: .2rem; }
.product-card strong, .product-card small { overflow-wrap: anywhere; }
.product-card small { font-weight: 600; color: #4d6476; }
.position-list { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
.position-card { min-height: 72px; display: grid; gap: .2rem; }
.position-card strong { font-size: 1.25rem; }
.position-card span { color: #267047; }
.position-card.occupied span { color: #8b4b14; }
.photo-main-button { min-height: 0; padding: .25rem; border: 0; background: #fff; box-shadow: none; }
.photo-main-button img { display: block; width: min(180px, 42vw); height: min(150px, 24vh); object-fit: contain; }
.photo-dialog { width: min(94vw, 720px); max-height: 92vh; padding: .75rem; border: 0; border-radius: 1rem; }
.photo-dialog::backdrop { background: #102a43d9; }
.photo-dialog img { display: block; width: 100%; height: min(76vh, 720px); object-fit: contain; margin-top: .5rem; }
.photo-dialog button { width: 100%; }
.result-card:has(.photo-main-button:not([hidden])) .position { font-size: clamp(2.4rem, 12vw, 5rem); }
@media (max-width: 420px) {
  .search-row { grid-template-columns: 1fr; }
  .search-row button { width: 100%; }
  .position-list { grid-template-columns: 1fr 1fr; }
  .product-card img { width: 48px; height: 48px; flex-basis: 48px; }
}

/* Výsledek skenu vždy zabírá jen skutečně viditelnou výšku prohlížeče. */
body:has(#result-view:not([hidden])) {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
body:has(#result-view:not([hidden])) .app {
  width: min(100%, 50rem);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
body:has(#result-view:not([hidden])) .result-view {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(.35rem, 1.3dvh, .7rem);
  overflow: hidden;
}
.result-top-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: .45rem;
}
.result-card {
  height: 100%;
  min-height: 0;
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.result-card-content {
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-content: safe center;
  gap: clamp(.1rem, .65dvh, .35rem);
}
.result-card-content .position {
  flex: 0 0 auto;
  white-space: nowrap;
}
.result-card-content .product-name {
  max-height: none;
  flex: 0 0 auto;
  overflow: visible;
  margin: clamp(.25rem, 1dvh, .7rem) 0 .1rem;
}
.result-card-content .product-sku,
.result-card-content #result-reason {
  flex: 0 0 auto;
  margin-block: .1rem;
}
.result-card-content .photo-main-button {
  flex: 0 0 auto;
  padding: 0;
}
.result-card-content .photo-main-button img {
  width: min(160px, 40vw);
  height: clamp(48px, 17dvh, 125px);
  object-fit: contain;
}
body:has(#result-view:not([hidden])) .ok-button {
  width: 100%;
  height: 72px;
  min-height: 72px;
  margin: 0;
  flex: none;
}
@media (max-height: 560px) {
  body:has(#result-view:not([hidden])) .app {
    padding-top: .45rem;
    padding-bottom: max(.45rem, env(safe-area-inset-bottom));
  }
  body:has(#result-view:not([hidden])) .result-view { gap: .35rem; }
  .result-top-actions { gap: .3rem; }
  .result-top-actions button { min-height: 48px; padding-block: .35rem; }
  .result-card { padding: .35rem; }
  .result-card-content .photo-main-button img { height: clamp(42px, 13dvh, 72px); }
  .result-card-content .product-name { margin-top: .2rem; font-size: clamp(1rem, 4.5vw, 1.3rem); }
  body:has(#result-view:not([hidden])) .ok-button { height: 64px; min-height: 64px; font-size: 1.7rem; }
}
@media (max-height: 420px) {
  .result-card-content .photo-main-button img { height: 46px; }
  .result-card-content { gap: 0; }
  .result-card-content .product-name { margin-block: .1rem; }
}

.aisle-open-card,
.aisle-create-card { margin-top: .8rem; }
.aisle-open-card h2,
.aisle-create-card h2 { margin: 0 0 .35rem; font-size: 1.25rem; }
.aisle-create-card form { display: grid; gap: .8rem; }
.rack-legend { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0; }
.rack-legend span { padding: .35rem .5rem; border-radius: .45rem; font-size: .85rem; font-weight: 750; }
.legend-missing { color: #4d6476; background: #e8edf1; border: 2px dashed #8a9ba8; }
.legend-free { color: #145c36; background: #d7f2e2; border: 2px solid #3c9664; }
.legend-occupied { color: #8f1e18; background: #ffe1dd; border: 2px solid #bd4036; }
.legend-change { color: #6d4a00; background: #fff0b8; border: 3px solid #e0a400; }
.rack-scroll { width: 100%; overflow-x: auto; padding: 0 0 .65rem; overscroll-behavior-x: contain; }
.rack-grid { --rack-columns: 1; width: max-content; min-width: 100%; display: grid; grid-template-columns: 54px repeat(var(--rack-columns), minmax(58px, 1fr)); gap: .35rem; align-items: stretch; user-select: none; }
.rack-corner,
.rack-column-head,
.rack-level { min-height: 38px; display: grid; place-items: center; color: #3c5365; font-weight: 850; }
.rack-level { position: sticky; left: 0; z-index: 2; min-height: 60px; border-radius: .5rem; background: #dce7ee; box-shadow: 2px 0 0 #f3f7fa; }
.rack-cell { min-width: 58px; min-height: 60px; padding: .3rem; display: grid; place-items: center; align-content: center; gap: .12rem; border-radius: .6rem; box-shadow: none; touch-action: pan-y; }
.rack-cell-spot { font-size: 1rem; font-weight: 900; line-height: 1; }
.rack-cell-state { min-height: 1.2em; font-size: 1rem; line-height: 1; }
.rack-cell.missing { color: #4d6476; background: #edf1f4; border: 2px dashed #8799a6; }
.rack-cell.free { color: #145c36; background: #d7f2e2; border: 2px solid #3c9664; }
.rack-cell.occupied { color: #8f1e18; background: #ffe1dd; border: 2px solid #bd4036; }
.rack-cell.pending-add { color: #124c78; background: repeating-linear-gradient(135deg,#d9eefb,#d9eefb 8px,#bfe2f7 8px,#bfe2f7 16px); border: 3px solid #1677b7; }
.rack-cell.pending-remove { color: #6d4500; background: repeating-linear-gradient(135deg,#fff2be,#fff2be 8px,#ffe38a 8px,#ffe38a 16px); border: 3px solid #d99a00; }
.rack-cell.occupied.pending-remove { color: #8f1e18; background: #ffe1dd; border: 3px double #d99a00; }
.rack-cell.occupied.pending-add { color: #8f1e18; background: #ffe1dd; border: 3px double #1677b7; }
.rack-cell:focus-visible { outline: 4px solid #102a43; outline-offset: 2px; }
.rack-range-controls { display: grid; gap: .55rem; margin-top: .55rem; }
.rack-range-row { display: grid; grid-template-columns: minmax(72px,1fr) minmax(72px,1fr) auto; gap: .45rem; align-items: end; }
.rack-range-row label { display: grid; gap: .2rem; font-weight: 750; }
.rack-range-row input { min-height: 48px; padding: .4rem; text-align: center; }
.rack-occupied { margin-top: .7rem; border: 3px solid #bd4036; }
.rack-occupied p { margin: .3rem 0 .7rem; }
.rack-product-links { display: flex; flex-wrap: wrap; gap: .45rem; }
.rack-product-link { min-height: 48px; display: inline-flex; align-items: center; padding: .55rem .7rem; border: 2px solid #1261a0; border-radius: .6rem; color: #0d568e; background: #edf6fc; font-weight: 800; }
.rack-savebar { position: sticky; z-index: 4; bottom: max(.25rem, env(safe-area-inset-bottom)); display: grid; gap: .45rem; margin-top: .8rem; padding: .7rem; border: 2px solid #8ba4b5; border-radius: .8rem; background: #fff; box-shadow: 0 -.25rem 1rem #102a4324; }
.rack-savebar > strong { text-align: center; font-size: 1.05rem; }
.rack-savebar > div { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
@media (max-width: 380px) {
  .rack-range-row { grid-template-columns: 1fr 1fr; }
  .rack-range-row button { grid-column: 1 / -1; }
}

.product-alt-name { font-size: 1.05rem; line-height: 1.35; margin: .35rem 0; color: #334e68; overflow-wrap: anywhere; }
.location-type-row, .device-strip { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; margin: .8rem 0; }
.location-type-row select { min-height: 48px; flex: 1 1 13rem; }
.device-strip { justify-content: space-between; background: #eaf4fb; border-radius: 12px; padding: .65rem .85rem; font-weight: 700; }
.document-list { display: grid; gap: .65rem; }
.document-card, .document-item-card { width: 100%; min-height: 68px; text-align: left; border: 2px solid #bcccdc; border-radius: 14px; background: #fff; padding: .75rem; display: grid; gap: .25rem; color: #102a43; }
.document-card.open { border-left: 9px solid #c53030; }
.document-card.closed { border-left: 9px solid #2f855a; background: #f0fff4; }
.document-card span, .document-item-card span { font-size: 1.05rem; font-weight: 700; }
.document-card small, .document-item-card small { font-size: .9rem; }
.document-item-card.match { border-left: 9px solid #2f855a; }
.document-item-card.missing { border-left: 9px solid #d69e2e; }
.document-item-card.excess { border: 3px solid #c53030; background: #fff5f5; }
.desktop-upload { margin: 1rem 0; }
.document-item-view { padding-bottom: 6.8rem; }
.document-product-card { height: auto; min-height: 0; margin: .25rem 0 1rem; overflow: visible; }
.document-product-card .result-card-content { min-height: 0; }
.document-total { font-size: clamp(1.65rem,8vw,2.7rem); line-height: 1.05; font-weight: 900; margin: 1rem 0; }
.document-own { min-height: 56px; font-size: 1.5rem; font-weight: 800; text-align: center; }
.document-controls { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: .65rem; margin: 1rem 0; }
.document-controls button { min-height: 62px; font-size: 1.45rem; font-weight: 900; }
.status-title.match { color: #276749; }
.status-title.missing { color: #8b5d00; }
.status-title.excess { background: #c53030; color: #fff; border-radius: 10px; padding: .65rem; }
.warning { background: #fff5f5; border: 2px solid #c53030; border-radius: 10px; padding: .65rem; font-weight: 800; }
.document-item-view .ok-button { position: fixed; left: max(1rem,env(safe-area-inset-left)); right: max(1rem,env(safe-area-inset-right)); bottom: max(.75rem,env(safe-area-inset-bottom)); width: auto; z-index: 5; }
.confirm-dialog { max-width: min(94vw,34rem); border: 0; border-radius: 16px; padding: 1.2rem; box-shadow: 0 16px 50px #102a4355; }
.confirm-dialog::backdrop { background: #102a43aa; }
.confirm-dialog button { min-height: 48px; }
.document-duplicate-actions { display: grid; grid-template-columns: repeat(auto-fit,minmax(9rem,1fr)); gap: .65rem; }
#unpositioned-list .product-card > small { grid-column: 1 / -1; color: #486581; font-weight: 700; }
.position-card small { display: block; color: #486581; }
.filter-disclosure {
  margin: .15rem 0 1rem;
  border: 2px solid #9bb0bf;
  border-radius: .8rem;
  background: #fff;
  overflow: hidden;
}
.filter-disclosure summary {
  min-height: 56px;
  padding: .65rem .8rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .55rem;
  color: #123f60;
  background: #eaf2f7;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
  touch-action: manipulation;
}
.filter-disclosure summary::-webkit-details-marker { display: none; }
.filter-disclosure summary::after {
  content: '⌄';
  font-size: 1.5rem;
  line-height: 1;
  transition: transform .15s ease;
}
.filter-disclosure[open] summary::after { transform: rotate(180deg); }
.filter-disclosure summary strong {
  min-width: 0;
  max-width: min(52vw, 18rem);
  overflow: hidden;
  color: #146c43;
  font-size: .95rem;
  font-weight: 800;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter-disclosure[open] summary {
  border-bottom: 1px solid #bcccdc;
  background: #dcebf4;
}
#position-types {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
  margin: 0;
  padding: .75rem;
}
#position-types .type-choice {
  min-width: 0;
  min-height: 78px;
  padding: .6rem .45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  line-height: 1.18;
  white-space: normal;
  overflow: hidden;
}
#position-types .choice-label {
  width: 100%;
  font-size: clamp(.88rem, 3.7vw, 1rem);
  overflow-wrap: anywhere;
  hyphens: auto;
}
#position-types .choice-count {
  min-width: 2rem;
  padding: .12rem .45rem;
  border-radius: 999px;
  background: #fff;
  color: #486581;
  font-size: .82rem;
  font-weight: 800;
  line-height: 1.3;
}
#position-types .type-choice.current .choice-count {
  background: #146c43;
  color: #fff;
}
.pair input { min-width: 0; }
.label-search-form { margin-bottom: 1rem; }
#label-generate { margin-top: .8rem; }
.document-own, .document-controls button, .document-item-view .ok-button, .device-strip button { min-height: 44px; }
@media (min-width: 800px) {
  .desktop-upload { max-width: 54rem; }
  .document-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .document-item-view { max-width: 38rem; margin: 0 auto; }
  #position-types { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #position-types .choice-label { font-size: 1rem; }
}
@media (min-width: 520px) and (max-width: 799px) {
  #position-types { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
