/* Токены — см. <link href="css/tokens.css"> в HTML до worker.css; единый fingerprint в Docker-сборке. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #1f2937;
  background: #f3f4f6;
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Основной контейнер ── */

.w-app {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem;
}

/* Плавное появление после единовременной отрисовки (см. w-app--employee-restore в worker-core.js) */
#sectionBatch,
#sectionDefectKindPick,
#sectionDefectTasks,
#sectionWorkFlow,
#workDisplay,
#pauseDisplay,
#sectionDefectFinish {
  transition: opacity 0.14s ease-out;
}

.w-app.w-app--employee-restore #sectionBatch,
.w-app.w-app--employee-restore #sectionDefectKindPick,
.w-app.w-app--employee-restore #sectionDefectTasks,
.w-app.w-app--employee-restore #sectionWorkFlow,
.w-app.w-app--employee-restore #workDisplay,
.w-app.w-app--employee-restore #pauseDisplay,
.w-app.w-app--employee-restore #sectionDefectFinish {
  opacity: 0 !important;
  pointer-events: none;
  transition: none !important;
}

/* Страница «Пачка»: выбор пачки не прячем при restore — иначе поле моргает (opacity 0 → снятие класса → fade). */
body[data-worker-page="batch"] .w-app.w-app--employee-restore #sectionBatch {
  opacity: 1 !important;
  pointer-events: auto !important;
}

body[data-worker-page="batch"] #sectionBatch {
  transition: none;
}

/* Страница «Брак»: выбор вида вне карточки — не прячем при restore (как пачка). */
body[data-worker-page="defect"] .w-app.w-app--employee-restore #sectionDefectKindPick {
  opacity: 1 !important;
  pointer-events: auto !important;
}

body[data-worker-page="defect"] #sectionDefectKindPick {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  #sectionBatch,
  #sectionDefectKindPick,
  #sectionDefectTasks,
  #sectionWorkFlow,
  #workDisplay,
  #pauseDisplay,
  #sectionDefectFinish {
    transition: none;
  }
}

/* ── Шапка ── */

.w-header {
  margin-bottom: 1.2rem;
}

.w-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

/* Хаб: обычный заголовок; режим статистики — «← Назад» | «Статистика» | «Выйти» */
.w-head-row--dual {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
}

body.w-stats-mode .w-head-row--dual {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.w-head-slot--start {
  min-width: 0;
}

.w-header__title--stats-center {
  display: none;
  margin: 0;
  min-width: 0;
  text-align: center;
  justify-self: center;
  font-weight: 700 !important;
  color: #0f172a;
}

body.w-stats-mode .w-header__title--stats-center {
  display: block;
}

body.w-stats-mode .w-header__title--hub {
  display: none;
}

.w-stats-back-link {
  display: none;
  padding: 0.25rem 0.35rem;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  color: #2563eb;
  background: transparent;
  font-family: inherit;
  white-space: nowrap;
}

body.w-stats-mode .w-stats-back-link {
  display: inline-flex;
  align-items: center;
}

.w-stats-back-link:hover {
  background: #eff6ff;
}

.w-stats-back-link:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.w-head-actions--end {
  justify-self: end;
}

.w-head-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  max-width: 100%;
}
.w-header__title {
  font-size: 1.3rem;
  margin-bottom: 0;
  min-width: 0;
}

/* ── Общие элементы ── */

.w-section {
  margin-bottom: 1rem;
}

/* Пока открыт список пачек — весь блок пачки выше следующей секции (DOM иначе рисует «Работа с браком» поверх выпадающего списка). Только при открытом списке — карточка брака не «пряталась» постоянно. */
#sectionBatch.section-batch--dropdown-open {
  position: relative;
  z-index: 40;
}

.w-section--hidden {
  display: none;
}

.w-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.w-select, .w-input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  font-size: 15px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  appearance: auto;
}

.w-native-select-dropdown__source {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.w-native-select-dropdown {
  position: relative;
  width: 100%;
}

.w-native-select-dropdown__field {
  position: relative;
  width: 100%;
}

.w-native-select-dropdown__field::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #7b8699;
  border-bottom: 1.5px solid #7b8699;
  transform: translateY(-60%) rotate(45deg);
  pointer-events: none;
}

.w-native-select-dropdown__trigger-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 34px;
  padding: 0.45rem 1.95rem 0.45rem 0.6rem;
  border: 1px solid #d8deea;
  border-radius: 8px;
  background: #fff;
  color: #3a475d;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.w-native-select-dropdown__trigger-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.w-native-select-dropdown__trigger-input:disabled,
.w-native-select-dropdown__trigger-input:read-only {
  color: #94a3b8;
  background: #f8fafc;
  cursor: not-allowed;
}

.w-native-select-dropdown__menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  background: #fff;
  border: 1px solid #d8deea;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
  padding: 0.35rem;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
}

.w-native-select-dropdown.is-open .w-native-select-dropdown__menu {
  display: block;
}

.w-native-select-dropdown__empty {
  padding: 0.45rem 0.35rem;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.w-native-select-dropdown__option {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #1f2937;
  font-size: 13px;
  line-height: 1.25;
  text-align: left;
  padding: 0.4rem 0.5rem;
  min-height: 30px;
  border-radius: 8px;
  cursor: pointer;
  white-space: normal;
}

.w-native-select-dropdown__option:hover {
  background: #f1f5f9;
}

.w-native-select-dropdown__option.is-active {
  background: #e8f0ff;
  color: #1d4ed8;
  font-weight: 600;
}

.w-batch-picker-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
  overflow: visible;
}

.w-batch-picker-row .w-batch-picker {
  flex: 1 1 0;
  min-width: 0;
}

.w-btn--qr-scan {
  flex: 0 0 auto;
  min-width: 3.25rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  font-size: 14px;
}

.w-qr-scan-modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
}

.w-qr-scan-modal.w-section--hidden {
  display: none !important;
}

.w-qr-scan-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.w-qr-scan-modal__panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: min(92vh, 720px);
  margin: 0 auto;
  background: #fff;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
  padding: 0.75rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  z-index: 1;
}

