/* Ekran wyboru magazynu — lekkie, odseparowane poprawki wizualne. */

body:has(#screenWarehouse.active) {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

body:has(#screenWarehouse.active) .app-shell {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

body:has(#screenWarehouse.active) .app-main {
  min-height: calc(100dvh - 126px);
  padding-top: 8px;
  padding-bottom: 8px;
}

#screenWarehouse {
  min-height: calc(100dvh - 168px);
}

.warehouse-login-line {
  margin: 12px 2px 0;
}

.warehouse-login-copy {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  min-width: 0;
}

.warehouse-login-copy .eyebrow {
  margin: 0;
  color: #8fb9f2;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: capitalize;
}

.warehouse-login-copy .eyebrow::after {
  content: ": ";
  white-space: pre;
}

.warehouse-login-copy #teamRole {
  order: 2;
  display: inline-block;
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: lowercase;
}

.warehouse-login-copy #teamRole::first-letter {
  text-transform: uppercase;
}

.warehouse-login-copy #teamRole::after {
  content: " - ";
  white-space: pre;
}

.warehouse-login-copy #teamName {
  order: 3;
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.warehouse-scan-area {
  margin-top: 82px;
  text-align: center;
}

.warehouse-scan-title {
  max-width: 440px;
  margin: 0 auto 34px;
  font-size: 27px;
  line-height: 1.2;
}

.warehouse-scan-btn {
  min-height: 64px;
  margin-top: 0;
  font-size: 18px;
}

.warehouse-manual-details {
  margin-top: 30px;
}

.warehouse-manual-toggle {
  min-height: 42px;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: transparent;
  color: #ef9696;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.warehouse-manual-toggle::-webkit-details-marker {
  display: none;
}

.warehouse-manual-toggle::marker {
  content: "";
}

.warehouse-manual-details[open] .warehouse-manual-toggle {
  background: rgba(239,150,150,.04);
}

.warehouse-manual-form {
  margin-top: 14px;
  text-align: left;
}

.warehouse-manual-form .text-input {
  min-height: 50px;
}

.warehouse-confirm-btn {
  min-height: 46px;
  margin-top: 12px;
  font-size: 14px;
}

#screenWarehouse #logoutBtn {
  min-height: 42px;
  margin-top: auto;
  background: #3a414b;
  border: 1px solid var(--line);
  color: #dce2e8;
  font-size: 14px;
}

/* Aktywna wizyta — zwarty nagłówek bez powielonych kafelków ekipy i magazynu. */
body:has(#screenVisit.active) {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

body:has(#screenVisit.active) .app-shell {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

body:has(#screenVisit.active) .app-main {
  padding-top: 6px;
}

#screenVisit .visit-head {
  margin: 0 2px 14px;
}

.visit-status-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  line-height: 1.2;
}

.visit-status-label {
  color: #8fb9f2;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.visit-status-separator {
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.visit-status-line #visitTeam {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

#screenVisit .visit-id {
  margin: 5px 0 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#screenVisit .visit-warehouse-name {
  margin: 0 0 16px;
  font-size: 30px;
  line-height: 1.05;
}

#screenVisit .action-grid {
  margin-top: 0;
}

#screenVisit .action-card {
  height: 80px;
  min-height: 80px;
  padding: 8px 18px;
}

#screenVisit .action-kicker {
  margin-bottom: 4px;
}

#screenVisit .action-card strong {
  margin-bottom: 0;
}

#screenVisit .action-card small {
  display: block;
  margin-top: 0;
  line-height: 1.05;
}

#screenVisit #finishVisitBtn {
  margin-top: 0;
}

#screenVisit .action-settings {
  background: linear-gradient(145deg, #444b55, #343a42);
  opacity: .55;
  cursor: default;
}

#screenVisit .action-settings:disabled {
  opacity: .55;
}

/* Operacja magazynowa — tylko elementy potrzebne podczas skanowania części. */
body:has(#screenOperation.active) .app-main {
  padding-top: 10px;
}

