/*
 * Терминал ТСД (3D §2, §10): тёмная тема в палитре PTG (docs/STYLE-PTG.md, ответ владельца 10.10.2026) — чёрный фон,
 * белые плашки активного и основной кнопки, статусы on-dark; шрифт ≥ 20px, кнопки ≥ 56px «для перчаток», важное — без
 * скролла. Токены — css/ptg.css (body.theme-terminal).
 */

/* ---------- процессы: крупные плитки, внутри процесса — узкая полоса сверху ---------- */
.tsd-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.tsd-menu:empty { display: none; }
.tsd-proc {
  min-height: 124px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 14px 8px;
  font-size: 17px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; text-align: center; cursor: pointer;
  transition: background .15s, transform .1s;
}
.tsd-proc:hover { background: var(--gray-900); }
.tsd-proc:active { transform: scale(.98); }
.tsd-proc-name { overflow-wrap: break-word; hyphens: auto; }
/* Внутри процесса (замечание владельца 11.10.2026: полоса чипов неудобна) — одна кнопка-навигация «☰ Приёмка» в верхней
   панели: показывает, где вы, и ведёт к плиткам процессов. На /tsd живёт в шапке (#tsdNav), в офисе — строкой над экраном. */
.tsd-tabs { display: flex; padding: 0 0 10px; }
.tsd-tabs:empty { display: none; }
.tsd-nav { display: flex; align-items: center; min-width: 0; }
.tsd-nav:empty { display: none; }
.tsd-nav-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 100%; min-width: 0; padding: 6px 14px 6px 10px;
  border-radius: 99px; border: 1px solid var(--primary); background: var(--primary); color: var(--primary-text);
  font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.tsd-nav-btn > span { overflow: hidden; text-overflow: ellipsis; }
.tsd-nav-btn .ico { flex: none; }
.tsd-nav-btn:active { transform: scale(.98); }
.tsd-standalone .userbar .tsd-nav { flex: 1 1 auto; }
.tsd-standalone .userbar .tsd-nav-btn { flex: 0 1 auto; }
/* Рядом с кнопкой процесса имя сотрудника уступает место: на узком ТСД (≤ 420px) прячется совсем — имя видно на экране
   плиток и в окне «Выйти»; шире — обрезается многоточием. Название процесса важнее. */
.tsd-standalone .userbar .tsd-nav:not(:empty) + .user-name { flex: 0 1 auto; max-width: 30%; font-size: 14px; color: var(--text-muted); }
@media (max-width: 420px) {
  .tsd-standalone .userbar .tsd-nav:not(:empty) + .user-name { display: none; }
}
.tsd-pane { min-height: 200px; }

/* ---------- шаг экрана ---------- */
.tsd-step { display: flex; flex-direction: column; gap: 12px; }
.tsd-head { display: flex; align-items: center; gap: 10px; }
.tsd-back {
  min-height: 56px; min-width: 120px; font-size: 19px; font-weight: 700; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer;
}
.tsd-head-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; flex: 1; line-height: 1.2; }
.tsd-msg { min-height: 30px; font-size: 20px; font-weight: 700; padding: 8px 14px; border-radius: var(--radius-sm); }
.tsd-msg:empty { padding: 0; min-height: 0; }
.tsd-msg.ok { background: var(--green-bg); color: var(--green); }
.tsd-msg.warn { background: var(--amber-bg); color: var(--amber); }
.tsd-msg.err { background: var(--red-bg); color: var(--red); }
.tsd-body { display: flex; flex-direction: column; gap: 12px; }
.tsd-section { font-size: 14.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); margin-top: 8px; }

