:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #202123;
  --muted: #6f6f76;
  --line: #dedee3;
  --dark: #202123;
  --green-bg: #edf7ef;
  --green: #16833f;
  --orange-bg: #fff7df;
  --orange: #8a6500;
  --red-bg: #f8f1f0;
  --red: #b42318;
  --gray-bg: #f4f4f5;
  --field-editor-keyboard-offset: 0px;
  --field-editor-keyboard-gap: 0px;
  --field-editor-visible-top: 0px;
  --field-editor-visible-left: 0px;
  --field-editor-visible-width: 100vw;
  --field-editor-visible-height: 100dvh;
  --app-keyboard-offset: 0px;
  --app-keyboard-gap: 0px;
  --app-visible-height: 100dvh;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
}

html.modal-open,
html.modal-open body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html.field-editor-open body > :not(.field-editor-modal) {
  visibility: hidden !important;
}

html.field-editor-open .field-editor-modal {
  visibility: visible !important;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: visible;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 12px;
}

a {
  color: inherit;
}

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 10px auto 28px;
}

.fill-page {
  min-height: auto;
  touch-action: pan-y;
}

.fill-page .step {
  font-size: 10px;
}

.fill-page .step h3 {
  font-size: 12px;
  line-height: 1.25;
}

.fill-page .step h4,
.fill-page .step b {
  margin: 0;
  font-size: 11px;
  line-height: 1.3;
}

.fill-page .step-description,
.fill-page .step p {
  font-size: 10px;
  line-height: 1.35;
}

.fill-page .step label {
  font-size: 10px;
}

.fill-page input,
.fill-page select,
.fill-page textarea {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

.fill-page .step .status {
  padding: 1px 5px;
  font-size: 9px;
}

.fill-page .option-panel,
.fill-page .metric-row,
.fill-page .photo-section {
  gap: 4px;
  padding: 5px;
}

.fill-page .option-panel > h4 {
  min-height: 24px;
  display: flex;
  align-items: center;
}

.fill-scroll-end {
  display: none;
}

.template-scroll-end {
  display: none;
}

.authbar,
.panel,
.card,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.authbar {
  width: min(1120px, calc(100% - 32px));
  margin: 8px auto 0;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.authbar__profile {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 170px;
}

.authbar__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
}

.authbar__users {
  align-self: start;
  white-space: nowrap;
}

.authbar__meta,
.authbar__actions,
.row-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.authbar__nav {
  display: grid;
  grid-template-columns: repeat(var(--auth-nav-count, 3), minmax(0, 1fr));
  gap: 5px;
  flex: 1;
}

.authbar__nav .tab {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.authbar__profile #logoutBtn {
  justify-self: start;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.authbar__profile #logoutBtn:hover {
  color: var(--red);
}

.authbar__name {
  font-weight: 750;
}

.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.18;
}

h2 {
  margin: 0;
  font-size: 14px;
}

h3 {
  margin: 0 0 3px;
  font-size: 13px;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.panel {
  padding: 10px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin: 8px 0;
}

.tab,
.button,
button {
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 4px 8px;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tab.active,
.button.primary,
button.primary {
  background: var(--dark);
  border-color: var(--dark);
  color: #fff;
}

.button.primary:active,
.button.primary:focus-visible,
button.primary:active,
button.primary:focus-visible {
  background: var(--dark);
  border-color: var(--dark);
  color: #fff;
  filter: brightness(.92);
}

.button.press-dark:active,
.button.press-dark:focus-visible {
  background: var(--dark);
  border-color: var(--dark);
  color: #fff;
}

.button.danger,
button.danger {
  color: var(--red);
}

.toolbar,
.filters,
.grid-2,
.grid-3 {
  display: grid;
  gap: 6px;
}

.toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 7px 0;
}

.toolbar #productFilter,
.toolbar #statusFilter {
  grid-column: 1 / -1;
}

.filters,
.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.fill-template-block {
  display: grid;
  gap: 4px;
}

.fill-context {
  display: grid;
  gap: 2px;
  color: var(--text);
  line-height: 1.4;
}

.fill-context > span {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}

.fill-context__label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.fill-context strong {
  font-size: 12px;
  font-weight: 750;
}

.start-timer-button {
  width: 100%;
}

.template-page .stage-add-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 8px 0 0;
}

.template-page .add-stage-bottom {
  width: 100%;
  margin-top: 2px;
}

