/* E1-36 QR scan of a rim and E1-38 material shortage (ModHala „skan*”, „brak”). */

/* ---------- E1-36: camera + manual code ---------- */
.fjn-scan { flex-direction: row; align-items: flex-start; gap: var(--fjn-sp-4); max-width: none; }
.fjn-scan__camera {
  position: relative; flex: 1.3; min-width: 0; overflow: hidden;
  height: calc(100dvh - var(--fjn-topbar-h) - 2 * var(--fjn-sp-6)); min-height: 320px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; background: var(--fjn-text);
}
.fjn-scan__camera::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, var(--fjn-placeholder-1) 0 12px, var(--fjn-placeholder-2) 12px 24px);
}
.fjn-scan__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.fjn-scan__camera.is-live .fjn-scan__video { opacity: 1; }
.fjn-scan__frame {
  position: relative; width: 240px; height: 240px; border-radius: 16px;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, .35);
}
.fjn-scan__corner { position: absolute; width: 44px; height: 44px; border: 0 solid var(--fjn-text-inverse); }
.fjn-scan__corner--tl { left: 0; top: 0; border-left-width: 5px; border-top-width: 5px; border-radius: 16px 0 0 0; }
.fjn-scan__corner--tr { right: 0; top: 0; border-right-width: 5px; border-top-width: 5px; border-radius: 0 16px 0 0; }
.fjn-scan__corner--bl { left: 0; bottom: 0; border-left-width: 5px; border-bottom-width: 5px; border-radius: 0 0 0 16px; }
.fjn-scan__corner--br { right: 0; bottom: 0; border-right-width: 5px; border-bottom-width: 5px; border-radius: 0 0 16px 0; }
.fjn-scan__hint {
  position: absolute; left: var(--fjn-sp-4); right: var(--fjn-sp-4); top: var(--fjn-sp-4);
  text-align: center; color: var(--fjn-text-inverse); font-size: 17px; font-weight: var(--fjn-fw-bold);
}
.fjn-scan__torch {
  position: absolute; right: 14px; bottom: 14px; width: 56px; height: 56px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: var(--fjn-text-inverse); cursor: pointer;
}
.fjn-scan__torch[aria-pressed="true"] { background: var(--fjn-text-inverse); color: var(--fjn-text); }
.fjn-scan__torch:disabled { cursor: default; }
.fjn-scan__torch:focus-visible { box-shadow: var(--fjn-focus-btn); outline: none; }

.fjn-scan__side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--fjn-sp-3); }
.fjn-scan__label { font-size: 16px; font-weight: var(--fjn-fw-bold); }
.fjn-scan__entry { display: flex; gap: 10px; }
.fjn-scan__input.fjn-input { flex: 1; height: var(--fjn-ctl-hall); padding: 0 14px; font-size: 18px; border-radius: 8px; }
.fjn-scan__input::placeholder { color: var(--fjn-text-3); }
.fjn-scan__ok.fjn-btn { height: var(--fjn-ctl-hall); padding: 0 20px; font-size: 18px; border-radius: 8px; }

.fjn-scan__result {
  display: flex; flex-direction: column; gap: 10px; padding: var(--fjn-sp-4);
  background: var(--fjn-surface); border: 2px solid var(--fjn-success-700); border-radius: 12px;
}
.fjn-scan__result--wrong { border-color: var(--fjn-danger-700); }
.fjn-scan__verdict { display: flex; align-items: center; gap: 10px; color: var(--fjn-success-700); }
.fjn-scan__verdict b { font-size: 18px; white-space: nowrap; }
.fjn-scan__result--wrong .fjn-scan__verdict { color: var(--fjn-danger-700); }
.fjn-scan__result--wrong .fjn-scan__verdict b { font-size: 20px; }
.fjn-scan__rim { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-family: var(--fjn-font-mono); }
.fjn-scan__pos { font-size: 26px; line-height: 32px; }
.fjn-scan__number { font-size: 20px; }
.fjn-scan__sub { font-size: 15px; line-height: 21px; color: var(--fjn-text-2); }
.fjn-scan__task { font-size: 16px; }
.fjn-scan__rows {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; align-items: baseline; font-size: 16px;
}
.fjn-scan__rows span { color: var(--fjn-text-2); }
.fjn-scan__rows b { font-family: var(--fjn-font-mono); }
.fjn-scan__rows .fjn-scan__scanned { color: var(--fjn-danger-700); }
.fjn-scan__action.fjn-btn { width: 100%; height: 64px; gap: 10px; border-radius: 10px; font-size: 19px; }
.fjn-scan__action--again.fjn-btn { background: var(--fjn-text); color: var(--fjn-text-inverse); }
.fjn-scan__action--again.fjn-btn:hover { background: var(--fjn-nav-hover); color: var(--fjn-text-inverse); }