#screenOperation .operation-head-minimal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 2px 12px;
}

#screenOperation .operation-screen-title {
  margin: 0;
  font-size: 15px;
  letter-spacing: 1.3px;
}

#screenOperation .operation-back-text {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #363d46;
  color: #f4f6f8;
  font-size: 13px;
  font-weight: 800;
}

#screenOperation .operation-tabs-compact {
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 12px;
  padding: 4px;
}

#screenOperation .operation-tab {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
}

#screenOperation .operation-tab > span {
  font-size: 15px;
}

#screenOperation .operation-tab > small {
  font-size: 10px;
  font-weight: 800;
  opacity: .82;
  white-space: nowrap;
}

#screenOperation .operation-add-area {
  margin-bottom: 16px;
}

#screenOperation .operation-scan-btn {
  min-height: 58px;
  margin-top: 0;
  font-size: 17px;
}

#screenOperation .part-manual-details {
  margin-top: 10px;
}

#screenOperation .part-manual-toggle,
#screenOperation .operation-comment-toggle {
  min-height: 42px;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: transparent;
  color: #c8d0da;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

#screenOperation .part-manual-toggle {
  color: #ef9696;
}

#screenOperation .part-manual-toggle::-webkit-details-marker,
#screenOperation .operation-comment-toggle::-webkit-details-marker {
  display: none;
}

#screenOperation .part-manual-toggle::marker,
#screenOperation .operation-comment-toggle::marker {
  content: "";
}

#screenOperation .part-manual-details[open] .part-manual-toggle,
#screenOperation .operation-comment-details[open] .operation-comment-toggle {
  background: rgba(255,255,255,.035);
}

#screenOperation .part-manual-form {
  margin-top: 10px;
}

#screenOperation .part-manual-form .text-input {
  min-height: 50px;
}

#screenOperation .part-manual-confirm {
  min-height: 46px;
  margin-top: 10px;
  font-size: 14px;
}

#screenOperation .operation-list-head {
  margin: 0 2px 8px;
}

#screenOperation .operation-list-head h3 {
  margin: 0;
  font-size: 20px;
}

#screenOperation .operation-empty {
  margin-bottom: 14px;
  padding: 16px 14px;
}

#screenOperation .operation-empty strong {
  margin-bottom: 0;
}

#screenOperation .operation-comment-details {
  margin-top: 14px;
}

#screenOperation .operation-comment-body {
  margin-top: 10px;
}

#screenOperation .operation-comment-body .comment-input {
  min-height: 74px;
}

#screenOperation .operation-review-btn {
  margin-top: 16px;
}

#screenOperation .operation-back-bottom {
  min-height: 44px;
  margin-top: 10px;
  font-size: 14px;
}

.app-signature {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0 4px;
  opacity: .52;
  pointer-events: none;
  user-select: none;
}

.app-signature img {
  display: block;
  width: 100px;
  height: auto;
}

/* Na logowaniu zostawiamy podpis widoczny przy dole, ale bez wpływu na układ. */
body:has(#screenLogin.active) .app-signature {
  position: fixed;
  left: 50%;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 1;
  min-height: 0;
  padding: 0;
  transform: translateX(-50%);
}

/* Na ekranie wyboru magazynu podpis jest widoczny bez przewijania strony. */
body:has(#screenWarehouse.active) .app-signature {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 1;
  min-height: 0;
  padding: 0;
  transform: translateX(-50%);
}

/* Na aktywnej wizycie podpis również jest przypięty do ekranu, bez przewijania strony. */
body:has(#screenVisit.active) .app-signature {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 1;
  min-height: 0;
  padding: 0;
  transform: translateX(-50%);
}

@media (max-height: 650px) {
  .warehouse-scan-area {
    margin-top: 28px;
  }

  .warehouse-scan-title {
    margin-bottom: 18px;
    font-size: 24px;
  }
}