.w-qr-scan-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.w-qr-scan-modal__title {
  font-weight: 700;
  font-size: 1rem;
}

.w-qr-scan-modal__close {
  border: 0;
  background: #e5e7eb;
  color: #374151;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.w-qr-scan-modal__video-wrap {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
  aspect-ratio: 4 / 3;
  max-height: 52vh;
}

.w-qr-scan-modal__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.w-qr-scan-modal__canvas {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.w-qr-scan-modal__hint {
  font-size: 13px;
  line-height: 1.35;
  color: #4b5563;
}

.w-qr-scan-modal__status {
  font-size: 13px;
  line-height: 1.35;
  color: #1d4ed8;
  min-height: 1.35em;
}

.w-qr-scan-modal__fallback {
  margin-top: 0.5rem;
}

.w-qr-scan-modal__file-btn {
  width: 100%;
  margin-top: 0.15rem;
  background: #e8f0ff;
  color: #1d4ed8;
  border: 1px solid #c7d7f8;
}

.w-batch-picker {
  position: relative;
  /* Выше следующих карточек при перекрытии; не поднимать весь #sectionBatch — иначе карточка брака оказывается под слоем и «пропадает». */
  z-index: 8;
  min-width: 0;
}

.w-batch-picker.w-batch-picker--open {
  z-index: 2000;
  background: transparent;
  overflow: visible;
}

/* Иначе .w-batch-list (z-index:300) перекрывает инпут — на таче не вводится текст */
.w-batch-picker--open > .w-select {
  position: relative;
  z-index: 500;
}

.w-batch-picker .w-select {
  width: 100%;
  min-width: 0;
  touch-action: auto;
  user-select: text;
  -webkit-user-select: text;
  caret-color: auto;
}

/* Список привязан к полю (не fixed к краю экрана — на телефоне иначе «узкая полоска» слева) */
.w-batch-list {
  --w-batch-row-visible: 10;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 300;
  box-sizing: border-box;
  background: #fff;
  background-clip: padding-box;
  border: 1px solid #d8deea;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(28, 39, 60, 0.14);
  margin-top: 0;
  isolation: isolate;
  /* Высоту задаёт JS через --w-batch-max-h; fallback до первого layout */
  max-height: var(
    --w-batch-max-h,
    min(40vh, calc(var(--w-batch-row-visible) * (1.25 * 13px + 0.8rem) + 0.5rem))
  );
  overflow: hidden;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 0.2rem;
}

/* Только десктоп (см. useWorkerBatchFloatingLayer в worker-core.js); на touch — absolute под полем */
.w-batch-list.w-batch-list--floating {
  position: fixed;
  right: auto;
  z-index: 2000;
}

.w-batch-option {
  width: 100%;
  border: 0;
  background: #fff;
  text-align: left;
  font-size: 13px;
  line-height: 1.25;
  color: #1f2937;
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
}

.w-batch-option:hover {
  background: #f1f5f9;
}

.w-batch-option--assigned {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

.w-batch-status {
  margin-top: 0.35rem;
  font-size: 12px;
  color: #64748b;
}

.w-batch-status:empty {
  display: none;
}

.w-batch-empty {
  padding: 0.42rem 0.5rem;
  font-size: 12px;
  color: #6b7280;
}

.w-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.w-row .w-input {
  flex: 1;
}

.w-btn {
  padding: 0.7rem 1.2rem;
  font-size: 15px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.w-btn--primary {
  background: #2563eb;
  color: #fff;
}
.w-btn--primary:active {
  background: #1d4ed8;
}

.w-btn:not(.w-btn--primary) {
  background: #e5e7eb;
  color: #374151;
}

.w-btn:not(.w-btn--primary):active {
  background: #d1d5db;
}

/* ── Карточка информации о пачке ── */

.w-info-card {
  background: #fff;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.w-info-card--defect-inner {
  box-shadow: none;
  padding-top: 0.35rem;
}
.w-info-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f3f4f6;
}
.w-info-row:last-child { border-bottom: none; }
.w-info-label {
  color: #6b7280;
  font-size: 0.9rem;
}
.w-info-value {
  font-weight: 600;
  font-size: 0.9rem;
}

/* ── Сворачиваемая карточка пошива ── */

.w-workflow-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  contain: layout;
}

.w-workflow-card__head {
  border-bottom: 1px solid #f3f4f6;
}

/* В свёрнутом виде без полосы под заголовком и без «хвоста» от тела grid */
.w-workflow-card--collapsed .w-workflow-card__head {
  border-bottom: none;
}
.w-workflow-card--collapsed .w-workflow-card__body-inner {
  padding: 0;
  min-height: 0;
}

.w-workflow-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: none;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: #1f2937;
  min-height: 48px;
}

.w-workflow-toggle:hover {
  background: #f9fafb;
}

.w-workflow-toggle:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.w-workflow-toggle__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  flex-shrink: 0;
  font-size: 0.7rem;
  color: #6b7280;
  line-height: 1;
}

.w-workflow-toggle__chevron::before {
  content: "▼";
}

.w-workflow-card--collapsed .w-workflow-toggle__chevron::before {
  content: "▶";
}

.w-workflow-card .w-workflow-toggle__label {
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1.25;
}

/* Развёрнутая шапка — тот же масштаб текста, что у свёрнутой; чуть плотнее, чем базовый toggle */
.w-workflow-card:not(.w-workflow-card--collapsed) .w-workflow-toggle {
  padding: 0.48rem 0.85rem;
  min-height: 0;
  gap: 0.4rem;
}

.w-workflow-card:not(.w-workflow-card--collapsed) .w-workflow-toggle__chevron {
  width: 1.1rem;
  font-size: 0.64rem;
}

/* Компактная шапка в свёрнутом виде */
.w-workflow-card--collapsed .w-workflow-toggle {
  padding: 0.38rem 0.75rem;
  min-height: 0;
  gap: 0.35rem;
}

.w-workflow-card--collapsed .w-workflow-toggle__chevron {
  width: 1.05rem;
  font-size: 0.62rem;
}