.stage-time {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.stage-time strong {
  color: var(--text);
  font-size: 11px;
}

.stage-pause-note {
  margin-top: 3px;
  color: var(--orange);
  font-size: 10px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.pause-button {
  border-color: #e1c775;
  background: #fff8dc;
  color: #735b00;
}

.pause-button.is-paused {
  border-color: var(--dark);
  background: var(--dark);
  color: #fff;
}

.stage-pause-history {
  display: grid;
  gap: 5px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.stage-pause-history div {
  padding-left: 7px;
  border-left: 2px solid #e1c775;
}

.stage-pause-history p {
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.nonconformity-list,
.nonconformity-history {
  display: grid;
  gap: 6px;
}

.nonconformity-substage {
  display: grid;
  gap: 6px;
  border: 1px solid #e3aaa5;
  border-radius: 8px;
  padding: 6px;
  background: var(--red-bg);
}

.nonconformity-substage.is-closed {
  border-color: #b8dfc2;
  background: var(--green-bg);
}

.nonconformity-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}

.nonconformity-photo-section {
  background: rgba(255, 255, 255, .72);
}

.nonconformity-history {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.nonconformity-history > div {
  padding-left: 7px;
  border-left: 2px solid var(--red);
}

.nonconformity-history p {
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.modal-section-title {
  margin-top: 10px;
}

.stage-time-card p {
  margin-top: 3px;
}

.step-description {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.summary-single {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  margin: 2px 0 6px;
}

.summary-line {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  row-gap: 2px;
  color: var(--muted);
  line-height: 1.25;
}

.summary-count {
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
}

.summary-line-wide {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.summary-value {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 6px 8px;
  font: inherit;
  outline: none;
}

textarea {
  min-height: 56px;
  resize: vertical;
}

label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.list {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}

.card {
  background: #f4f5f7;
  padding: 8px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 7px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.filled-card-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.filled-card-line span:not(:last-child)::after {
  content: "·";
  margin-left: 6px;
  color: #a7a7ad;
}

.filled-card-main {
  flex: 1 1 auto;
  min-width: 0;
}

.filled-card-title {
  overflow-wrap: anywhere;
}

.product-name-line {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.filled-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.filled-card-details span:not(:last-child)::after {
  content: "·";
  margin-left: 6px;
  color: #a7a7ad;
}

.missing-value {
  color: var(--red);
  font-weight: 750;
}

.card-result {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: 4px;
}

.card-progress-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.card-actions {
  display: grid;
  gap: 5px;
}

.card-actions__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 5px;
}

.status {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 750;
  background: var(--gray-bg);
  color: var(--muted);
}

.status.green {
  background: var(--green-bg);
  border-color: #c9ead2;
  color: var(--green);
}

.status.orange {
  background: var(--orange-bg);
  border-color: #f1dfaa;
  color: var(--orange);
}

.status.red {
  background: var(--red-bg);
  border-color: #e8cac6;
  color: var(--red);
}

.muted {
  color: var(--muted);
}

.empty,
.error {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  color: var(--muted);
}

.error {
  border-style: solid;
  background: var(--red-bg);
  color: var(--red);
}

.step {
  display: grid;
  gap: 6px;
  border: 1px solid #d4d7dd;
  border-radius: 8px;
  padding: 7px;
  background: #f1f2f4;
}

.step-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.step-head > .row-actions {
  align-self: flex-start;
}

.fill-page .step-head > :first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.fill-page .step-head > .row-actions {
  width: 128px;
  flex: 0 0 128px;
  grid-auto-rows: 36px;
}

.fill-page .step-head > .row-actions button {
  width: 100%;
  min-height: 36px;
  height: 36px;
  padding: 3px 5px;
  font-size: 10px;
  line-height: 1.1;
}

.fill-page #steps {
  overflow-anchor: none;
}

.checks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 12px;
}

.checks input {
  width: auto;
}

.switch-list {
  display: grid;
  gap: 5px;
}

.switch-block {
  display: grid;
  gap: 5px;
}

.switch-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fafafa;
  color: var(--text);
  font-weight: 650;
}

.switch-line input {
  appearance: none;
  width: 32px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #e8e8ec;
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
}

.switch-line input::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 1px;
  left: 1px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  transition: transform .15s ease;
}

.switch-line input:checked {
  background: var(--dark);
  border-color: var(--dark);
}

.switch-line input:checked::before {
  transform: translateX(14px);
}

.option-panel,
.metric-list {
  display: grid;
  gap: 6px;
}

.option-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fafafa;
}

.metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 210px) auto;
  align-items: end;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}

.photo-section {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fafafa;
}

.qr-panel {
  gap: 5px;
}

.template-page .qr-panel {
  gap: 4px;
  padding: 5px;
}

.template-page .qr-panel h4 {
  margin: 0;
  min-height: 24px;
  display: flex;
  align-items: center;
  font-size: 11px;
  line-height: 1.2;
}

.template-page .qr-panel label {
  padding: 0;
}

.qr-description {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.qr-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.file-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid #202124;
  border-radius: 8px;
  background: #202124;
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.file-picker:active {
  filter: brightness(0.88);
}

.file-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.photo-section-ok {
  border-color: #b8dfc2;
  background: var(--green-bg);
}

.photo-section-nok {
  border-color: #e8b7b0;
  background: var(--red-bg);
}

.template-page .reference-panel,
.template-page .metrics-panel {
  gap: 4px;
  padding: 5px;
}

.template-page .reference-panel h4,
.template-page .metrics-panel h4 {
  margin: 0;
  min-height: 24px;
  display: flex;
  align-items: center;
  font-size: 11px;
  line-height: 1.2;
}

.template-page .metrics-panel button {
  min-height: 24px;
  padding: 3px 7px;
  font-size: 11px;
  line-height: 1.1;
}

.template-page .metrics-panel > button[data-action="add-metric"] {
  width: 100%;
}

.template-page .metrics-panel .metric-list {
  gap: 5px;
}

.template-page .metrics-panel .metric-row {
  gap: 5px;
  padding: 5px;
}

.template-page .reference-panel .grid-2 {
  gap: 5px;
}

.template-page .reference-panel .photo-section {
  gap: 4px;
  padding: 5px;
}

.step.is-collapsed {
  background: #eef0f3;
}

.stage-progress {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 5px;
}

.stage-progress__item {
  justify-content: space-between;
  min-height: 30px;
  background: #fafafa;
}

.stage-progress__item.active {
  border-color: var(--dark);
  box-shadow: inset 0 0 0 1px var(--dark);
}

.photo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.photo-thumb {
  display: grid;
  justify-items: center;
  gap: 5px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 0 5px;
  background: #fff;
  min-height: 56px;
}

.photo-thumb img,
.photo-thumb video {
  width: 100%;
  height: auto;
  max-height: none;
  display: block;
  object-fit: contain;
  border-radius: 7px 7px 0 0;
}

.photo-thumb img {
  cursor: zoom-in;
}

.photo-thumb button {
  position: static;
  min-width: 110px;
  margin: 0 auto;
  min-height: 22px;
  padding: 2px 6px;
  background: #fff;
}

.fill-page .evidence-grid {
  grid-template-columns: 1fr;
}

.fill-page .evidence-grid .photo-thumb {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 0 0 5px;
  overflow: visible;
}

.fill-page .evidence-grid .photo-thumb img,
.fill-page .evidence-grid .photo-thumb video {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  border-radius: 7px 7px 0 0;
}

.fill-page .evidence-grid .photo-thumb button {
  position: static;
  min-width: 110px;
  margin: 0 auto;
  background: #fff;
}

.fill-page .reference-photo-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.fill-page .reference-photo-section .photo-grid {
  grid-template-columns: 1fr;
}

.fill-page .reference-photo-section .photo-thumb img,
.fill-page .reference-photo-section .photo-thumb video {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}

.fill-page [data-action="validate-step"][data-result="OK"] {
  border-color: #9ed8ad;
  background: var(--green-bg);
  color: var(--green);
}

.fill-page [data-action="validate-step"][data-result="OK"]:active,
.fill-page [data-action="validate-step"][data-result="OK"]:focus-visible {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.fill-page [data-action="validate-step"][data-result="NOK"] {
  border-color: #e3aaa5;
  background: var(--red-bg);
  color: var(--red);
}

.fill-page [data-action="validate-step"][data-result="NOK"]:active,
.fill-page [data-action="validate-step"][data-result="NOK"]:focus-visible {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  max-width: min(640px, calc(100% - 32px));
  background: #202123;
  color: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  display: none;
  z-index: 50;
}

.toast.show {
  display: block;
}

.media-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .86);
  padding: 16px;
  z-index: 80;
  overflow: hidden;
  touch-action: none;
}

.media-lightbox.open {
  display: flex;
}

.media-lightbox-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.media-lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  transform: translate3d(0, 0, 0) scale(1);
  transition: none;
  will-change: transform;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}

