:root {
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: #19263b;
  background: #f4f6fa;
  font-synthesis: none;
}
.uin-panel { overflow-wrap:anywhere; }
.uin-panel input { max-width:100%; min-width:0; }
.uin-panel button[type=submit] { margin-top:12px; }
.uin-panel details { margin:16px 0; }
.uin-success { color:#17663f; }
.uin-error { color:#a12c24; }
.import-entry { display:grid; gap:8px; color:inherit; text-decoration:none; }
.import-entry:hover, .import-entry:focus-visible { border-color:#3d58e8; }
.import-entry span:last-child { color:#304cd5; }
.uin-code { font-variant-numeric:tabular-nums; }
#uin-history-search button { margin-top:10px; }
.packing-link { display:block; margin:12px 0; padding:14px; border:1px solid #cbd5e1; border-radius:12px; text-align:center; color:#304cd5; text-decoration:none; }
#packing-scan button { margin-top:12px; }
.card > button.full + button.full { margin-top:12px; }
.order-product { display:flex; gap:14px; align-items:flex-start; }
.order-product > div { min-width:0; }
.order-card { overflow-wrap:anywhere; }
.order-photo { width:80px; height:107px; object-fit:contain; border-radius:8px; background:white; }
.order-no-photo { flex:0 0 80px; font-size:12px; color:#596a80; }
.order-search { margin:18px 0; }
.order-search button { margin-top:8px; }
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header,
main,
footer {
  max-width: 660px;
  margin: auto;
  padding: 20px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 28px;
}
.brand {
  text-decoration: none;
  color: inherit;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px;
}
.brand span {
  display: block;
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 500;
  color: #64748b;
}
h1 {
  font-size: 29px;
  letter-spacing: -0.7px;
  margin: 14px 0;
}
h2 {
  font-size: 21px;
  margin: 8px 0;
}
h3 {
  font-size: 18px;
  margin: 0 0 8px;
}
p {
  line-height: 1.55;
}
small,
.muted {
  color: #596a80;
}
button,
input,
a {
  touch-action: manipulation;
}
button {
  font: inherit;
  font-weight: 600;
  border: 1px solid #ccd5e1;
  border-radius: 13px;
  min-height: 48px;
  padding: 12px 16px;
  background: white;
  color: #26354a;
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button.primary {
  background: #315feb;
  color: white;
  border-color: #315feb;
}
button.success {
  color: #116443;
  background: #e6f4ec;
  border-color: #acd5bd;
}
button.warning {
  color: #8b5200;
  background: #fff3dc;
  border-color: #e4c791;
}
button.danger {
  color: #a32929;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #7598ff;
  outline-offset: 3px;
}
.card {
  padding: 20px;
  background: white;
  border: 1px solid #dce3ed;
  border-radius: 20px;
  margin: 16px 0;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.actions > * {
  flex: 1;
}
.full {
  width: 100%;
}
.notice {
  padding: 14px 16px;
  background: #fff2d9;
  color: #795018;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}
.slot {
  font-size: 36px;
  letter-spacing: 1px;
  font-weight: 750;
  margin: 10px 0;
}
.quantity {
  font-size: 23px;
  font-weight: 750;
  white-space: nowrap;
}
label {
  display: block;
  margin: 16px 0 7px;
  font-weight: 600;
}
input {
  width: 100%;
  min-height: 50px;
  border: 1px solid #bdc9d8;
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  font-size: 16px;
}
nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0;
}
nav button {
  flex: 1;
}
progress {
  width: 100%;
  height: 8px;
  accent-color: #315feb;
}
footer {
  font-size: 12px;
  color: #65758a;
  line-height: 1.7;
}
footer a {
  color: inherit;
}
#message:empty {
  display: none;
}
#message {
  position: fixed;
  bottom: 14px;
  left: 16px;
  right: 16px;
  max-width: 628px;
  margin: auto;
  background: #17263d;
  color: white;
  padding: 16px;
  border-radius: 14px;
  z-index: 10;
  box-shadow: 0 6px 30px #0003;
}
details {
  margin-top: 12px;
}
summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
}
.audit {
  font-size: 14px;
  border-bottom: 1px solid #e5eaf1;
  padding: 14px 0;
}
.audit pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px monospace;
}
.linkbox {
  overflow-wrap: anywhere;
  font-size: 14px;
}
a {
  color: #254fc6;
}
.status {
  font-size: 14px;
  color: #52677f;
}
.bottom {
  position: sticky;
  bottom: 0;
  background: #f4f6faf5;
  padding: 12px 0 max(12px, env(safe-area-inset-bottom));
}
[hidden] {
  display: none !important;
}
@media (max-width: 380px) {
  header,
  main,
  footer {
    padding: 16px;
  }
  .card {
    padding: 16px;
  }
  .actions {
    gap: 7px;
  }
  button {
    padding: 12px;
  }
}
:root .cabinet-link {
  display: block;
  background: #315feb;
  color: white;
  border-radius: 13px;
  padding: 14px 16px;
  min-height: 48px;
  text-align: center;
  font-weight: 600;
  text-decoration: none;
}
.completed-runs > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  min-height: 56px;
  padding: 16px;
  background: white;
  border: 1px solid #ccd5e1;
  border-radius: 13px;
  font-weight: 600;
}
.completed-runs > summary::-webkit-details-marker { display: none; }
.completed-runs > summary::after { content: "Показать ＋"; font-size: 14px; white-space: nowrap; color: #254fc6; }
.completed-runs[open] > summary::after { content: "Скрыть −"; }

/* A completed pick uses green text and checkmark, without a filled badge. */
.status.picked-status { color: #197044; font-weight: 600; }

/* Secondary picking actions are collapsed by default to keep the route clear. */
.run-more { border: 1px solid #ccd5e3; border-radius: 14px; background: #fff; }
.run-more > summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 12px 18px; list-style: none; font-weight: 600; cursor: pointer; }
.run-more > summary::-webkit-details-marker { display: none; }
.run-more > summary:focus-visible { outline: 3px solid #3e59ed; outline-offset: 3px; border-radius: 14px; }
.run-more[open] .run-more-chevron { transform: rotate(180deg); }
.run-more-items { display: grid; gap: 8px; padding: 0 12px 12px; }
.run-more-items button { margin: 0; min-height: 48px; text-align: left; }
.run-more-items .run-more-restart { margin-top: 8px; color: #8b4d17; }

/* Status filters wrap on phones without shrinking touch targets. */
.supply-tabs { display:flex; flex-wrap:wrap; gap:8px; margin:18px 0; }
.supply-tabs button { flex:1 1 100px; font-size:14px; padding:12px 8px; }
.supply-tabs button small { color:inherit; }

.photo-open { flex-shrink:0; padding:0; border:0; background:transparent; line-height:0; }
.photo-dialog { width:min(94vw,620px); max-height:90dvh; padding:16px; border:0; border-radius:16px; overflow:auto; }
.photo-dialog::backdrop { background:rgb(0 0 0 / 65%); }
.photo-close { display:block; margin:0 0 12px auto; position:sticky; top:0; background:white; }
.photo-dialog img { display:block; max-width:100%; max-height:70dvh; width:auto; height:auto; margin:auto; object-fit:contain; }
.photo-dialog img[hidden] { display:none; }
/* Large touch controls for receipt; checkbox must not inherit full-width text-input sizing. */
#return-slot { display:block; width:100%; min-height:48px; border:1px solid #cbd5e1; border-radius:12px; padding:10px; background:white; color:inherit; font:inherit; margin:8px 0 18px; }
#return-confirm input[type="checkbox"] { width:24px; height:24px; min-height:24px; display:inline-block; margin:0 8px 0 0; vertical-align:middle; }

/* Separate the scanner field from its action on every screen size. */
#return-scan button { margin-top:16px; }
#collector { width:100%; min-height:48px; padding:12px; border:1px solid #cbd5e1; border-radius:12px; font:inherit; background:white; margin:12px 0; }

/* Full identifiers stay visible; bold suffixes are only visual reference points. */
.packing-product { display:flex; gap:16px; align-items:center; }
.packing-product img { width:100px; height:100px; object-fit:contain; border-radius:10px; }
.packing-product > div { min-width:0; }
.packing-item { overflow-wrap:anywhere; }
.packing-size { font-size:22px; }
.packing-number { font-size:20px; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.packing-number strong { font-size:1.2em; }
.packing-controls { display:flex; gap:8px; flex-wrap:wrap; margin:16px 0; }
.packing-controls button { flex:1 1 170px; min-height:48px; }
.packing-status { font-weight:600; }
.packing-status.accepted { color:#197044; }
.packing-status.waiting { color:#865300; }
.packing-status.error { color:#a32020; }
.packing-status.local { color:#526074; }
.packing-dialog { width:min(92vw,520px); max-height:90dvh; overflow:auto; border:0; border-radius:16px; padding:20px; }
.packing-dialog::backdrop { background:rgb(0 0 0 / 55%); }
.packing-dialog button { margin-top:12px; min-height:48px; }
#matching-filter select { display:block; width:100%; min-width:0; min-height:48px; margin-top:6px; padding:10px; border:1px solid #cbd5e1; border-radius:12px; background:#fff; color:inherit; font:inherit; }
#packing-scan button { margin-top:14px; }
#packing-print-surface { display:none; }
@media print {
  @page { size:58mm 40mm; margin:0; }
  body.packing-printing { margin:0; padding:0; }
  body.packing-printing > * { display:none !important; }
  body.packing-printing > #packing-print-surface { display:block !important; width:58mm; height:40mm; margin:0; padding:0; }
  #packing-print-surface img { display:block; width:58mm; height:40mm; margin:0; transform:scale(.9); transform-origin:center; }
}

/* Keep the personal-device choice readable and tappable on phones. */
.personal-device { display:flex; align-items:center; gap:12px; }
.personal-device input[type="checkbox"] { flex:0 0 24px; width:24px; height:24px; min-height:24px; margin:0; }

.specification { min-width:0; }
.specification .spec-summary,.specification .spec-identifiers { display:flex; flex-wrap:wrap; gap:12px 24px; margin:12px 0; }
.specification .spec-row { border-top:1px solid var(--border,#e2e5ea); padding:16px 0; overflow-wrap:anywhere; }
.specification .spec-identifiers span { font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.specification .spec-summary > * { min-width:0; max-width:100%; }
.specification .personal-device strong { min-width:0; overflow-wrap:anywhere; }
#spec-tax select { width:100%; min-height:44px; }
#spec-tax .personal-device { margin:20px 0; }
.specification .integration-actions { flex-wrap:wrap; }
@media(max-width:600px){ .specification .spec-summary,.specification .spec-identifiers { flex-direction:column; gap:8px; } }

#spec-collaboration { overflow-wrap:anywhere; }
.spec-history-change {border-top:1px solid #ddd;padding:12px 0;overflow-wrap:anywhere;}
.spec-history-change pre {white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;}

.ui-dialog .spec-modal-body {max-height:60vh;overflow:auto;min-width:0;}

/* Compact document table. Hover never hides checked or keyboard-focused selection. */
.specification .spec-table-scroll {max-width:100%;overflow-x:auto;}
.specification .spec-table {width:100%;border-collapse:collapse;font-size:13px;table-layout:auto;}
.specification .spec-table th {font-size:12px;font-weight:500;color:var(--muted,#657188);text-align:left;white-space:nowrap;padding:10px 8px;border-bottom:1px solid var(--border,#e1e6ef);}
.specification .spec-table td {padding:5px 8px;border-bottom:1px solid var(--border,#e1e6ef);vertical-align:middle;}
.specification .spec-table .spec-row {padding:0;overflow-wrap:normal;border-top:0;transition:background-color .12s;}
.specification .spec-row:hover,.specification .spec-row:focus-within {background:#f3f6fc;}
.specification .spec-row.is-selected {background:#eaf0ff;}
.specification .spec-table .spec-choice {width:36px;padding:0;}
.specification .spec-choice label {display:flex;align-items:center;justify-content:center;min-width:36px;min-height:44px;margin:0;cursor:pointer;}
.specification .spec-choice input {width:17px;height:17px;min-height:0;margin:0;accent-color:#4964bd;cursor:pointer;}
.specification .spec-table .spec-thumb {width:40px;padding:4px;}
.specification .spec-thumb .photo-open {display:flex;width:40px;height:44px;min-height:44px;padding:2px;border:0;background:transparent;align-items:center;justify-content:center;}
.specification .spec-thumb .order-photo {width:32px;height:40px;object-fit:contain;border-radius:3px;}
.specification .spec-thumb .order-no-photo {width:32px;height:40px;min-width:0;min-height:0;font-size:0;margin:0;}
.specification .spec-thumb .order-no-photo svg {width:20px;height:20px;}
.specification .spec-product {min-width:160px;max-width:320px;}
.specification .spec-product strong {font-size:13px;font-weight:500;display:block;overflow-wrap:anywhere;}
.specification .spec-product > span {display:block;color:var(--muted,#657188);font-size:12px;margin-top:2px;}
.specification .spec-order,.specification .spec-uin {white-space:nowrap;font-variant-numeric:tabular-nums;}
.specification .spec-table .spec-number {text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums;}
.specification .spec-table .spec-individual {display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-height:44px;padding:4px 0;border:0;background:transparent;border-radius:4px;color:#4964bd;font-size:13px;text-decoration:underline;text-decoration-style:dotted;text-underline-offset:4px;}
.specification .spec-table .spec-individual:disabled {color:inherit;text-decoration:none;}
.specification .spec-price-mark {font-size:8px;}
.specification .spec-state {font-size:12px;color:var(--muted,#657188);white-space:nowrap;}
.specification .spec-table tr[hidden] {display:none!important;}
.specification .spec-selection-summary {font-size:13px;color:var(--muted,#657188);margin:10px 0;}
@media (hover:hover) and (pointer:fine) {
 .specification .spec-row .spec-select {opacity:0;}
 .specification .spec-row:hover .spec-select,.specification .spec-row:focus-within .spec-select,.specification .spec-select:checked {opacity:1;}
}
@media(max-width:700px) {
 .specification .spec-table thead {display:block;}
 .specification .spec-table thead tr {display:block;}
 .specification .spec-table th:not(.spec-choice) {display:none;}
 .specification .spec-table thead .spec-choice {display:block;width:100%;border:0;}
 .specification .spec-table thead .spec-choice label {justify-content:flex-start;gap:10px;padding:0 4px;}
 .specification .spec-table thead .spec-choice label::after {content:'Выбрать найденные';font-size:13px;}
 .specification .spec-table tbody {display:block;}
 .specification .spec-table .spec-row {display:grid;grid-template-columns:28px 40px minmax(0,1fr);gap:0;padding:8px 0;border-bottom:1px solid var(--border,#e1e6ef);}
 .specification .spec-table td {border:0;padding:3px 4px;min-width:0;}
 .specification .spec-table td.spec-choice {width:28px;grid-column:1;grid-row:1;}
 .specification .spec-choice label {min-width:28px;}
 .specification .spec-table td.spec-thumb {grid-column:2;grid-row:1;}
 .specification .spec-table td.spec-product {grid-column:3;grid-row:1;min-width:0;max-width:none;}
 .specification .spec-table td[data-label]:not(.spec-product) {grid-column:1 / -1;display:flex;justify-content:space-between;align-items:center;gap:8px;white-space:normal;text-align:right;font-size:13px;}
 .specification .spec-table td[data-label]:not(.spec-product)::before {content:attr(data-label);color:var(--muted,#657188);font-size:12px;text-align:left;}
 .specification .spec-row .spec-select {opacity:1;}
 .specification .spec-table .spec-individual {min-height:44px;}
}

.spec-document-header {display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;}
.spec-document-header p {margin:6px 0;overflow-wrap:anywhere;}
.spec-requisites-dialog {width:min(760px,calc(100vw - 32px));}
.spec-requisites-fields {max-height:60vh;overflow-y:auto;padding:0 4px;}
.spec-requisites-fields fieldset {margin:16px 0;padding:12px;border:1px solid #e1e6ef;border-radius:10px;min-width:0;}
.spec-requisites-fields legend {font-size:14px;font-weight:600;}
.spec-fields {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.spec-fields label {min-width:0;margin:0;font-size:14px;}
.spec-fields input,.spec-fields select {width:100%;min-height:44px;box-sizing:border-box;}
.spec-requisites-dialog h3 {font-size:16px;}
@media(max-width:600px){.spec-fields{grid-template-columns:1fr;}}

/* Field and its action remain aligned at mobile widths. */
.wb-preparation-field{display:flex;align-items:stretch;gap:8px}
.wb-preparation-field input{flex:1;min-width:0;margin:0}
.wb-preparation-field button{flex:none;margin:0}
.wb-preparation label{display:block;margin-bottom:8px}
.wb-preparation-rows{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:8px 24px}
.wb-preparation-rows p{overflow-wrap:anywhere}
.wb-order-select{display:flex;align-items:center;gap:8px;min-height:44px}
.wb-order-select input{width:20px;height:20px;margin:0}

/* DMDK exchange: field and action share a baseline; wrap on narrow screens. */
.spec-exchange-heading,.spec-exchange-controls{display:flex;align-items:end;gap:12px;flex-wrap:wrap}
.spec-exchange-heading{align-items:center;justify-content:space-between}
.spec-exchange-controls label{flex:1 1 260px;min-width:0;margin:0}
.spec-exchange-controls select{width:100%;min-width:0}
.spec-exchange button{max-width:100%;white-space:normal}
.spec-exchange p,.spec-exchange strong{overflow-wrap:anywhere}
@media(max-width:480px){.spec-exchange-controls label{flex-basis:100%}.spec-exchange-controls button{width:100%}}

.cabinet-content main .spec-exchange-controls label{margin:0}
.cabinet-content main .spec-exchange-controls select{display:block;margin-bottom:0}