.w-workflow-card.w-workflow-card--collapsed {
  margin-bottom: 0.5rem;
}

/* Плавное сворачивание: grid 0fr / 1fr вместо display:none (без рывка макета). */
.w-workflow-card__body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  min-height: 0;
}

.w-workflow-card--collapsed .w-workflow-card__body {
  grid-template-rows: 0fr;
  pointer-events: none;
  border: none;
  margin: 0;
  padding: 0;
  min-height: 0;
}

/* Пока JS выставляет свёрнутость после загрузки/смены сотрудника — без анимации, иначе экран «дёргается». */
.w-workflow-card.w-workflow-card--suppress-body-transition .w-workflow-card__body {
  transition: none !important;
}

.w-workflow-card__body-inner {
  min-height: 0;
  overflow: hidden;
  padding: 0 0.55rem 0.45rem;
}

.w-workflow-card__body-inner > .w-section {
  margin-bottom: 0.62rem;
}

.w-workflow-card__body-inner > .w-section:last-child {
  margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  .w-workflow-card__body {
    transition: none;
  }
}

/* ── Кнопки оборудования ── */

.w-equip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.w-equip-btn {
  padding: 0.7rem;
  font-size: 15px;
  font-weight: 600;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.w-equip-btn:active {
  transform: scale(0.97);
}
.w-equip-btn--active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

/* ── Список операций (радио) ── */

.w-ops-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Пошив «В работе»: блокируем клики по строке (label), иначе на мобильных чекбокс дёргается в обход disabled. */
.w-ops-list.w-sew-ops--freeze-select .w-op-item {
  pointer-events: none;
}
.w-ops-list.w-sew-ops--freeze-select .w-op-item__video-btn {
  pointer-events: auto;
  cursor: pointer;
}

.w-op-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.8rem;
  background: #fff;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.15s;
}
.w-op-item--selected {
  border-color: #2563eb;
  background: #eff6ff;
}
.w-op-item input[type="radio"],
.w-op-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  max-width: 16px;
  max-height: 16px;
  box-sizing: border-box;
  accent-color: #2563eb;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Чужая в работе/на паузе и выполненные: серый чекбокс, белая галочка (не нативный чёрный штрих) */
.w-op-item--sew-checkbox-grey input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  max-width: 16px;
  max-height: 16px;
  box-sizing: border-box;
  border: 1.5px solid #cbd5e1;
  border-radius: 3px;
  background: #e2e8f0;
  flex-shrink: 0;
  vertical-align: middle;
  cursor: not-allowed;
  accent-color: transparent;
}
.w-op-item--sew-checkbox-grey input[type="checkbox"]:checked {
  background-color: #94a3b8;
  border-color: #7c8a9a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 L4.8 8.5 L9.5 3.2' stroke='%23ffffff' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-size: 10px 10px;
  background-position: center;
  background-repeat: no-repeat;
}

/* Своя сессия на паузе по этой операции: синий активный вид (снятие блокируется в JS) */
.w-op-item--own-paused-bundle input[type="checkbox"] {
  accent-color: #2563eb;
  opacity: 1;
}
.w-op-item__text {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.w-op-item__meta-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  flex-shrink: 0;
}
.w-op-item__meta {
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
}
.w-op-item__debug-hms {
  font-size: 0.78rem;
  color: #0369a1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.w-op-item__debug-hms--paused {
  color: #6b7280;
}
.w-op-item__debug-pause-hms {
  font-size: 0.78rem;
  color: #b45309;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.w-op-item__video-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.w-op-item__video-btn:hover,
.w-op-item__video-btn:focus-visible {
  background: #f3f4f6;
  color: #374151;
  outline: none;
}
.w-op-item__video-icon {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}

/* Модалка видео операции (карточка сотрудника) */
.w-video-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-sizing: border-box;
  background: transparent;
}
.w-video-modal.w-section--hidden {
  display: none;
}
.w-video-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  border-radius: 0;
}
.w-video-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  isolation: isolate;
}
.w-video-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  background: #1e293b;
  color: #f8fafc;
}
.w-video-modal__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 0.25rem;
}
.w-video-modal__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.w-video-modal__close:hover {
  background: rgba(255, 255, 255, 0.1);
}
.w-video-modal__body {
  background: #000;
}
.w-video-modal__player {
  display: block;
  width: 100%;
  max-height: min(72vh, 520px);
  vertical-align: middle;
}

/* ── Прогресс операций ── */

.w-progress-bar {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1d4ed8;
}

.w-order-ready-note {
  margin-top: 0.5rem;
  background: #ecfdf3;
  border: 1px solid #b7efcf;
  color: #0f8a4b;
  border-radius: 10px;
  padding: 0.58rem 0.8rem;
  font-size: 0.9rem;
  line-height: 1.3;
}

.w-admin-pause-note {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.35;
}

.w-defect-reminder {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  border-radius: 10px;
  padding: 0.62rem 0.78rem;
  margin-bottom: 0.55rem;
  font-size: 0.88rem;
  line-height: 1.3;
}

.w-defect-reminder-line + .w-defect-reminder-line {
  margin-top: 0.5rem;
}

/* ── Бейджи статуса операций ── */

.w-op-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}
.w-op-badge--done {
  background: #dcfce7;
  color: #15803d;
}
.w-op-badge--busy {
  background: #fef9c3;
  color: #a16207;
}
.w-op-badge--paused {
  background: #fee2e2;
  color: #b91c1c;
}

.w-op-item--disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.w-op-item--unavailable {
  opacity: 0.55;
}
.w-op-item--disabled input[type="radio"],
.w-op-item--disabled input[type="checkbox"] {
  cursor: not-allowed;
}

/* Имя швеи (чужая сессия) сразу после названия операции */
.w-op-item__worker-name {
  display: inline;
  font-size: 0.88em;
  font-weight: 500;
  color: #94a3b8;
}

/* ── Дисплей времени в работе ── */