/* ---------- крупные кнопки ---------- */
.tsd-btn {
  min-height: 60px; font-size: 21px; font-weight: 700; border-radius: 12px; padding: 10px 16px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer;
  text-align: left; display: flex; align-items: center; gap: 10px; width: 100%; transition: background .15s, transform .1s;
}
.tsd-btn:active { transform: scale(.985); }
.tsd-btn:disabled { opacity: .45; cursor: default; transform: none; }
.tsd-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); justify-content: center; text-align: center; }
.tsd-btn.ok { background: var(--green); border-color: var(--green); color: var(--black); justify-content: center; text-align: center; }
.tsd-btn.danger { background: transparent; border: 2px solid var(--red); color: var(--red); justify-content: center; }
.tsd-btn.center { justify-content: center; text-align: center; }
.tsd-btn.is-busy { opacity: .6; pointer-events: none; }
/* Этап 10 (Р10-11, 4-front A3): страховка h() — запись этой кнопки в полёте (и ещё 350 мс); как .tsd-btn.is-busy. */
[data-pending] { cursor: progress; }
[data-pending]:not(form) { pointer-events: none; }
/* Полупрозрачны только кнопки и плитки: контейнер с делегированным обработчиком (tbody «Товаров») не тускнеет. */
button[data-pending], a[data-pending], .btn[data-pending], .tsd-tile[data-pending], [role="button"][data-pending] { opacity: .7; }
.tsd-btn[data-pending] { opacity: .6; pointer-events: none; }
.tsd-btn .grow { flex: 1; }
.tsd-btn .sub { display: block; font-size: 16px; font-weight: 500; color: var(--muted); }
.tsd-btn.primary .sub, .tsd-btn.ok .sub { color: rgba(12, 11, 10, .65); }
.tsd-badge {
  min-width: 34px; height: 34px; border-radius: 17px; background: var(--amber); color: var(--black);
  display: inline-grid; place-items: center; font-size: 18px; font-weight: 800; padding: 0 8px; font-family: var(--mono);
}
.tsd-badge.zero { background: var(--gray-700); color: var(--muted); }
.tsd-list { display: flex; flex-direction: column; gap: 8px; }
.tsd-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* Пустые контейнеры не оставляют белых плашек (видео 13 / D3); итог последнего действия — зелёной строкой внизу (B2, C1). */
.tsd-row2:empty, .tsd-list:empty, .tsd-recent:empty { display: none; }
.tsd-done { color: var(--ok); font-weight: 600; }
/* «Осталось до срока» (видео 11 / D2): меньше порога — жёлтым, срок вышел — красным. */
.tsd-left.warn, .tsd-kv .warn { color: var(--warn); font-weight: 600; }
.tsd-left.err, .tsd-kv .err { color: var(--err); font-weight: 600; }
.tsd-bottom { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 4px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- поле скана ---------- */
.tsd-scan { display: flex; gap: 8px; }
.tsd-scan input, .tsd-input {
  flex: 1; min-height: 60px; font-size: 22px; padding: 8px 14px; border-radius: 12px; font-family: var(--mono);
  border: 2px solid var(--primary); background: var(--black); color: var(--text); min-width: 0;
}
.tsd-input { border-color: var(--border); width: 100%; }
.tsd-input:focus, .tsd-scan input:focus { outline: none; border-color: var(--primary); }
.tsd-scan .tsd-btn { width: auto; min-width: 110px; justify-content: center; }
.tsd-hint { font-size: 16px; color: var(--muted); }
/* Ручной ввод в поле скана (ревью этапа 4, п.24): клавиатура телефона — только по кнопке «⌨ Ввести вручную». */
.tsd-scan-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.tsd-kbd {
  flex: none; min-height: 48px; padding: 6px 14px; border-radius: var(--radius-sm); font-size: 17px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
}
.tsd-kbd.on { border-color: var(--primary); background: var(--primary); color: var(--primary-text); }

.tsd-big { font-size: 26px; font-weight: 800; line-height: 1.25; letter-spacing: -0.02em; }
.tsd-mid { font-size: 20px; line-height: 1.3; }
.tsd-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.tsd-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 19px; }
.tsd-kv span:first-child { color: var(--muted); }
.tsd-kv span:last-child { font-variant-numeric: tabular-nums; }