.media-lightbox img.is-zoomed {
  cursor: grab;
}

.media-lightbox img.is-zoomed:active {
  cursor: grabbing;
}

.media-lightbox-close {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,.94);
}

.modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: none;
  align-items: stretch;
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(15, 23, 42, .42);
  padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  z-index: 40;
}

.modal.open {
  display: flex;
}

html.keyboard-open .modal.open {
  height: var(--app-visible-height);
}

html.keyboard-open .modal.open .modal-card:focus-within {
  align-self: flex-end;
  height: auto;
  max-height: calc(var(--app-visible-height) - 12px);
  margin: 0 auto max(8px, env(safe-area-inset-bottom));
}

.unsaved-dialog {
  align-items: center;
}

.validation-dialog {
  z-index: 60;
}

.unsaved-dialog .modal-card {
  height: auto;
  max-height: calc(100dvh - 32px);
  flex: 0 1 360px;
  max-width: 360px;
  padding: 8px;
}

.unsaved-dialog .modal-card > .head {
  margin: -8px -8px 4px;
  padding: 8px;
  position: static;
  border-bottom: 0;
}

.unsaved-dialog .modal-card > .head h2 {
  font-size: 15px;
}

.unsaved-dialog .modal-card > p {
  font-size: 11px;
  line-height: 1.35;
}