.w-work-display {
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  color: #0e7490;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  text-align: center;
  font-size: 14px;
  margin-bottom: 0.55rem;
}
.w-work-icon {
  margin-right: 0.3rem;
}

.w-timer-main {
  white-space: nowrap;
}

.w-timer-kind {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  margin-left: 0.45rem;
  vertical-align: middle;
  background: rgba(14, 116, 144, 0.14);
  color: #0c4a6e;
}
.w-pause-display .w-timer-kind {
  background: rgba(146, 64, 14, 0.12);
  color: #78350f;
}
.w-timer-kind.w-timer-kind--defect {
  background: rgba(127, 29, 29, 0.14);
  color: #7f1d1d;
}
.w-pause-display .w-timer-kind.w-timer-kind--defect {
  background: rgba(127, 29, 29, 0.12);
  color: #7f1d1d;
}

/* ── Дисплей паузы ── */

.w-pause-display {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  text-align: center;
  font-size: 14px;
  margin-bottom: 1rem;
}
.w-pause-icon {
  margin-right: 0.3rem;
}

/* ── Встроенное завершение операции ── */

.w-finish-card {
  background: #fff;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #fee2e2;
}

.w-finish-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: #991b1b;
}

.w-finish-hint {
  color: #6b7280;
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.w-finish-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.w-finish-actions .w-btn {
  flex: 0 1 calc(50% - 32px);
  padding: 0.6rem 0.7rem;
  min-width: 0;
}

.w-finish-or {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.w-finish-partial {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.w-finish-partial .w-input {
  flex: 1;
  min-width: 0;
}

.w-finish-cancel {
  width: 100%;
  padding: 0.55rem 0.7rem;
}

/* ── Статистика сотрудника ── */

.w-stats-top {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.w-stats-top .w-input {
  flex: 1;
  width: 100%;
}

.w-stats-head {
  margin-bottom: 0.55rem;
}

.w-stats-active {
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  color: #0e7490;
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.55rem;
  font-size: 0.88rem;
}

.w-table-wrap {
  background: #fff;
  border-radius: 10px;
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.w-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.w-table th,
.w-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  white-space: nowrap;
}

.w-table th {
  background: #f9fafb;
  color: #4b5563;
}

.w-table tbody tr:last-child td {
  border-bottom: none;
}

.w-pagination {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.55rem;
  flex-wrap: wrap;
}

.w-page-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  border-radius: 6px;
  padding: 0.22rem 0.48rem;
  font-size: 12px;
  cursor: pointer;
}

.w-page-btn--active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.w-defect-title {
  margin-bottom: 0.5rem;
}

.w-defect-tabs {
  display: flex;
  gap: 0.22rem;
  flex-wrap: wrap;
  margin-bottom: 0;
  position: relative;
  z-index: 2;
}

.w-defect-tab {
  border: 1px solid #cfd8ea;
  border-bottom: none;
  background: #f4f7ff;
  color: #52627d;
  border-radius: 10px 10px 0 0;
  padding: 0.3rem 0.62rem 0.34rem;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  min-height: 30px;
  box-shadow: 0 -1px 0 #eef3ff inset;
}

.w-defect-tab.is-active {
  background: #fff;
  border-color: #93b2ff;
  border-bottom: 1px solid #fff;
  color: #1d4ed8;
  font-weight: 600;
  transform: translateY(1px);
}

.w-defect-tab:hover:not(.is-active) {
  background: #edf3ff;
  border-color: #b9c9e8;
}

.w-defect-body {
  margin-top: 0;
  color: #475569;
  display: grid;
  gap: 0.32rem;
  border: 1px solid #93b2ff;
  border-radius: 0 10px 10px 10px;
  background: #fff;
  padding: 0.62rem 0.68rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.w-defect-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.45rem;
  align-items: start;
}

.w-defect-key {
  color: #64748b;
  font-size: 12px;
}

.w-defect-value {
  color: #0f172a;
  font-size: 13px;
  font-weight: 500;
}

.w-defect-done {
  margin-top: 0.5rem;
  font-size: 14px;
  font-weight: 700;
  color: #16a34a;
}

/* ── Отступ под футер ── */

.w-spacer {
  height: 20px;
}

/* ── Фиксированный футер ── */

.w-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 0;
  background: #fff;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.w-footer__btn {
  min-width: 0;
  flex: 1;
  padding: 1rem;
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: opacity 0.15s;
}
.w-footer__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.w-footer__btn--start {
  background: #16a34a;
  color: #fff;
}
.w-footer__btn--start:active:not(:disabled) {
  background: #15803d;
}
.w-footer__btn--pause {
  background: #f59e0b;
  color: #fff;
}
.w-footer__btn--pause:active:not(:disabled) {
  background: #d97706;
}
.w-footer__btn--finish {
  background: #dc2626;
  color: #fff;
}
.w-footer__btn--finish:active:not(:disabled) {
  background: #b91c1c;
}

/* ── Адаптивность ── */

@media (max-width: 380px) {
  .w-app {
    padding: 0.5rem 0.55rem;
  }
  .w-footer__btn {
    min-height: 44px;
  }
}

@media (max-width: 600px) {
  .w-app {
    padding: 0.75rem;
  }
  .w-head-row:not(.w-head-row--dual) {
    align-items: flex-start;
  }
  .w-head-row:not(.w-head-row--dual) .w-head-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .w-op-item__meta-row {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .w-op-item__meta {
    width: auto;
    margin-left: 0;
  }
  .w-finish-actions,
  .w-finish-partial {
    flex-direction: column;
  }
  .w-finish-actions .w-btn,
  .w-finish-partial .w-btn,
  .w-finish-partial .w-input {
    width: 100%;
  }
  .w-header__title {
    font-size: 1.1rem;
  }
  .w-equip-grid {
    grid-template-columns: 1fr;
  }
  .w-footer__btn {
    padding: 0.75rem;
    font-size: 14px;
  }
}

@media (max-width: 900px) {
  .w-app {
    max-width: 100%;
    padding: 0.8rem;
  }
  .w-section,
  .w-workflow-card,
  .w-info-card,
  .w-progress-bar,
  .w-finish-card,
  .w-stats-active,
  .w-table-wrap {
    width: 100%;
    min-width: 0;
  }
  .w-btn {
    width: 100%;
  }
  /* Иначе кнопка QR в строке с пачкой съедает всю ширину и поле ввода схлопывается */
  .w-batch-picker-row > .w-btn {
    width: auto;
    flex: 0 0 auto;
    align-self: stretch;
  }
}

/* ============================================================
   Тема classic-plus (только внешний вид)
   ============================================================ */

:root {
  --w-bg: #f5f6fa;
  --w-card: #ffffff;
  --w-border: #e5e9f2;
  --w-text: #1f2937;
  --w-muted: #6b7280;
  --w-primary: #0168fa;
  --w-primary-strong: #0050c7;
  --w-shadow: 0 10px 24px rgba(28, 39, 60, 0.06);
}

body {
  font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
  color: var(--w-text);
  background: var(--w-bg);
}

.w-app {
  max-width: 640px;
}

.w-header__title {
  font-weight: 600;
  color: #1f2a44;
}

.w-select,
.w-input {
  border: 1px solid #d8deea;
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.w-select:focus,
.w-input:focus {
  outline: none;
  border-color: #9fc0ff;
  box-shadow: 0 0 0 3px rgba(1, 104, 250, 0.12);
}

.w-btn {
  border-radius: 8px;
}

.w-btn--primary {
  background: var(--w-primary);
}

.w-btn--primary:active {
  background: var(--w-primary-strong);
}

.w-info-card,
.w-table-wrap,
.w-finish-card {
  background: var(--w-card);
  border: 1px solid var(--w-border);
  border-radius: 12px;
  box-shadow: var(--w-shadow);
}

.w-info-label,
.w-op-item__meta,
.w-finish-hint {
  color: var(--w-muted);
}

.w-equip-btn {
  border-color: #d7deeb;
  border-radius: 10px;
}

.w-equip-btn--active {
  border-color: var(--w-primary);
  color: var(--w-primary);
  background: #ecf3ff;
}

.w-op-item {
  border: 1px solid #dfe6f2;
  border-radius: 10px;
}

.w-op-item--selected {
  border-color: #9fc0ff;
  background: #f2f7ff;
}

.w-op-item input[type="radio"] {
  accent-color: var(--w-primary);
}

.w-progress-bar {
  background: #eef4ff;
  border: 1px solid #d6e4ff;
  color: #2358b7;
}

.w-stats-active {
  background: #eef4ff;
  border-color: #d6e4ff;
  color: #2358b7;
}

.w-table th {
  background: #f9fafc;
  color: #5b6678;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.w-page-btn {
  border: 1px solid #d7deeb;
}

.w-page-btn--active {
  background: var(--w-primary);
  border-color: var(--w-primary);
}

.w-footer {
  border-top: 1px solid #e6ebf4;
  box-shadow: 0 -10px 24px rgba(28, 39, 60, 0.08);
}

/* Кнопка «Статистика» в шапке (не хаб): id перебивает классы, на хабе только .w-hub-nav__btn */
body:not(.w-body--hub) #btnStats {
  padding: 0.4rem 0.8rem;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #d8deea;
  border-radius: 8px;
  color: #4b5563;
  background: #fff;
  font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
}

body:not(.w-body--hub) #btnStats:hover {
  background: #f5f8ff;
  border-color: #c8d6f2;
}

/* «Выйти» — тот же визуальный язык, что «← Назад» на подстраницах карточки сотрудника */
#btnLogout {
  padding: 0.25rem 0.35rem;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  color: #2563eb;
  background: transparent;
  font-family: inherit;
  white-space: nowrap;
}

#btnLogout:hover {
  background: #eff6ff;
}