.tsd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.tsd-tile {
  min-height: 72px; border-radius: 12px; border: 2px solid var(--border); background: var(--panel); color: var(--text);
  font-size: 21px; font-weight: 700; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--mono);
}
.tsd-tile.done { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.tsd-tile.plus { border-style: dashed; color: var(--text); font-size: 30px; }
.tsd-tile small { font-size: 13px; font-weight: 400; color: var(--muted); font-family: var(--sans); }

.tsd-toggle { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 700; }
.tsd-toggle button { min-width: 90px; min-height: 56px; border-radius: 12px; font-size: 22px; font-weight: 800; cursor: pointer;
  border: 2px solid var(--border); background: var(--panel); color: var(--muted); }
.tsd-toggle button.on { background: var(--amber); border-color: var(--amber); color: var(--black); }

/* ---------- цифровая клавиатура ---------- */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numpad button { min-height: 60px; font-size: 26px; font-weight: 700; border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); cursor: pointer; font-family: var(--mono); }
.numpad button:active { background: var(--gray-900); }
.numpad-display { display: flex; gap: 8px; }
.numpad-field { flex: 1; min-height: 60px; border-radius: 12px; border: 2px solid var(--border); padding: 6px 12px; cursor: pointer;
  display: flex; flex-direction: column; justify-content: center; background: var(--black); }