.unsaved-dialog .form-actions {
  gap: 4px;
  margin-top: 7px;
}

.unsaved-dialog .form-actions button {
  min-height: 24px;
  padding: 3px 7px;
  font-size: 11px;
}

.move-step-dialog .modal-card {
  max-width: 340px;
}

.move-step-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 4px 0 6px;
}

.move-step-dialog label {
  gap: 4px;
  font-size: 11px;
}

.move-step-dialog input {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

.move-step-dialog p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.modal-card {
  width: 100%;
  max-width: 430px;
  height: 100%;
  max-height: none;
  min-height: 0;
  flex: 0 1 430px;
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-width: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  margin: 0 auto;
  padding: 10px;
}

.modal-card::-webkit-scrollbar {
  display: none;
}

.modal-card > .head {
  position: sticky;
  top: -10px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -10px -10px 8px;
  padding: 10px;
  background: var(--panel);
  border-bottom: 0;
}

.modal-card > .head button {
  flex: 0 0 auto;
  margin-left: auto;
}

.qr-scanner-dialog {
  z-index: 70;
}

.qr-scanner-card {
  height: auto;
  max-height: calc(100dvh - 24px);
  flex-basis: 430px;
}

.qr-video-box {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
}

.qr-video-box video {
  display: block;
  width: 100%;
  max-height: 62dvh;
  object-fit: cover;
}

.qr-scanner-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.field-editor-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  z-index: 90;
  display: none;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  padding: 0;
}

.field-editor-modal.open {
  display: block;
}

.field-editor-card {
  width: min(430px, 100%);
  min-height: 0;
  height: auto;
  max-height: none;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 12px 12px;
  transform: translate3d(0, 0, 0);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  background: var(--bg);
  border: 0;
  border-radius: 0;
}

.field-editor-head {
  flex: 0 0 auto;
  padding: 0;
  border-bottom: 0;
}

.field-editor-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.field-editor-body {
  flex: 0 1 auto;
  min-height: 0;
  display: block;
  padding: 0;
  max-height: none;
  overflow: visible;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.field-editor-body input,
.field-editor-body textarea {
  width: 100%;
  min-height: 38px;
  margin: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.4;
}

.field-editor-body textarea {
  min-height: 140px;
  max-height: 240px;
  overflow-y: auto;
  resize: none;
}

.field-editor-actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0;
  border-top: 0;
  background: transparent;
}

.field-editor-actions button {
  min-height: 34px;
}

#modalBody {
  min-height: 0;
}

#shareFallbackModal {
  align-items: center;
}

.share-card {
  align-self: center;
  height: auto;
  max-height: calc(100dvh - 24px);
  flex: 0 1 430px;
  padding: 8px;
}

.share-card > .head {
  position: static;
  margin: -8px -8px 6px;
  padding: 8px;
}

.share-card > .head h2 {
  font-size: 15px;
}