#btnLogout:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Финальный pixel-pass classic-plus для worker */

.w-select,
.w-input,
.w-btn {
  min-height: 38px;
}

.w-btn {
  line-height: 1.2;
}

.w-op-item {
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.w-op-item:hover {
  border-color: #cbdaf6;
}

.w-table th,
.w-table td {
  font-variant-numeric: tabular-nums;
}

.w-page-btn {
  min-height: 28px;
}

/* Единый заголовок для страницы карточки сотрудника */
.w-header__title {
  font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  line-height: 1.25;
}

/* Дополнительная компактность карточки сотрудника */
body {
  font-size: 14px;
  padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
}

.w-app {
  max-width: 580px;
  padding: 0.6rem 0.7rem;
}

.w-header {
  margin-bottom: 0.7rem;
}

.w-section {
  margin-bottom: 0.65rem;
}

.w-label {
  margin-bottom: 0.25rem;
  font-size: 0.88rem;
}

.w-select,
.w-input,
.w-btn {
  min-height: 34px;
}

.w-select,
.w-input {
  padding: 0.45rem 0.6rem;
  font-size: 13px;
}

.w-btn {
  padding: 0.45rem 0.75rem;
  font-size: 13px;
}

.w-info-card,
.w-progress-bar,
.w-finish-card,
.w-stats-active {
  padding: 0.5rem 0.62rem;
}

.w-info-row {
  padding: 0.22rem 0;
}

.w-equip-grid {
  gap: 0.35rem;
}

.w-equip-btn {
  padding: 0.5rem;
  font-size: 13px;
}

.w-ops-list {
  gap: 0.3rem;
}

.w-op-item {
  padding: 0.45rem 0.55rem;
  gap: 0.45rem;
}

.w-op-item__text {
  font-size: 0.86rem;
}

.w-op-item__meta {
  font-size: 0.75rem;
}

.w-work-display,
.w-pause-display {
  padding: 0.52rem 0.62rem;
  font-size: 13px;
  margin-bottom: 0.45rem;
}

/* Страница «Пачка»: одна визуальная высота строки — поле + QR, таймеры, шапка карточки пошива */
body[data-worker-page="batch"] {
  --w-batch-ui-row-h: 38px;
}

body[data-worker-page="batch"] .w-batch-picker-row .w-batch-picker {
  display: flex;
  align-items: stretch;
}

body[data-worker-page="batch"] .w-batch-picker-row .w-select,
body[data-worker-page="batch"] .w-batch-picker-row .w-btn--qr-scan {
  box-sizing: border-box;
  height: var(--w-batch-ui-row-h);
  min-height: var(--w-batch-ui-row-h);
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1.25;
}

body[data-worker-page="batch"] .w-batch-picker-row .w-select {
  padding-left: 0.6rem;
  padding-right: 0.6rem;
}

body[data-worker-page="batch"] .w-batch-picker-row .w-btn--qr-scan {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body[data-worker-page="batch"] .w-work-display,
body[data-worker-page="batch"] .w-pause-display {
  position: static;
  min-height: var(--w-batch-ui-row-h);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  padding: 0.35rem 0.62rem;
  text-align: center;
  box-shadow: none;
}

body[data-worker-page="batch"] .w-workflow-card .w-workflow-toggle {
  min-height: var(--w-batch-ui-row-h);
  box-sizing: border-box;
}

body[data-worker-page="batch"] .w-workflow-card:not(.w-workflow-card--collapsed) .w-workflow-toggle {
  min-height: var(--w-batch-ui-row-h);
  padding: 0.35rem 0.85rem;
}

body[data-worker-page="batch"] .w-workflow-card--collapsed .w-workflow-toggle {
  min-height: var(--w-batch-ui-row-h);
  padding: 0.35rem 0.75rem;
}

.w-table {
  font-size: 0.76rem;
}

.w-table th,
.w-table td {
  padding: 0.34rem 0.38rem;
}

.w-pagination {
  margin-top: 0.4rem;
  gap: 0.25rem;
}

.w-page-btn {
  min-height: 24px;
  padding: 0.16rem 0.4rem;
  font-size: 11px;
}

.w-spacer {
  height: 12px;
}

.w-footer__btn {
  padding: 0.72rem;
  font-size: 13px;
}

/* Плотнее содержимое карточек «Работа с браком» / «Пачка и операция» (перекрывает общие компактные правила выше) */
.w-workflow-card__body-inner .w-label {
  margin-bottom: 0.22rem;
  font-size: 0.8rem;
}

.w-workflow-card__body-inner .w-info-card {
  padding: 0.48rem 0.58rem;
  border-radius: 8px;
}

.w-workflow-card__body-inner .w-info-card--defect-inner {
  padding-top: 0.2rem;
}

.w-workflow-card__body-inner .w-info-row {
  padding: 0.18rem 0;
}

.w-workflow-card__body-inner .w-info-label,
.w-workflow-card__body-inner .w-info-value {
  font-size: 0.76rem;
}

.w-workflow-card__body-inner .w-equip-grid {
  gap: 0.32rem;
}

.w-workflow-card__body-inner .w-equip-btn {
  padding: 0.45rem 0.5rem;
  font-size: 12px;
  border-radius: 8px;
  border-width: 1px;
}

.w-workflow-card__body-inner .w-ops-list {
  gap: 0.25rem;
}

.w-workflow-card__body-inner .w-op-item {
  padding: 0.4rem 0.5rem;
  gap: 0.4rem;
  border-radius: 7px;
  border-width: 1px;
}

.w-workflow-card__body-inner .w-op-item__text {
  font-size: 0.8rem;
}

.w-workflow-card__body-inner .w-op-item__meta {
  font-size: 0.67rem;
}

.w-workflow-card__body-inner .w-op-item__video-btn {
  width: 30px;
  height: 30px;
}

.w-workflow-card__body-inner .w-op-item input[type="checkbox"],
.w-workflow-card__body-inner .w-op-item input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  max-width: 16px;
  max-height: 16px;
}

.w-workflow-card__body-inner .w-op-item--sew-checkbox-grey input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  border: 1.5px solid #cbd5e1;
  border-radius: 3px;
  background: #e2e8f0;
  cursor: not-allowed;
  accent-color: transparent;
}
.w-workflow-card__body-inner .w-op-item--sew-checkbox-grey input[type="checkbox"]:checked {
  background-color: #94a3b8;
  border-color: #7c8a9a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 L4.8 8.5 L9.5 3.2' stroke='%23ffffff' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-size: 10px 10px;
  background-position: center;
  background-repeat: no-repeat;
}