.numpad-field.active { border-color: var(--primary); }
.numpad-field.err { border-color: var(--red); }
.numpad-field.err .val { color: var(--red); } /* больше заявленного по файлу (M1) */
.numpad-field .lbl { font-size: 14px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }
.numpad-field .val { font-size: 26px; font-weight: 700; min-height: 30px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tsd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tsd-chip { min-height: 48px; padding: 6px 16px; border-radius: 99px; border: 1px solid var(--border); background: var(--panel);
  color: var(--text); font-size: 18px; font-weight: 600; cursor: pointer; }
.tsd-recent { font-size: 17px; line-height: 1.4; color: var(--muted); }
.tsd-recent div { padding: 6px 0; border-bottom: 1px solid var(--border); }

/* Этап 4, шаги 9–12: ярус кнопкой, крупная строка состояния ячейки, выбор паллет, карточка спуска. */
.tsd-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.tsd-levels button { min-height: 64px; font-size: 28px; font-weight: 800; border-radius: 12px; border: 2px solid var(--border);
  background: var(--panel); color: var(--text); cursor: pointer; font-family: var(--mono); }
.tsd-levels button.on { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.tsd-levels button:disabled { opacity: .3; cursor: default; }
.tsd-status { min-height: 0; font-size: 24px; font-weight: 800; padding: 0; border-radius: 12px; text-align: center; }
.tsd-status.ok { padding: 14px; background: var(--green-bg); color: var(--green); border: 2px solid var(--green); }
.tsd-status.warn { padding: 14px; background: var(--amber-bg); color: var(--amber); border: 2px solid var(--amber); }
.tsd-status.err { padding: 14px; background: var(--red-bg); color: var(--red); border: 2px solid var(--red); }
.tsd-huge { font-size: 34px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; word-break: break-all; font-family: var(--mono); }
.tsd-pick { display: flex; flex-direction: row; align-items: center; gap: 12px; }   /* строка, не столбик (п.23) */
.tsd-pick-text { flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
.tsd-pick input[type=checkbox] { width: 30px; height: 30px; flex: none; accent-color: var(--white); }
.tsd-btn.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; }
.tsd-lock { font-size: 16px; color: var(--amber); }
/* Этап 9 (Р9-19, 4-front F): занято другим — не disabled (нажатие не молчит: «Занято: ФИО …»), но видно, что занято. */
.tsd-locked { opacity: .6; border-style: dashed; }
.tsd-tile.tsd-locked { color: var(--amber); }

/*
 * Окна подтверждения и ввода в Терминале (ревью этапа 4, п.23): общие confirmDialog / formDialog из ui.js в «офисном»
 * размере (кнопки 44 px, текст 16 px) — для перчаток крупнее: кнопки ≥ 60 px, текст ≥ 20 px, поля ввода ≥ 56 px.
 */
body.theme-terminal .modal { max-width: 560px; padding: 22px; border-radius: 16px; }
body.theme-terminal .modal-wide { max-width: 860px; }
body.theme-terminal .modal-title { font-size: 24px; line-height: 1.25; margin-bottom: 14px; }
body.theme-terminal .modal-text { font-size: 21px; line-height: 1.4; }
body.theme-terminal .modal .form-error { font-size: 19px; font-weight: 600; }
body.theme-terminal .modal label { font-size: 19px; gap: 8px; }
body.theme-terminal .modal input, body.theme-terminal .modal select, body.theme-terminal .modal textarea {
  min-height: 56px; font-size: 21px; padding: 8px 14px; border-radius: 12px;
}
body.theme-terminal .modal-actions { gap: 12px; margin-top: 22px; flex-wrap: wrap; }
body.theme-terminal .modal-actions .btn, body.theme-terminal .modal .btn {
  min-height: 60px; min-width: 130px; font-size: 21px; font-weight: 700; border-radius: 12px; padding: 10px 18px; flex: 1 1 auto;
}

@media (max-width: 480px) {
  .tsd-standalone .content, body.theme-terminal .content { padding: 10px 8px 30px; }
  .tsd-head-title { font-size: 20px; }
  .tsd-back { min-width: 96px; }
  .tsd-menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Отдельная точка входа ТСД (/tsd): только Терминал, на всю ширину, без офисного меню. */
.tsd-standalone .tsd-shell { min-height: 100vh; display: flex; flex-direction: column; }
.tsd-standalone .userbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 8px 14px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.tsd-standalone .userbar .user-name { flex: 1; font-size: 15px; }
.tsd-standalone .userbar .user-roles { display: none; }
.tsd-standalone .userbar .btn { font-size: 16px; padding: 10px 14px; min-height: 44px; }
.tsd-standalone .content { padding: 10px 12px 24px; width: 100%; max-width: 920px; margin: 0 auto; }
.tsd-standalone .auth-card { max-width: 440px; }
.tsd-standalone .auth .form input { font-size: 20px; padding: 14px; }
.tsd-standalone-link { display: inline-block; margin-bottom: 10px; font-size: 14px; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.tsd-standalone-link:hover { color: var(--text); text-decoration: underline; }

/* ---------- Этап 5: Терминал «Сборка» (docs/stage5/4-tsd.md, экраны A–E) ---------- */
.asm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.asm-tile {
  position: relative; min-height: 150px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel);
  color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 14px 8px 10px; font: inherit;
}
.asm-tile.ka { border-color: var(--border-strong); }
.asm-tile-name { font-size: 20px; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.asm-tile-sub { font-size: 15px; color: var(--muted); text-align: center; }
.asm-tile-badge {
  position: absolute; top: 8px; right: 8px; min-width: 36px; height: 36px; border-radius: 18px; background: var(--amber);
  color: var(--black); display: grid; place-items: center; font-size: 19px; font-weight: 800; padding: 0 8px; font-family: var(--mono);
}
.asm-logo {
  width: 64px; height: 64px; flex: none; border-radius: 12px; display: grid; place-items: center; color: #fff;
  font-size: 28px; font-weight: 800; overflow: hidden; user-select: none;
}
.asm-logo.logo-img { background: #fff; }
.asm-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.asm-logo-ka { background: #e06aa8; }
.asm-logo-none { background: var(--gray-700); }
.tsd-btn.asm-continue { background: var(--amber); border-color: var(--amber); color: var(--black); }
.tsd-btn.asm-continue .sub { color: rgba(12, 11, 10, .65); }
.asm-task { display: flex; gap: 8px; align-items: stretch; }
.asm-task > .tsd-btn { flex: 1; min-width: 0; }
.tsd-btn.asm-mine { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber) inset; }
.asm-del {
  flex: none; width: 64px; border-radius: 12px; border: 2px solid var(--red); background: transparent; color: var(--red);
  font-size: 28px; font-weight: 800; cursor: pointer;
}
.asm-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.asm-tag { font-size: 14px; padding: 2px 9px; border-radius: 99px; background: rgba(255, 255, 255, .1); color: var(--text); font-weight: 600; }
.asm-go { display: block; color: var(--amber); font-size: 16px; margin-top: 2px; }
.asm-k {
  display: inline-block; background: var(--red); color: var(--black); font-weight: 800; font-size: 15px; border-radius: 6px;
  padding: 0 7px; margin-left: 8px; vertical-align: middle; line-height: 1.5;
}

.asm-lines { display: flex; flex-direction: column; gap: 6px; }
.asm-line { border: 1px solid var(--border); border-left: 6px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--panel); }
.asm-line.wait { border-left-color: var(--amber); }
.asm-line.saving { border-left-color: var(--muted); opacity: .8; }
.asm-line.ok { border-left-color: var(--green); }
.asm-line.short { border-left-color: var(--amber); }
.asm-line.err { border-left-color: var(--red); }
.asm-line.off { opacity: .5; }
.asm-line-top { display: flex; gap: 6px; align-items: center; font-size: 19px; }
.asm-line-qty { margin-left: auto; font-weight: 700; white-space: nowrap; font-family: var(--mono); }
.asm-line-name { font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.asm-line-bottom { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 16px; margin-top: 2px; }
.asm-st { margin-left: auto; font-weight: 700; }
.asm-line.wait .asm-st, .asm-line.short .asm-st { color: var(--amber); }
.asm-line.ok .asm-st { color: var(--green); }
.asm-line.err .asm-st { color: var(--red); }
.asm-line.saving .asm-st, .asm-line.off .asm-st { color: var(--muted); }

.asm-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.asm-main { display: flex; flex-direction: column; gap: 12px; }
.asm-left { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
@media (min-width: 720px) {
  .asm-main { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
}
.asm-cell { font-size: 38px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; word-break: break-all; font-family: var(--mono); }
.asm-off { color: var(--red); font-size: 24px; }
.asm-flag, .asm-excl { padding: 8px 12px; border-radius: var(--radius-sm); font-size: 18px; font-weight: 700; }
.asm-flag { background: var(--red-bg); border: 2px solid var(--red); color: var(--red); }
.asm-excl { background: var(--amber-bg); border: 2px solid var(--amber); color: var(--amber); }
.asm-sku { font-size: 28px; font-weight: 800; overflow-wrap: anywhere; font-family: var(--mono); }
.asm-name { font-size: 18px; color: var(--muted); overflow-wrap: anywhere; }
.asm-need { font-size: 26px; font-weight: 800; line-height: 1.2; }
.asm-need-sub { font-size: 18px; font-weight: 600; color: var(--muted); }
.asm-facts { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 18px; }
.asm-later { color: var(--amber); font-weight: 700; }
.asm-best { display: flex; flex-direction: column; gap: 8px; font-size: 17px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.tsd-btn.asm-switch { justify-content: center; text-align: center; }
.asm-stage { display: flex; flex-direction: column; gap: 10px; }
.asm-ok { font-size: 20px; font-weight: 700; color: var(--green); overflow-wrap: anywhere; }
.asm-total { font-size: 18px; color: var(--muted); min-height: 22px; }
.tsd-btn.asm-collect { font-size: 26px; min-height: 72px; }
.tsd-btn.asm-nogoods { justify-content: center; text-align: center; border: 2px solid var(--red); color: var(--red); background: transparent; }
.tsd-btn.asm-takefrom { border: 2px solid var(--primary); color: var(--text); }
.asm-busy { font-size: 18px; color: var(--amber); font-weight: 700; }
.asm-busy:empty { display: none; }
.asm-final { font-size: 28px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.asm-done {
  font-size: 28px; font-weight: 800; color: var(--green); padding: 18px; border: 2px solid var(--green); border-radius: var(--radius);
  background: var(--green-bg); text-align: center;
}
.asm-done.warn { color: var(--amber); border-color: var(--amber); background: var(--amber-bg); }
@media (max-width: 480px) {
  .asm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asm-cell { font-size: 32px; }
  .asm-sku { font-size: 24px; }
  .asm-need { font-size: 23px; }
}

/* ---------- Этап 6: Терминал «Сортировка» (docs/stage6/4-tsd.md S0–S4) ---------- */
.srt-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.srt-seg-btn {
  min-height: 56px; border-radius: 12px; border: 2px solid var(--border); background: var(--panel); color: var(--muted);
  font-size: 18px; font-weight: 700; cursor: pointer; padding: 6px 8px; line-height: 1.2;
}
.srt-seg-btn.on { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.srt-title { font-size: 21px; font-weight: 700; overflow-wrap: anywhere; }
.srt-for { font-size: 16px; color: var(--muted); overflow-wrap: anywhere; }
.srt-cellrow { display: flex; align-items: center; gap: 12px; min-width: 0; }
.srt-cellrow .asm-logo.srt-logo { flex: none; width: 64px; height: 64px; font-size: 30px; }
.srt-code2 { font-size: 18px; font-weight: 600; color: var(--muted); }
.srt-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.srt-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.srt-table th { text-align: left; color: var(--text-faint); font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; padding: 8px; border-bottom: 1px solid var(--border); }
.srt-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.srt-table td.num { text-align: right; white-space: nowrap; font-weight: 700; }
.srt-table td.mono { white-space: nowrap; overflow-wrap: normal; }
.srt-table tr:last-child td { border-bottom: none; }
.srt-table tr.ok td:first-child { box-shadow: inset 5px 0 0 var(--green); }
.srt-table tr.err td:first-child { box-shadow: inset 5px 0 0 var(--red); }
.srt-table tr.wait td:first-child { box-shadow: inset 5px 0 0 var(--amber); }
.srt-table tr.ok td.num:last-child { color: var(--green); }
.srt-table tr.err td.num:last-child { color: var(--red); }
.srt-table tr.wait td.num:last-child { color: var(--amber); }
.srt-table tr.saving, .srt-table tr.off { opacity: .6; }
.srt-table tr.cur td { background: rgba(255, 255, 255, .07); }
@media (max-width: 480px) {
  .srt-seg-btn { font-size: 16px; }
  .srt-table { font-size: 13px; }
  .srt-table th, .srt-table td { padding: 5px 4px; }
}

/* ---------- Этап 6: Терминал «Отгрузка» и «Возврат с маршрута» (docs/stage6/4-tsd.md S0–S4) ---------- */
.shp-block { font-size: 18px; font-weight: 800; margin-top: 10px; }
.tsd-card.shp-row { gap: 4px; }
.tsd-card.shp-row.mine { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber) inset; }
.tsd-card.shp-row .tsd-btn { margin-top: 6px; justify-content: center; text-align: center; }
.shp-title { font-size: 21px; font-weight: 700; overflow-wrap: anywhere; }
.shp-sub { font-size: 16px; color: var(--muted); overflow-wrap: anywhere; }
.shp-name { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.shp-state { font-size: 16px; font-weight: 700; color: var(--amber); overflow-wrap: anywhere; }
.shp-state.mine { color: var(--green); }
.shp-head { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 17px; color: var(--muted); }
.shp-head b { color: var(--text); }
.shp-totals { font-size: 18px; font-weight: 700; }
.shp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shp-actions > .tsd-btn { justify-content: center; text-align: center; min-height: 56px; font-size: 18px; }
.shp-actions.one { grid-template-columns: 1fr; }
.shp-cond { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shp-short-list { margin: 8px 0 0; padding-left: 22px; font-size: 18px; line-height: 1.4; }
.tsd-chip.shp-chip-on { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.shp-del {
  min-width: 44px; min-height: 40px; border-radius: var(--radius-sm); border: 2px solid var(--red); background: transparent; color: var(--red);
  font-size: 20px; font-weight: 800; cursor: pointer;
}
@media (max-width: 480px) {
  .shp-title { font-size: 19px; }
  .shp-actions > .tsd-btn { font-size: 16px; }
}

/* Этап 7: Терминал «Инвентаризация» (docs/stage7/4-tsd.md). Ячейка — крупно (.asm-cell), скана ячейки нет. */
.inv-kinds .tsd-badge { background: var(--red); color: var(--black); }
.inv-kinds .tsd-badge.zero { background: var(--gray-700); color: var(--muted); }
.tsd-btn.inv-review { border: 2px solid var(--amber); }
.tsd-btn.inv-first { border: 2px solid var(--primary); }
.tsd-btn.inv-changed { border-color: var(--amber); }
.tsd-back.inv-back-off { opacity: .45; }
.inv-head .inv-task { font-size: 17px; color: var(--muted); }
.inv-where { font-size: 21px; font-weight: 700; }
.inv-sku { font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.inv-sys { font-size: 22px; }
.inv-sys b { font-size: 28px; font-family: var(--mono); }
.inv-extra { font-size: 17px; color: var(--amber); margin-top: 4px; }
.inv-found-row { display: flex; align-items: center; gap: 10px; }
.inv-found-row .grow { flex: 1; min-width: 0; font-size: 18px; overflow-wrap: anywhere; }
.tsd-btn.inv-del { width: auto; min-width: 56px; justify-content: center; flex: none; }
.inv-tables { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.inv-all summary { cursor: pointer; font-size: 18px; color: var(--text); font-weight: 600; padding: 8px 0; }
.inv-ask { margin-top: 16px; }
body.theme-terminal .inv-note { font-size: 19px; }
body.theme-terminal .inv-mv { font-size: 18px; }

/* ---------- Ориентация и размер экрана (аудит экранов ТСД 11.10.2026) ---------- */
/* Портрет узкого ТСД (360×640): 10 плиток процессов — 5 рядов по 104px, без прокрутки. */
@media (max-width: 480px) {
  .tsd-proc { min-height: 96px; gap: 8px; padding: 10px 6px; font-size: 16px; }
  .tsd-proc .ico { width: 30px; height: 30px; }
}
/* Горизонтально на ТСД / телефоне (высота ≤ 480px): шапка и полоса сжимаются, списки — в две колонки, цифровая клавиатура —
   рядом с полями, кнопки — 48–50px: главное помещается в один экран без прокрутки. Размеры «для перчаток» ≥ 44px остаются. */
@media (max-height: 480px) and (orientation: landscape) {
  .tsd-standalone .userbar { padding: 3px 12px; gap: 10px; }
  .tsd-standalone .userbar .logo-mark { width: 28px; height: 28px; font-size: 12px; }
  .tsd-standalone .userbar .user-name { font-size: 14px; }
  .tsd-standalone .userbar .btn { min-height: 36px; padding: 5px 10px; font-size: 14px; }
  .tsd-standalone .content { padding: 6px 12px 16px; }
  .tsd-tabs { padding: 0 0 6px; }
  .tsd-nav-btn { min-height: 36px; padding: 3px 12px 3px 8px; font-size: 14px; }
  .tsd-menu { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
  .tsd-proc { min-height: 78px; gap: 6px; padding: 8px 6px; font-size: 14.5px; }
  .tsd-proc .ico { width: 24px; height: 24px; }
  .tsd-step, .tsd-body { gap: 6px; }
  .tsd-head-title { font-size: 18px; }
  .tsd-back { min-height: 40px; min-width: 88px; font-size: 15px; }
  .tsd-msg { font-size: 17px; padding: 6px 12px; }
  .tsd-section { margin-top: 0; font-size: 13px; }
  .tsd-scan-tools .tsd-hint { display: none; } /* подсказка повторяет placeholder поля — в горизонтали экономим строку */
  .tsd-btn { min-height: 50px; font-size: 18px; padding: 6px 14px; }
  .tsd-btn .sub { font-size: 14px; }
  .tsd-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tsd-scan input, .tsd-input { min-height: 50px; font-size: 19px; }
  .tsd-scan .tsd-btn { min-width: 96px; }
  .tsd-scan-tools { margin-top: 2px; }
  .tsd-hint { font-size: 14px; }
  .tsd-kbd { min-height: 40px; font-size: 15px; padding: 4px 12px; }
  .tsd-card { padding: 8px 12px; gap: 2px; }
  .tsd-kv { font-size: 17px; }
  .tsd-big { font-size: 22px; }
  .tsd-mid { font-size: 18px; }
  .tsd-huge, .asm-cell { font-size: 28px; }
  .tsd-bottom { padding: 6px 0 2px; }
  .tsd-bottom .tsd-btn { min-height: 48px; }
  /* Клавиатура (.tsd-numpad — контейнер numPad из kit.js): поля слева, клавиши справа — один экран без прокрутки.
     Классы вместо селектора :has — он вдвое замедлял построение больших таблиц офиса (дымовой прогон S1). */
  .tsd-numpad { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: 8px 12px; align-items: start; }
  .tsd-numpad .numpad-display { flex-direction: column; }
  .numpad { gap: 5px; }
  .numpad button { min-height: 40px; font-size: 21px; }
  .numpad-field { min-height: 50px; }
  .numpad-field .val { font-size: 22px; min-height: 26px; }
  /* Ярусы — справа от поля скана (контейнер шага помечен .tsd-has-levels в buffer.js / freemove.js): видны без прокрутки */
  .tsd-has-levels { display: grid; grid-template-columns: minmax(0, 1fr) 272px; column-gap: 12px; align-items: start; }
  .tsd-has-levels > * { grid-column: 1; min-width: 0; }
  .tsd-has-levels > .tsd-levels { grid-column: 2; grid-row: 1 / span 12; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); }
  .tsd-levels button { min-height: 46px; font-size: 24px; }
  .tsd-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .tsd-tile { min-height: 56px; font-size: 18px; }
  body.theme-terminal .modal { padding: 14px 16px; }
  body.theme-terminal .modal-title { font-size: 20px; margin-bottom: 8px; }
  body.theme-terminal .modal-text { font-size: 18px; }
  body.theme-terminal .modal-actions { margin-top: 12px; }
  body.theme-terminal .modal-actions .btn, body.theme-terminal .modal .btn { min-height: 48px; font-size: 18px; }
}
/* Широкий экран (планшет на погрузчике, ≥ 720px): клавиатура и ярусы не растягиваются на всю ширину */
@media (min-width: 720px) {
  .tsd-numpad { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 10px 16px; align-items: start; }
  .tsd-numpad .numpad-display { flex-direction: column; }
  .tsd-levels { max-width: 560px; }
}

/* Узкая клавиатура (ширина блока numPad < 720px: окно ТСД не на весь экран, масштаб браузера, панель «Терминал» в офисе —
   видео 21, 27 / H1; класс ставит ResizeObserver в kit.js numPad): поля сверху, клавиши снизу во всю ширину, не меньше 56px,
   без горизонтальной прокрутки. Правила ниже медиа-блоков и специфичнее их — перекрывают раскладку «поля слева, клавиши справа». */
.tsd-numpad.tsd-numpad-narrow { display: flex; flex-direction: column; align-items: stretch; gap: 8px; } /* stretch: иначе align-items: start
   из раскладки «поля слева, клавиши справа» сжимал клавиши и поля до ширины содержимого (клавиши по 28 px; видео 30–31 / M3) */
.tsd-numpad.tsd-numpad-narrow .numpad, .tsd-numpad.tsd-numpad-narrow .numpad-display { width: 100%; }
.tsd-numpad.tsd-numpad-narrow .numpad-display { flex-direction: row; flex-wrap: wrap; }
.tsd-numpad.tsd-numpad-narrow .numpad-field { min-width: 150px; }
.tsd-numpad.tsd-numpad-narrow .numpad { gap: 6px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tsd-numpad.tsd-numpad-narrow .numpad button { min-height: 56px; font-size: 24px; min-width: 0; }

/* «Разместить частично» (видео 21–23 / G2): полоса «0 / N шт» с кнопками −/+ по единице над клавиатурой. */
.tsd-qty { display: flex; align-items: center; justify-content: center; gap: 14px; }
.tsd-qty .tsd-big { min-width: 170px; text-align: center; font-variant-numeric: tabular-nums; }
.tsd-qty .tsd-chip { min-width: 64px; min-height: 56px; font-size: 28px; font-weight: 700; justify-content: center; }