.share-card > .head button {
  min-height: 26px;
  padding: 3px 7px;
  font-size: 11px;
}

.share-card label {
  font-size: 10px;
}

.share-card textarea {
  min-height: 118px;
  max-height: 180px;
  padding: 6px 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.35;
  letter-spacing: 0;
  -webkit-text-size-adjust: 100%;
}

.share-files {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin: 6px 0;
}

.share-file {
  display: grid;
  width: 100%;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: #fafafa;
}

.share-file img,
.share-file video {
  width: 100%;
  height: auto;
  max-height: none;
  display: block;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.share-file .button {
  min-height: 28px;
  padding: 3px 7px;
  font-size: 11px;
}

.share-card .form-actions {
  gap: 4px;
  margin-top: 6px;
}

.share-card .form-actions button {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.login {
  width: min(420px, calc(100% - 32px));
  margin: 8vh auto;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.users-table-wrap {
  overflow-x: hidden;
}

.users-table-wrap table {
  min-width: 0;
  table-layout: fixed;
}

.users-table-wrap th,
.users-table-wrap td {
  padding: 5px 4px;
  overflow-wrap: anywhere;
}

.users-table-wrap th:nth-child(1),
.users-table-wrap td:nth-child(1) {
  width: 45%;
}

.users-table-wrap th:nth-child(2),
.users-table-wrap td:nth-child(2) {
  width: 22%;
}

.users-table-wrap th:nth-child(3),
.users-table-wrap td:nth-child(3) {
  width: 33%;
}

.users-table-wrap .row-actions {
  gap: 4px;
}

.users-table-wrap .row-actions button {
  min-height: 28px;
  padding: 3px 5px;
  font-size: 10px;
  white-space: normal;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 6px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.template-page textarea[data-autosize] {
  min-height: 34px;
  overflow-y: hidden;
  resize: none;
}

.template-page .stage-title-field {
  min-height: 30px;
}

.template-page .step-head > :first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.template-page .step-head > .row-actions {
  width: 124px;
  flex: 0 0 124px;
  gap: 5px;
  grid-auto-rows: 26px;
}

.template-page .step-head > .row-actions button {
  width: 100%;
  min-height: 26px;
  height: 26px;
  padding: 3px 7px;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
}

html {
  scroll-padding-bottom: calc(420px + env(safe-area-inset-bottom));
}

body::after {
  content: "";
  display: block;
  width: 1px;
  height: calc(420px + env(safe-area-inset-bottom));
  pointer-events: none;
}

.wrap,
.authbar {
  width: min(430px, calc(100% - 16px));
}

.wrap {
  margin-bottom: 0;
  padding-bottom: 16px;
}

.fill-scroll-end,
.template-scroll-end {
  display: none;
}

input,
textarea,
button,
.button {
  scroll-margin-bottom: calc(360px + env(safe-area-inset-bottom));
}

input,
select,
textarea {
  font-size: 16px;
}

#search,
#productFilter,
#statusFilter {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  scroll-margin-top: 0;
  scroll-margin-bottom: 8px;
}

.template-page input,
.template-page select,
.template-page textarea,
.check-type-page input,
.check-type-page select,
.check-type-page textarea {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

#login,
#password,
input[autocomplete="username"],
input[autocomplete*="password"] {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  min-height: 34px;
  padding: 5px 8px;
  scroll-margin-bottom: 16px;
}

.admin-users-page input,
.admin-users-page select,
.admin-users-page textarea,
.admin-users-page #login,
.admin-users-page #password {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

html.login-static,
html.login-static body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body.login-page {
  position: fixed;
  inset: 0;
  min-height: 0;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

body.login-page::after {
  display: none;
  height: 0;
}

body.login-page .login {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  width: min(420px, calc(100% - 32px));
  max-height: calc(100dvh - 32px - env(safe-area-inset-top));
  margin: 0;
  overflow: hidden;
  transform: translateX(-50%);
}

.authbar,
.head {
  display: grid;
}

.authbar {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  justify-content: stretch;
}

.panel > .head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.panel > .head #mainAction {
  white-space: nowrap;
}

.authbar__nav {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-self: stretch;
}

.authbar__nav .tab {
  padding-inline: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.tabs,
.toolbar,
.filters,
.grid-2,
.grid-3,
.switch-pair,
.metric-row {
  grid-template-columns: 1fr;
}

.row-actions,
.form-actions {
  display: grid;
  grid-template-columns: 1fr;
}