.w-workflow-card__body-inner .w-progress-bar {
  padding: 0.4rem 0.65rem;
  font-size: 0.76rem;
  border-radius: 7px;
}

.w-workflow-card__body-inner .w-order-ready-note {
  padding: 0.4rem 0.58rem;
  font-size: 0.76rem;
  margin-top: 0.32rem;
}

.w-workflow-card__body-inner .w-admin-pause-note {
  padding: 0.45rem 0.58rem;
  font-size: 0.78rem;
}

.w-workflow-card__body-inner .w-finish-card {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
}

.w-workflow-card__body-inner .w-finish-hint {
  font-size: 0.78rem;
  margin-bottom: 0.45rem;
}

.w-workflow-card__body-inner .w-finish-title {
  font-size: 0.85rem;
}

.w-workflow-card__body-inner .w-finish-or {
  font-size: 11px;
}

.w-workflow-card__body-inner .w-finish-actions .w-btn,
.w-workflow-card__body-inner .w-finish-partial .w-btn,
.w-workflow-card__body-inner .w-finish-cancel {
  font-size: 13px;
  padding: 0.52rem 0.65rem;
}

.w-workflow-card__body-inner .w-finish-partial .w-input {
  font-size: 14px;
}

.w-workflow-card__body-inner .w-finish-actions,
.w-workflow-card__body-inner .w-finish-partial {
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.w-workflow-card__body-inner .w-defect-tabs {
  gap: 0.15rem;
}

.w-workflow-card__body-inner .w-defect-tab {
  padding: 0.2rem 0.45rem 0.24rem;
  min-height: 0;
  font-size: 10px;
  border-radius: 8px 8px 0 0;
}

.w-workflow-card__body-inner .w-defect-body {
  padding: 0.42rem 0.5rem;
  gap: 0.2rem;
  border-radius: 0 8px 8px 8px;
  font-size: 0.76rem;
}

.w-workflow-card__body-inner .w-defect-row {
  grid-template-columns: 100px 1fr;
  gap: 0.3rem;
}

.w-workflow-card__body-inner .w-defect-key {
  font-size: 10px;
}

.w-workflow-card__body-inner .w-defect-value {
  font-size: 11px;
}

.w-workflow-card__body-inner .w-defect-done {
  margin-top: 0.3rem;
  font-size: 11px;
}

/* ── Хаб карточки сотрудника (worker.html) ── */
body.w-body--hub {
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.w-spacer--hub {
  height: 8px;
}

.w-head-row--sub {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
}

.w-head-row--sub .w-header__title {
  text-align: center;
  margin: 0;
  justify-self: center;
}

.w-hub-back {
  font-size: 14px;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  white-space: nowrap;
  padding: 0.25rem 0.35rem;
  border-radius: 8px;
}

.w-hub-back:hover {
  background: #eff6ff;
}

.w-hub-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.w-hub-nav__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0.65rem 0.75rem;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: #0f172a;
  background: #fff;
  border: 1px solid #d8deea;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  box-sizing: border-box;
}

.w-hub-nav a.w-hub-nav__btn,
.w-hub-nav button.w-hub-nav__btn {
  -webkit-appearance: none;
  appearance: none;
}

.w-hub-nav__btn:active {
  transform: scale(0.98);
}

.w-hub-nav__btn--batch {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #f8fafc 0%, #eff6ff 100%);
}

/* QR пачки: первый пункт хаба — рядом по смыслу с «Пачка», компактная подпись */
.w-hub-nav__btn--qr-scan {
  border-color: #60a5fa;
  background: linear-gradient(180deg, #fff 0%, #eff6ff 100%);
  font-weight: 600;
  cursor: pointer;
}

.w-hub-nav__btn--defect {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #fff 0%, #fef2f2 100%);
}

.w-hub-nav__btn--otk {
  border-color: #c4b5fd;
  background: linear-gradient(180deg, #fff 0%, #f5f3ff 100%);
}

.w-hub-nav__btn--pack {
  border-color: #86efac;
  background: linear-gradient(180deg, #fff 0%, #f0fdf4 100%);
}

.w-hub-nav__btn--time {
  border-color: #5eead4;
  background: linear-gradient(180deg, #fff 0%, #ecfdf5 100%);
}

/* Янтарь: отдельно от голубой «Пачка», бирюзы «По времени», фиолетового ОТК */
.w-hub-nav__btn--stats {
  border-color: #fbbf24;
  background: linear-gradient(180deg, #fff 0%, #fffbeb 100%);
  cursor: pointer;
}

/* Заглушка: не «серый disabled», но без действия */
.w-hub-nav__btn--stub {
  cursor: not-allowed;
  opacity: 0.9;
}

.w-hub-notif__title {
  font-size: 1rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
  color: #0f172a;
}

.w-hub-notif__list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.w-hub-notif__card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

/* Светлые фоны по типу уведомления (хаб) */
.w-hub-notif__card--batch {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.w-hub-notif__card--defect_own {
  background: #fff1f2;
  border-color: #fecdd3;
}

.w-hub-notif__card--defect_other {
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.w-hub-notif__card--defect_unknown {
  background: #fff7ed;
  border-color: #fed7aa;
}

.w-hub-notif__card--defect_unfinished {
  background: #fefce8;
  border-color: #e9d79a;
}

.w-hub-notif__card--defect_generic {
  background: #f0fdfa;
  border-color: #99f6e4;
}

.w-hub-notif__card-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: #334155;
}

.w-hub-notif__card-body {
  font-size: 0.86rem;
  line-height: 1.45;
  color: #475569;
}

.w-hub-notif__card-body p {
  margin: 0;
}

.w-hub-notif__ul {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}

.w-hub-notif__li {
  margin: 0.15rem 0;
}

.w-hub-notif__batch {
  font-weight: 600;
  color: #1e293b;
}

.w-hub-notif__more {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.w-batch-hub-hint {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: #64748b;
}

.w-cabinet-hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #64748b;
}

.w-batch-hub-hint a {
  color: #2563eb;
  font-weight: 600;
}

@media (min-width: 768px) {
  .w-app {
    max-width: 720px;
  }

  .w-hub-nav {
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
  }

  .w-hub-nav__btn {
    min-height: 56px;
    font-size: 16px;
  }
}

/* ── Страница «По времени» ── */

.w-time-work-hint {
  font-size: 0.9rem;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.65rem;
}

.w-time-timer-section {
  margin-bottom: 0.35rem;
}

/* «По времени»: крупные цифры (iOS-like), кнопки — в общем футере как Пачка/Брак */
.w-time-timer-card--ios {
  display: block;
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  padding: 0.35rem 0.65rem 0.45rem;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e8e8ed;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.w-time-timer-card--ios.w-time-timer-card--paused {
  border-color: #fde68a;
  box-shadow: 0 2px 14px rgba(180, 83, 9, 0.08);
}

.w-time-timer-display--ios {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
}

.w-time-ios-readout {
  text-align: center;
  padding: 0.15rem 0 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}

.w-time-ios-readout__hms {
  font-size: clamp(2.35rem, 11vw, 3.65rem);
  font-weight: 200;
  color: #1d1d1f;
}

.w-time-timer-card--ios.w-time-timer-card--paused .w-time-ios-readout__hms {
  color: #713f12;
}

.w-time-ios-readout__ms {
  font-size: clamp(1.35rem, 6.2vw, 2.05rem);
  font-weight: 300;
  color: #aeaeb2;
}

.w-time-timer-card--ios.w-time-timer-card--paused .w-time-ios-readout__ms {
  color: #ca8a04;
}

body[data-worker-page="time"] .w-spacer--time {
  height: 6px;
}

.w-time-finish-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.75rem;
}

.w-time-finish-comment {
  resize: vertical;
  min-height: 4.5rem;
  margin-bottom: 0.5rem;
}

.w-time-finish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.w-time-history-section {
  margin-top: 0.15rem;
  margin-bottom: 0.65rem;
}

.w-time-history-section > .w-label {
  margin-bottom: 0.15rem;
}

.w-time-history-wrap {
  margin-top: 0.2rem;
}

.w-table--time-history {
  font-size: 12px;
  table-layout: fixed;
  width: 100%;
}

.w-table--time-history th:nth-child(1),
.w-table--time-history td:nth-child(1) {
  width: 16%;
}

.w-table--time-history th:nth-child(2),
.w-table--time-history td:nth-child(2),
.w-table--time-history th:nth-child(3),
.w-table--time-history td:nth-child(3) {
  width: 24%;
}

.w-table--time-history th:nth-child(4),
.w-table--time-history td:nth-child(4) {
  width: 16%;
}

.w-table--time-history th,
.w-table--time-history td {
  padding: 0.4rem 0.45rem;
  vertical-align: middle;
}

.w-table--time-history th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.w-table--time-history td {
  color: #475569;
}

.w-table--time-history td:first-child {
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

.w-time-history-comment-cell {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.w-time-history-empty {
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
  padding: 0.5rem 0.35rem !important;
}

/*
 * Скругление worker = админка (tokens.css: --app-ui-radius / --app-ui-radius-dropdown).
 * Перекрывает разрозненные 6–14px выше по файлу (карточки, таймер, QR, таблицы, брак).
 */
.w-select,
.w-input,
.w-stats-back-link,
.w-hub-nav__btn,
#btnLogout,
.w-head-actions button,
.w-time-finish-panel,
.w-qr-scan-modal__close,
.w-qr-scan-modal__video-wrap,
.w-page-btn,
.w-hub-notif__card,
.w-btn,
.w-work-display,
.w-pause-display,
.w-timer-kind,
.w-info-card,
.w-workflow-card,
.w-table-wrap,
.w-finish-card,
.w-stats-active,
.w-batch-list,
.w-batch-option,
.w-equip-btn,
.w-op-item,
.w-progress-bar,
.w-defect-reminder,
.w-admin-pause-note,
.w-time-work-hint,
.w-time-timer-card--ios,
.w-op-badge,
body:not(.w-body--hub) #btnStats {
  border-radius: var(--app-ui-radius);
}

.w-native-select-dropdown__trigger-input,
.w-native-select-dropdown__menu,
.w-native-select-dropdown__option {
  border-radius: var(--app-ui-radius-dropdown);
}

.w-qr-scan-modal__panel {
  border-radius: var(--app-ui-radius) var(--app-ui-radius) 0 0;
}

.w-defect-tab {
  border-radius: var(--app-ui-radius) var(--app-ui-radius) 0 0;
}

.w-defect-body {
  border-radius: 0 var(--app-ui-radius) var(--app-ui-radius) var(--app-ui-radius);
}

/* Внутри свёрнутой карточки пошива — были свои 7–8px с более высокой специфичностью */
.w-workflow-card__body-inner .w-equip-btn,
.w-workflow-card__body-inner .w-op-item,
.w-workflow-card__body-inner .w-progress-bar,
.w-workflow-card__body-inner .w-finish-card {
  border-radius: var(--app-ui-radius);
}

.w-workflow-card__body-inner .w-defect-tab {
  border-radius: var(--app-ui-radius) var(--app-ui-radius) 0 0;
}

.w-workflow-card__body-inner .w-defect-body {
  border-radius: 0 var(--app-ui-radius) var(--app-ui-radius) var(--app-ui-radius);
}

.w-hub-back {
  border-radius: var(--app-ui-radius);
}

/* Страница «Брак»: кастомный combobox «Вид брака» (как фильтры ОТК) */
body[data-worker-page="defect"] select.otk-head-combobox__source {
  display: none !important;
}

body[data-worker-page="defect"] .defect-kind-combobox.otk-head-combobox {
  position: relative;
  width: 100%;
}

body[data-worker-page="defect"] .defect-kind-combobox .otk-head-combobox__field {
  position: relative;
  width: 100%;
}

body[data-worker-page="defect"] .defect-kind-combobox .otk-head-combobox__input {
  width: 100%;
  cursor: pointer;
}

body[data-worker-page="defect"] .defect-kind-combobox .otk-head-combobox__field::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid #7b8699;
  border-bottom: 1.5px solid #7b8699;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

body[data-worker-page="defect"] .defect-kind-combobox .otk-head-combobox__menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5600;
  background: #fff;
  border: 1px solid #64748b;
  border-radius: var(--app-ui-radius-dropdown);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
  padding: 0.15rem;
  overflow-y: auto;
  overflow-x: hidden;
}

body[data-worker-page="defect"] .defect-kind-combobox.otk-head-combobox.is-open .otk-head-combobox__menu {
  display: block;
}

body[data-worker-page="defect"] .defect-kind-combobox.otk-head-combobox.is-open .otk-head-combobox__input {
  border-color: #c8d6f2;
  box-shadow: 0 0 0 2px rgba(1, 104, 250, 0.08);
}

body[data-worker-page="defect"] .defect-kind-combobox .otk-head-combobox__option {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #1f2937;
  font-size: 13px;
  line-height: 1.25;
  text-align: left;
  padding: 0.35rem 0.5rem;
  min-height: 28px;
  border-radius: var(--app-ui-radius);
  cursor: pointer;
}

body[data-worker-page="defect"] .defect-kind-combobox .otk-head-combobox__option:hover:not(:disabled):not(.is-disabled) {
  background: #f1f5f9;
}

body[data-worker-page="defect"] .defect-kind-combobox .otk-head-combobox__option.is-active {
  background: #e8f0ff;
  color: #1d4ed8;
  font-weight: 600;
}

body[data-worker-page="defect"] .defect-kind-combobox .otk-head-combobox__option.is-disabled,
body[data-worker-page="defect"] .defect-kind-combobox .otk-head-combobox__option:disabled {
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.75;
}