@media (max-width: 1279px) {
  .fjn-scan__camera { height: calc(100dvh - var(--fjn-topbar-h) - 2 * var(--fjn-sp-6)); }
}
@media (max-width: 767px) {
  .fjn-scan { flex-direction: column; align-items: stretch; }
  .fjn-scan__camera {
    flex: none; min-height: 240px;
    height: calc(100dvh - var(--fjn-topbar-h-m) - var(--fjn-bottomnav-h) - 2 * var(--fjn-sp-4) - var(--fjn-sp-4) - 92px);
  }
  .fjn-scan:has(.fjn-field--error) .fjn-scan__camera { height: calc(100dvh - var(--fjn-topbar-h-m) - var(--fjn-bottomnav-h) - 2 * var(--fjn-sp-4) - var(--fjn-sp-4) - 122px); }
  .fjn-scan__frame { width: 200px; height: 200px; }
  .fjn-scan__side { flex: none; }
  /* With a result the camera shrinks (ModHala: camH 190 px, frame 130 px). */
  .fjn-scan:has(.fjn-scan__result) .fjn-scan__camera { height: 190px; min-height: 0; }
  .fjn-scan:has(.fjn-scan__result) .fjn-scan__frame { width: 130px; height: 130px; }
}

/* ---------- E1-38: material shortage ---------- */
.fjn-shortage { max-width: none; gap: var(--fjn-sp-4); padding-bottom: 0; min-height: calc(100dvh - var(--fjn-topbar-h)); }
.fjn-shortage__head { display: flex; flex-direction: column; gap: 2px; }
.fjn-shortage__eyebrow {
  margin: 0; font-size: 14px; line-height: 20px; font-weight: var(--fjn-fw-bold);
  letter-spacing: .04em; text-transform: uppercase; color: var(--fjn-text-2);
}
.fjn-shortage__title { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 16px; color: var(--fjn-text-2); }
.fjn-shortage__number { font: var(--fjn-fw-bold) 24px/32px var(--fjn-font-mono); color: var(--fjn-text); white-space: nowrap; }
.fjn-shortage__grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--fjn-sp-4); align-items: start; }
.fjn-shortage__card {
  display: flex; flex-direction: column; gap: var(--fjn-sp-4); padding: 18px;
  background: var(--fjn-surface); border: 1px solid var(--fjn-border); border-radius: 12px;
}
.fjn-shortage__label { font-size: 16px; font-weight: var(--fjn-fw-bold); }
.fjn-shortage__label .fjn-field__optional { font-weight: var(--fjn-fw-regular); color: var(--fjn-text-2); }
.fjn-shortage__input.fjn-input { height: var(--fjn-ctl-hall); padding: 0 14px; font-size: 17px; border-radius: 8px; }
.fjn-shortage__qty { display: flex; gap: 10px; align-items: center; }
.fjn-shortage__stepper {
  display: grid; grid-template-columns: 52px 1fr 52px; width: 180px; height: var(--fjn-ctl-hall); overflow: hidden;
  background: var(--fjn-surface); border: 1px solid var(--fjn-border-strong); border-radius: 8px;
}
.fjn-field--error .fjn-shortage__stepper { border: 2px solid var(--fjn-danger-700); }
.fjn-shortage__step { border: 0; background: var(--fjn-bg); font-size: 24px; color: var(--fjn-text); cursor: pointer; }
.fjn-shortage__step:first-child { border-right: 1px solid var(--fjn-border); }
.fjn-shortage__step:last-child { border-left: 1px solid var(--fjn-border); }
.fjn-shortage__step:hover { background: var(--fjn-surface-2); }
.fjn-shortage__count {
  min-width: 0; border: 0; text-align: center; font: var(--fjn-fw-bold) 20px var(--fjn-font-mono);
  appearance: textfield; -moz-appearance: textfield;
}
.fjn-shortage__count::-webkit-inner-spin-button, .fjn-shortage__count::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.fjn-shortage__unit { font-size: 17px; }
.fjn-shortage__toggle { gap: 14px; min-height: var(--fjn-ctl-hall); position: relative; }
.fjn-shortage__toggle .fjn-toggle__input, .fjn-shortage__toggle .fjn-toggle__track { width: 52px; height: 30px; }
.fjn-shortage__toggle .fjn-toggle__track::after { width: 24px; height: 24px; }
.fjn-shortage__toggle .fjn-toggle__input:checked + .fjn-toggle__track::after { left: 25px; }
.fjn-shortage__toggle .fjn-toggle__label { font-size: 17px; }
.fjn-shortage__toggle .fjn-toggle__state { font-size: 16px; }
.fjn-shortage__note.fjn-textarea { min-height: 64px; padding: 12px 14px; font-size: 16px; border-radius: 8px; }
.fjn-shortage__preview { display: flex; flex-direction: column; gap: 10px; }
.fjn-shortage__board {
  display: flex; flex-direction: column; gap: var(--fjn-sp-2); padding: 12px 14px;
  background: var(--fjn-surface); border: 1px solid var(--fjn-border); border-radius: 10px;
  box-shadow: inset 4px 0 0 var(--fjn-warning-700);
}
.fjn-shortage__board-head { display: flex; justify-content: space-between; align-items: center; gap: var(--fjn-sp-2); }
.fjn-shortage__board-head b { font-size: 16px; white-space: nowrap; }
.fjn-shortage__board-head span { font-size: 13px; color: var(--fjn-text-2); white-space: nowrap; }
.fjn-shortage__board-line { font-size: 14px; }
.fjn-shortage__marker {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 10px;
  border-radius: var(--fjn-r-full); background: var(--fjn-warning-100); color: var(--fjn-warning-700);
  font-size: 13px; font-weight: var(--fjn-fw-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fjn-shortage__info { margin: 0; font-size: 14px; line-height: 20px; color: var(--fjn-text-2); }
.fjn-shortage__footer.fjn-form-footer { display: flex; gap: var(--fjn-sp-3); margin-top: auto; }
.fjn-shortage__footer .fjn-btn { height: 64px; padding: 0 22px; border-radius: 10px; font-size: 18px; white-space: nowrap; }
.fjn-shortage__cancel.fjn-btn { flex: 1; background: var(--fjn-surface); border: 2px solid var(--fjn-text); color: var(--fjn-text); }
.fjn-shortage__cancel.fjn-btn:hover { background: var(--fjn-surface-2); color: var(--fjn-text); }
.fjn-shortage__submit.fjn-btn { flex: 2; }

@media (max-width: 767px) {
  .fjn-shortage { min-height: calc(100dvh - var(--fjn-topbar-h-m) - var(--fjn-bottomnav-h)); }
  .fjn-shortage__grid { grid-template-columns: minmax(0, 1fr); }
  .fjn-shortage__title { flex-direction: column; gap: 6px; }
  .fjn-shortage__number { white-space: normal; }
}

/* D124 scan messages (E1-36_T/M_komunikaty) */
.fjn-scan__note { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 10px; }
.fjn-scan__note > .fjn-icon { flex: none; align-self: flex-start; }
.fjn-scan__note-text { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 20px; }
.fjn-scan__note-text b { font-size: 16px; }
.fjn-scan__note--ok { background: var(--fjn-success-100); } .fjn-scan__note--ok b, .fjn-scan__note--ok > .fjn-icon { color: var(--fjn-success-700); }
.fjn-scan__note--wrong, .fjn-scan__note--blocked { background: var(--fjn-danger-100); }
.fjn-scan__note--wrong b, .fjn-scan__note--wrong > .fjn-icon, .fjn-scan__note--blocked b, .fjn-scan__note--blocked > .fjn-icon { color: var(--fjn-danger-700); }
.fjn-scan__note--already { background: var(--fjn-warning-100); } .fjn-scan__note--already b, .fjn-scan__note--already > .fjn-icon { color: var(--fjn-warning-700); }
.fjn-scan__note--unknown { background: var(--fjn-surface-2); }
.fjn-scan__note-btn { flex: none; }
@media (max-width: 767px) { .fjn-scan__note { flex-wrap: wrap; } .fjn-scan__note-btn { margin-left: 34px; } }
