:root {
  color-scheme: light;
  --page: #f2f5f6;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #17242a;
  --muted: #6c7a82;
  --line: #d8e0e3;
  --line-strong: #c4cfd3;
  --accent: #087f7a;
  --accent-dark: #06645f;
  --accent-soft: #e7f4f1;
  --amber: #e7aa42;
  --amber-soft: #fff5df;
  --blue: #225f9f;
  --danger: #b23a3a;
  --danger-dark: #942f2f;
  --header: #16262d;
  --shadow: 0 8px 24px rgba(28, 43, 51, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

body.lightbox-open,
body.sampling-modal-open {
  overflow: hidden;
}

.arrival-pull-refresh {
  display: none;
}

@media (min-width: 721px) {
  [data-draggable-panel] {
    transform: translate3d(var(--modal-drag-x, 0), var(--modal-drag-y, 0), 0);
    will-change: transform;
  }

  [data-modal-drag-handle] {
    cursor: move;
    user-select: none;
  }

  [data-draggable-panel].is-modal-dragging {
    transition: none !important;
  }
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header);
  border-bottom: 3px solid var(--amber);
  color: #f6fbfb;
}

.header-main {
  display: grid;
  grid-template-columns: auto minmax(310px, 1fr) auto;
  gap: 28px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  margin: 0 auto;
  padding: 10px 24px;
}

.brand {
  display: grid;
  grid-template-columns: 58px auto;
  gap: 11px;
  align-items: center;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  width: 58px;
  height: 50px;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}

.brand > div {
  min-width: 0;
}

.brand h1,
.brand p,
.surface h2,
.surface p {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
  line-height: 1.2;
}

.brand p {
  margin-top: 3px;
  color: #a9bbbf;
  font-size: 11px;
}

.tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 7px;
  background: transparent;
  color: #c5d2d4;
  white-space: nowrap;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.tab.is-active {
  background: #243b44;
  box-shadow: inset 0 -3px 0 var(--amber);
  color: #fff;
  font-weight: 700;
}

.header-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, auto));
  gap: 6px;
}

.metric {
  min-width: 62px;
  padding: 5px 9px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.metric span,
.metric strong {
  display: block;
}

.metric span {
  color: #9fb0b5;
  font-size: 10px;
}

.metric strong {
  margin-top: 1px;
  color: #fff;
  font-size: 18px;
  line-height: 1.1;
}

.main-shell {
  width: 100%;
  margin: 0 auto;
  padding: 18px 24px 32px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.surface,
.search-toolbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px 16px;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.search-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.quick-search-control {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

.quick-search-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 122, 0.11);
}

.quick-search-control input {
  flex: 1 1 auto;
  width: 0;
  min-height: 36px;
  border: 0;
  padding: 8px 10px 8px 4px;
  box-shadow: none;
}

.quick-search-control input:focus {
  border: 0;
  box-shadow: none;
}

.quick-search-clear {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  margin-left: 4px;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: #718087;
  font-size: 19px;
  line-height: 1;
}

.quick-search-clear[hidden] {
  display: none;
}

.quick-search-clear:hover,
.quick-search-clear:focus-visible {
  background: #e8eff0;
  color: var(--ink);
}

.column-filter-control {
  height: 27px;
  min-height: 27px;
}

.column-filter-control .quick-search-clear {
  flex-basis: 20px;
  width: 20px;
  height: 20px;
  margin-left: 1px;
  font-size: 15px;
}

.column-filter-control input.column-filter {
  height: 25px;
  min-height: 25px;
  padding: 3px 4px;
  border: 0;
  box-shadow: none;
}

.column-filter-control input.column-filter:focus {
  border: 0;
  box-shadow: none;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #9aa7ad;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 122, 0.11);
}

select:disabled {
  background: #eef2f3;
  color: #8b989e;
}

.primary,
.secondary,
.danger {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 6px;
  color: #fff;
  white-space: nowrap;
  font-weight: 700;
}

.primary {
  background: var(--accent);
}

.secondary {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #405159;
}

.secondary:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.primary:hover {
  background: var(--accent-dark);
}

.danger {
  background: var(--danger);
}

.danger:hover {
  background: var(--danger-dark);
}

.primary:disabled,
.secondary:disabled,
.danger:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.search-action {
  min-width: 76px;
}

.search-workspace {
  display: grid;
  grid-template-columns: minmax(620px, 1.55fr) minmax(360px, 0.72fr);
  gap: 14px;
  height: calc(100dvh - 190px);
  min-height: 440px;
  align-items: stretch;
}

.results-surface,
.detail-surface,
.preview-surface,
.form-surface {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.results-surface,
.detail-surface,
.preview-surface {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.results-surface {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.results-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 48px;
  gap: 12px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}

.results-footer-copy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 12px;
  min-width: 0;
}

.results-more-hint {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid #b9d8d2;
  border-radius: 5px;
  background: #edf7f5;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.record-multi-select-hint {
  color: #7d8d92;
  font-size: 10px;
  white-space: nowrap;
}

.record-multi-select-hint.is-active {
  color: #087f7a;
  font-weight: 700;
}

.results-more-hint strong {
  margin: 0 2px;
  color: var(--accent-dark);
  font-size: 11px;
}

.results-more-hint.is-complete {
  border-color: var(--line);
  background: #f2f5f6;
  color: var(--muted);
}

.results-footer .secondary {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
}

.surface-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.surface-head h2 {
  font-size: 16px;
  line-height: 1.25;
}

.surface-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.surface-head > strong {
  color: var(--accent-dark);
  font-size: 14px;
  white-space: nowrap;
}

.arrival-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.arrival-head-actions > strong {
  color: var(--accent-dark);
  font-size: 14px;
  white-space: nowrap;
}

.arrival-export-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 6px;
  font-size: 11px;
}

.arrival-export-button > span[aria-hidden="true"] {
  font-size: 15px;
  line-height: 1;
}

.status-chip,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf1f2;
  color: #53636b;
  font-size: 11px;
  white-space: nowrap;
}

.tag.good,
.status-chip.good {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.tag.warn,
.status-chip.warn {
  background: var(--amber-soft);
  color: #8e5a0c;
}

.table-wrap {
  min-height: 0;
  overflow: auto;
  scrollbar-color: #aebbc0 transparent;
  scrollbar-width: thin;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid #e8edef;
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 10;
  vertical-align: top;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

th:nth-child(1),
td:nth-child(1) {
  width: 86px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 122px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 132px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 34%;
}

th:nth-child(5),
td:nth-child(5) {
  width: auto;
}

.column-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 20px;
  gap: 4px;
  margin-bottom: 5px;
}

.column-heading > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-sort-buttons {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
}

.column-sort-button {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f7f9f9;
  color: #7c898f;
  font-size: 10px;
  line-height: 1;
}

.column-sort-button:hover,
.column-sort-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.column-sort-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.column-filter {
  height: 27px;
  min-height: 27px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 400;
}

select.column-filter {
  padding-right: 20px;
}

.picker-only-date {
  cursor: pointer;
  caret-color: transparent;
}

.picker-only-date::-webkit-date-and-time-value {
  text-align: left;
}

.entry-date-cell {
  color: #4f626b;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

tbody tr {
  cursor: pointer;
  transition: background-color 120ms ease;
}

tbody tr:hover {
  background: #f5faf9;
}

tbody tr.is-selected {
  background: #e8f4f1;
  box-shadow: inset 3px 0 0 var(--accent);
}

.arrival-results-surface tbody tr.is-multi-selected {
  background: #edf8f6;
  box-shadow: inset 3px 0 0 #42a99f;
}

.arrival-results-surface tbody tr.is-multi-selected.is-selected {
  background: #def2ee;
  box-shadow: inset 4px 0 0 var(--accent);
}

td strong {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.sample-id {
  color: var(--blue);
  font-weight: 700;
}

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

.cell-subtitle {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-name-highlight {
  color: #102f3a;
  font-weight: 800;
}

.table-model-highlight {
  display: inline-block;
  max-width: 100%;
  border-left: 3px solid var(--accent);
  padding: 3px 7px;
  background: #edf7f5;
  color: var(--accent-dark);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.mobile-model {
  display: none;
}

.result-image-button {
  position: relative;
  z-index: 0;
  isolation: isolate;
  display: block;
  width: 50px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
}

.result-image-layer {
  position: absolute;
  display: grid;
  place-items: center;
  width: 34px;
  height: 32px;
  overflow: hidden;
  border: 1px solid #bac6ca;
  border-radius: 4px;
  background: #fff;
  box-shadow: 1px 1px 3px rgba(20, 36, 43, 0.14);
}

.result-image-layer.is-stack-0 {
  top: 1px;
  left: 0;
  z-index: 3;
}

.result-image-layer.is-stack-1 {
  top: 2px;
  left: 7px;
  z-index: 2;
}

.result-image-layer.is-stack-2 {
  top: 3px;
  left: 14px;
  z-index: 1;
}

.result-image-button.has-multiple .result-image-layer {
  box-shadow: 1px 1px 0 #fff, 2px 2px 4px rgba(20, 36, 43, 0.2);
}

.result-image-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-image-button:hover .result-image-layer.is-stack-0,
.result-image-button:focus-visible .result-image-layer.is-stack-0 {
  border-color: var(--accent);
}

.no-image-mini {
  display: grid;
  place-items: center;
  width: 46px;
  height: 34px;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  color: #8a979d;
  font-size: 10px;
}

.detail-surface {
  background: #fbfcfc;
}

.detail-body {
  min-height: 0;
  overflow: hidden;
}

.detail-content {
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.sample-edit-form {
  display: grid;
  gap: 13px;
}

.sample-highlight-fields,
.sample-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sample-edit-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.sample-highlight-fields label {
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 10px;
  background: #eaf5f2;
  color: var(--accent-dark);
  font-weight: 800;
}

.sample-highlight-fields input {
  min-height: 43px;
  border-color: #b9d9d2;
  color: #102f3a;
  font-size: 15px;
  font-weight: 800;
}

.sample-user-remark textarea {
  min-height: 92px;
}

.sample-save-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.sample-save-row span {
  color: var(--muted);
  font-size: 11px;
}

.sample-save-row .primary:disabled {
  cursor: default;
  opacity: 0.45;
}

.detail-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-summary h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.detail-summary p {
  margin: 5px 0 0;
  color: var(--muted);
}

.location-badge {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid #c9e2dc;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.gallery-section {
  margin-top: 16px;
}

.detail-gallery-drop-zone {
  border-top: 1px solid var(--line);
  padding-top: 15px;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.detail-gallery-drop-zone.is-dragover {
  background: #edf8f6;
  box-shadow: inset 0 0 0 2px rgba(8, 127, 122, 0.12);
}

.detail-gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-image-tile {
  position: relative;
  flex: 0 0 92px;
  width: 92px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

.detail-image-preview {
  width: 100%;
  height: 100%;
  padding: 4px;
  background: #fff;
}

.detail-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-image-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 2;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: rgba(18, 38, 46, 0.78);
  color: #fff;
  font-size: 13px;
  line-height: 1;
}

.detail-image-remove:hover {
  background: #b83a3a;
}

.detail-image-order {
  position: absolute;
  right: 3px;
  bottom: 3px;
  min-width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(18, 38, 46, 0.74);
  color: #fff;
  font-size: 8px;
  line-height: 16px;
  text-align: center;
}

.detail-image-tools {
  position: absolute;
  left: 3px;
  bottom: 3px;
  z-index: 2;
  display: flex;
  gap: 2px;
}

.detail-image-tool {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(18, 38, 46, 0.78);
  color: #fff;
  font-size: 9px;
  line-height: 1;
}

.detail-image-add {
  display: grid;
  place-items: center;
  border-style: dashed;
  color: #75858d;
}

.detail-image-add span {
  font-size: 32px;
  font-weight: 300;
}

.detail-image-add:hover,
.detail-image-add:focus-visible {
  border-color: var(--accent);
  background: #f0f8f7;
  color: var(--accent);
}

.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.detail-section-head h4 {
  margin: 0;
  font-size: 13px;
}

.detail-section-head span {
  color: var(--muted);
  font-size: 11px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.gallery-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.gallery-thumb:hover,
.gallery-thumb:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 122, 0.1);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-thumb span {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(22, 38, 45, 0.85);
  color: #fff;
  font-size: 10px;
}

.empty-gallery {
  display: grid;
  place-items: center;
  min-height: 96px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}

.detail-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 16px 0 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.field-pair {
  min-width: 0;
  padding: 10px 11px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.field-pair dt {
  color: var(--muted);
  font-size: 10px;
}

.field-pair dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.remark-block {
  margin-top: 14px;
  padding: 12px;
  border-left: 3px solid var(--amber);
  background: #fffaf0;
  color: #5e5547;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 20px 16px;
  color: var(--muted);
  line-height: 1.65;
}

#intakeView {
  min-height: 0;
}

#intakeView.is-active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 520px;
}

.form-workspace {
  display: grid;
  grid-template-columns: minmax(520px, 0.9fr) minmax(420px, 1.1fr);
  gap: 14px;
  align-items: stretch;
  min-height: 690px;
}

.intake-batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intake-batch-toolbar > div,
.intake-result-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.intake-batch-toolbar strong {
  font-size: 16px;
}

.intake-batch-toolbar span,
.intake-write-status,
#intakeDraftStatus,
#intakeWriteStatus {
  color: var(--muted);
  font-size: 12px;
}

.intake-add-card {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.intake-add-card > span:first-child {
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
}

.intake-batch-form {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.intake-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: max-content;
  flex: 1 1 auto;
  gap: 9px;
  align-items: start;
  align-content: start;
  min-height: 0;
  padding: 2px 4px 8px 2px;
  overflow-y: auto;
  scrollbar-color: #aebbc0 transparent;
  scrollbar-width: thin;
}

.intake-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intake-card:focus-within {
  border-color: #93bcb8;
  box-shadow: 0 0 0 3px rgba(8, 127, 122, 0.08), var(--shadow);
}

.intake-card-head {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 0;
  padding: 10px;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}

.intake-card-head > div:first-child {
  min-width: 0;
}

.intake-card-head span,
.intake-card-head strong {
  display: block;
}

.intake-card-head > div:first-child > span {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 700;
}

.intake-card-head strong {
  margin-top: 2px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intake-card-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.compact-command {
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
}

.intake-remove-card {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.intake-remove-card:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.intake-card-fields {
  display: grid;
  grid-template-columns: minmax(500px, 1.65fr) minmax(260px, 0.8fr) minmax(190px, 0.65fr);
  gap: 10px;
  align-items: stretch;
  min-width: 0;
  padding: 9px 10px;
}

.intake-card-data {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 6px 10px;
  align-content: start;
  min-width: 0;
}

.intake-card-data label {
  gap: 4px;
}

.intake-card-data input {
  min-height: 34px;
  padding: 6px 8px;
}

.intake-card-images,
.intake-card-remark {
  min-width: 0;
}

.intake-card-remark {
  grid-template-rows: auto minmax(84px, 1fr);
}

.intake-card-remark textarea {
  height: 100%;
  min-height: 84px;
  padding: 7px 8px;
}

.intake-card .image-drop-zone {
  min-height: 84px;
  padding: 6px;
}

.intake-card .image-upload-head {
  margin-bottom: 4px;
}

.intake-card .image-upload-grid {
  gap: 6px;
}

.intake-card .image-upload-tile {
  flex-basis: 64px;
  width: 64px;
}

.intake-card .image-upload-remove {
  top: 3px;
  right: 3px;
  width: 19px;
  height: 19px;
  font-size: 15px;
}

.intake-card .image-upload-order {
  right: 3px;
  bottom: 3px;
  min-width: 17px;
  height: 17px;
  font-size: 9px;
  line-height: 17px;
}

.intake-card .image-upload-add span {
  font-size: 24px;
}

.intake-batch-error {
  margin: 14px 0 0;
}

.intake-batch-actions {
  position: static;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -7px 20px rgba(28, 43, 51, 0.08);
  backdrop-filter: blur(8px);
}

.intake-batch-actions > div {
  display: flex;
  gap: 9px;
}

.intake-result {
  margin-top: 14px;
  border: 1px solid #abd3ca;
  border-radius: 7px;
  padding: 13px;
  background: #f2fbf8;
}

.intake-result-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.intake-result-head span {
  color: var(--accent-dark);
  font-size: 11px;
}

.intake-result-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

.intake-result-items button {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  text-align: left;
}

.intake-result-items button:hover {
  border-color: var(--accent);
}

.intake-result-items strong,
.intake-result-items span,
.intake-result-items small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intake-result-items strong {
  color: var(--blue);
  font-size: 12px;
}

.intake-result-items span {
  margin-top: 3px;
  color: var(--ink);
  font-size: 11px;
}

.intake-result-items small {
  margin-top: 3px;
  color: var(--muted);
}

.form-surface {
  padding-bottom: 16px;
  overflow: visible;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 16px;
}

.wide {
  grid-column: 1 / -1;
}

.required {
  color: #425159;
}

.image-upload-field {
  min-width: 0;
}

.image-upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: #425159;
}

.image-upload-head span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.image-drop-zone {
  position: relative;
  min-height: 126px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  padding: 10px;
  background: #f8fafb;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.image-drop-zone.is-dragover {
  border-color: var(--accent);
  background: #edf8f6;
  box-shadow: inset 0 0 0 2px rgba(8, 127, 122, 0.12);
}

.image-file-input {
  position: absolute;
  width: 1px !important;
  height: 1px;
  min-height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  padding: 0;
  border: 0;
}

.image-upload-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}

.image-upload-tile {
  position: relative;
  flex: 0 0 104px;
  width: 104px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
}

.image-upload-preview {
  width: 100%;
  height: 100%;
  padding: 0;
  background: #fff;
}

.image-upload-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-upload-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(18, 38, 46, 0.78);
  color: #fff;
  font-size: 19px;
  line-height: 1;
}

.image-upload-remove:hover {
  background: #b83a3a;
}

.image-upload-order {
  position: absolute;
  right: 5px;
  bottom: 5px;
  min-width: 20px;
  height: 20px;
  border-radius: 4px;
  background: rgba(18, 38, 46, 0.74);
  color: #fff;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}

.image-upload-add {
  display: grid;
  place-items: center;
  border-style: dashed;
  background: #fff;
  color: #75858d;
}

.image-upload-add span {
  font-size: 34px;
  font-weight: 300;
  line-height: 1;
}

.image-upload-add:hover,
.image-upload-add:focus-visible {
  border-color: var(--accent);
  background: #f0f8f7;
  color: var(--accent);
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 16px;
  padding: 0 16px 15px;
}

.checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  color: var(--ink);
}

.checks input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.actions {
  display: flex;
  gap: 10px;
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -8px 20px rgba(28, 43, 51, 0.06);
}

.form-error {
  margin: 0 16px 10px;
  padding: 9px 10px;
  border-left: 3px solid var(--danger);
  background: #fff1f1;
  color: #8d2f2f;
  font-size: 12px;
  line-height: 1.5;
}

.preview-content {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.preview-block {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fff;
}

.preview-block h3 {
  margin: 0 0 10px;
  font-size: 13px;
}

.use-primary-space {
  width: 100%;
  margin-top: 12px;
}

.space-candidate-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.space-candidate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.space-candidate:last-child {
  border-bottom: 0;
}

.space-candidate span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.space-candidate .secondary {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
}

.preview-block ul {
  margin: 0;
  padding-left: 18px;
}

.preview-block li + li {
  margin-top: 6px;
}

.kv {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px 12px;
  line-height: 1.5;
}

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

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 20px;
}

.lightbox.is-open {
  display: grid;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 15, 18, 0.88);
}

.lightbox-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(1180px, calc(100vw - 40px));
  height: min(900px, calc(100vh - 40px));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #111b20;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  color: #fff;
  overflow: hidden;
}

.lightbox-panel,
.lightbox-panel * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.lightbox-panel img {
  -webkit-user-drag: none;
}

.lightbox-panel button {
  -webkit-tap-highlight-color: transparent;
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 8px 10px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
}

.lightbox-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.zoom-level {
  min-width: 48px;
  color: #d8e2e4 !important;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.viewer-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.viewer-button:hover {
  background: rgba(255, 255, 255, 0.17);
}

.viewer-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.viewer-save-button {
  border-color: rgba(88, 204, 160, 0.55);
  background: rgba(32, 135, 97, 0.3);
}

.viewer-save-button:hover:not(:disabled) {
  background: rgba(32, 135, 97, 0.52);
}

.lightbox-toolbar strong,
.lightbox-toolbar span {
  display: block;
}

.lightbox-toolbar span {
  margin-top: 2px;
  color: #9eb0b5;
  font-size: 11px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 27px;
  line-height: 1;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0;
  background: #0b1215;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

.lightbox-stage.is-dragging {
  cursor: grabbing;
}

.lightbox-stage.is-pinching {
  cursor: zoom-in;
}

.lightbox-stage.is-double-zooming {
  cursor: ns-resize;
}

.lightbox-stage.is-swipe-settling .lightbox-image-positioner,
.lightbox-stage.is-swipe-settling .lightbox-adjacent-positioner,
.lightbox-stage.is-swipe-settling .lightbox-preview-image {
  transition: transform 220ms cubic-bezier(0.22, 0.72, 0.24, 1);
}

.lightbox-stage.is-zoom-settling .lightbox-image-positioner,
.lightbox-stage.is-zoom-settling #lightboxImage {
  transition: transform 180ms cubic-bezier(0.22, 0.72, 0.24, 1);
}

.lightbox-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(17, 27, 32, 0.82);
  color: #d8e2e4;
  font-size: 13px;
  pointer-events: none;
}

.lightbox-loading.has-preview {
  top: auto;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: rgba(17, 27, 32, 0.72);
  font-size: 11px;
}

.lightbox-stage .lightbox-preview-image {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  pointer-events: none;
  transform: translate(-50%, -50%) translate3d(0, 0, 0);
  will-change: transform;
}

.lightbox-stage .lightbox-preview-image[hidden] {
  display: none;
}

.lightbox-image-positioner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  backface-visibility: hidden;
  will-change: transform;
}

.lightbox-adjacent-positioner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  pointer-events: none;
  will-change: transform;
}

.lightbox-adjacent-positioner[hidden] {
  display: none;
}

.lightbox-stage .lightbox-adjacent-image {
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  pointer-events: none;
  transform: none;
}

.lightbox-stage .lightbox-swipe-carry {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.lightbox-stage .lightbox-swipe-carry[hidden] {
  display: none;
}

.lightbox-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  pointer-events: auto;
  -webkit-user-drag: none;
  backface-visibility: hidden;
  transform-origin: center;
  will-change: transform;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  font-size: 34px;
}

.lightbox-nav.previous {
  left: 12px;
}

.lightbox-nav.next {
  right: 12px;
}

.lightbox-nav:disabled {
  display: none;
}

.lightbox-thumbnails {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 84px;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  background: #111b20;
  overflow-x: auto;
}

.lightbox-thumbnail {
  position: relative;
  flex: 0 0 94px;
  width: 94px;
  height: 62px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0.68;
  overflow: hidden;
}

.lightbox-thumbnail:hover,
.lightbox-thumbnail:focus-visible {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.48);
}

.lightbox-thumbnail.is-active {
  border-color: var(--amber);
  background: rgba(231, 170, 66, 0.13);
  opacity: 1;
}

.lightbox-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox-thumbnail span {
  position: absolute;
  right: 3px;
  bottom: 3px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: rgba(6, 13, 16, 0.82);
  color: #fff;
  font-size: 9px;
}

.lightbox-caption {
  min-height: 48px;
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  color: #bdc9cc;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.image-context-menu {
  position: fixed;
  z-index: 300;
  width: 210px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  background: #202527;
  box-shadow: 0 14px 36px rgba(8, 15, 18, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top left;
  transition: opacity 100ms ease, transform 100ms ease, visibility 100ms;
  pointer-events: none;
}

.image-context-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.image-context-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 4px;
  background: transparent;
  color: #f4f7f7;
  font-size: 13px;
  text-align: left;
}

.image-context-menu button:hover,
.image-context-menu button:focus-visible {
  background: #087f7a;
  color: #fff;
  outline: none;
}

.image-context-separator {
  height: 1px;
  margin: 4px 6px;
  background: rgba(255, 255, 255, 0.13);
}

body.product-compare-open {
  overflow: hidden;
}

.product-compare-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 14px;
}

.product-compare-modal.is-open {
  display: grid;
}

.product-compare-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 12, 0.9);
}

.product-compare-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(1540px, 100%);
  height: min(920px, calc(100dvh - 28px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #111b20;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.52);
  color: #f4f7f7;
}

.product-compare-panel,
.product-compare-panel * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.product-compare-panel input {
  -webkit-user-select: text;
  user-select: text;
}

.product-compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
  background: #111b20;
}

.product-compare-head > div {
  min-width: 0;
}

.product-compare-head span,
.product-compare-head h2,
.product-compare-head p {
  display: block;
}

.product-compare-head span {
  color: #e7aa42;
  font-size: 10px;
  font-weight: 800;
}

.product-compare-head h2 {
  margin: 2px 0 0;
  color: #fff;
  font-size: 17px;
}

.product-compare-head p {
  max-width: 70vw;
  margin: 2px 0 0;
  overflow: hidden;
  color: #9eb0b5;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-compare-head .icon-button {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  font-size: 22px;
}

.product-compare-search-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  min-height: 52px;
  padding: 8px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
  background: #10191d;
}

.product-compare-search-slot {
  position: relative;
  grid-column: 2;
  min-width: 0;
  padding-left: 10px;
}

.product-compare-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 0;
  background: #0b1215;
}

.product-compare-side {
  display: grid;
  grid-template-rows: 24px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: 8px 10px 10px;
  background: #0d1519;
}

.product-compare-side + .product-compare-side {
  border-left: 1px solid rgba(255, 255, 255, 0.11);
  background: #0f181c;
}

.product-compare-side-title {
  min-height: 0;
  color: #c9d3d5;
  font-size: 12px;
  font-weight: 800;
}

.product-compare-search-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.product-compare-search-form label {
  color: #bdc9cc;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.product-compare-search-form input {
  width: 100%;
  min-height: 36px;
  border-color: rgba(255, 255, 255, 0.15);
  background: #1a272c;
  color: #fff;
  font-size: 12px;
}

.product-compare-search-form input::placeholder {
  color: #72858b;
}

.product-compare-search-form input:focus {
  border-color: #3aa8a2;
  box-shadow: 0 0 0 2px rgba(58, 168, 162, 0.18);
}

.product-compare-search-form button {
  min-height: 36px;
  padding: 0 14px;
  border-color: rgba(255, 255, 255, 0.17);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.product-compare-search-scopes {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-top: 6px;
}

.product-compare-search-scopes button {
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  color: #aebdc1;
  font-size: 10px;
  font-weight: 700;
}

.product-compare-search-scopes button:hover,
.product-compare-search-scopes button:focus-visible,
.product-compare-search-scopes button.is-active {
  border-color: #3aa8a2;
  background: #087f7a;
  color: #fff;
  outline: none;
}

.product-compare-search-scopes > span {
  min-width: 0;
  overflow: hidden;
  color: #72858b;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-compare-search-results {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  left: 10px;
  z-index: 30;
  max-height: min(330px, 42vh);
  overflow: auto;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: #172328;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.48);
}

.product-compare-search-results[hidden] {
  display: none;
}

.product-compare-search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 0.72fr);
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 45px;
  padding: 6px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: transparent;
  color: #edf2f3;
  text-align: left;
}

.product-compare-search-result:first-child {
  border-top: 0;
}

.product-compare-search-result:hover,
.product-compare-search-result:focus-visible,
.product-compare-search-result.is-selected {
  background: #087f7a;
  color: #fff;
  outline: none;
}

.product-compare-search-result > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.product-compare-search-result strong,
.product-compare-search-result small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-compare-search-result strong {
  font-size: 11px;
}

.product-compare-search-result small {
  color: #9eb0b5;
  font-size: 10px;
}

.product-compare-search-result:hover small,
.product-compare-search-result:focus-visible small,
.product-compare-search-result.is-selected small {
  color: #d8eceb;
}

.product-compare-search-empty,
.product-compare-product-state {
  display: grid;
  min-width: 0;
  min-height: 100px;
  place-items: center;
  padding: 14px;
  color: #93a5aa;
  font-size: 11px;
  text-align: center;
}

.product-compare-search-empty.is-error,
.product-compare-product-state.is-error {
  color: #ff9d9d;
}

.product-compare-product-host {
  min-width: 0;
  min-height: 0;
}

.product-compare-product {
  display: grid;
  grid-template-rows: 81px minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  gap: 7px;
}

.product-compare-info {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 38px;
  gap: 5px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.product-compare-info > div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 3px;
  background: #182328;
}

.product-compare-info span {
  color: #86999f;
  font-size: 9px;
}

.product-compare-info strong {
  overflow: hidden;
  color: #f4f7f7;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-compare-viewer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 70px auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: #111b20;
}

.product-compare-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  min-height: 40px;
  padding: 4px 6px 4px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
  background: #111b20;
}

.product-compare-viewer-label {
  min-width: 0;
  overflow: hidden;
  color: #bdc9cc;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-compare-viewer-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 3px;
}

.product-compare-viewer-action,
.product-compare-viewer-text-action {
  flex: 0 0 auto;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 14px;
}

.product-compare-viewer-text-action {
  font-size: 10px;
  font-weight: 700;
}

.product-compare-viewer-action:hover,
.product-compare-viewer-action:focus-visible,
.product-compare-viewer-text-action:hover,
.product-compare-viewer-text-action:focus-visible {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.17);
  outline: none;
  outline-offset: 1px;
}

.product-compare-viewer-action:disabled,
.product-compare-viewer-text-action:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.product-compare-viewer-zoom {
  min-width: 38px;
  color: #d8e2e4;
  font-size: 10px;
  text-align: center;
}

.product-compare-viewer-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #060c0f;
  cursor: grab;
  isolation: isolate;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
}

.product-compare-viewer-stage.is-dragging {
  cursor: grabbing;
}

.product-compare-viewer-stage.is-swipe-settling .product-compare-viewer-image-positioner,
.product-compare-viewer-stage.is-swipe-settling .product-compare-viewer-adjacent-positioner {
  transition: transform 220ms cubic-bezier(0.22, 0.72, 0.24, 1);
}

.product-compare-viewer-image-positioner,
.product-compare-viewer-adjacent-positioner {
  position: absolute;
  left: 50%;
  top: 50%;
  backface-visibility: hidden;
  will-change: transform;
}

.product-compare-viewer-image-positioner {
  z-index: 2;
}

.product-compare-viewer-adjacent-positioner {
  z-index: 1;
  pointer-events: none;
}

.product-compare-viewer-image-positioner[hidden],
.product-compare-viewer-adjacent-positioner[hidden] {
  display: none;
}

.product-compare-viewer-image,
.product-compare-viewer-adjacent-image,
.product-compare-viewer-swipe-carry {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  -webkit-user-drag: none;
  backface-visibility: hidden;
  transform-origin: center;
  will-change: transform;
}

.product-compare-viewer-adjacent-image {
  pointer-events: none;
}

.product-compare-viewer-swipe-carry {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.product-compare-viewer-image[hidden],
.product-compare-viewer-swipe-carry[hidden] {
  display: none;
}

.product-compare-viewer-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: rgba(17, 27, 32, 0.88);
  color: #d8e2e4;
  font-size: 11px;
  pointer-events: none;
}

.product-compare-viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 34px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 29px;
  line-height: 1;
  transform: translateY(-50%);
}

.product-compare-viewer-nav.previous {
  left: 7px;
}

.product-compare-viewer-nav.next {
  right: 7px;
}

.product-compare-viewer-nav:disabled {
  display: none;
}

.product-compare-viewer-nav:hover,
.product-compare-viewer-nav:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

.product-compare-thumbnails {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  min-height: 70px;
  padding: 7px 9px;
  overflow-x: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  background: #111b20;
  scrollbar-width: thin;
}

.product-compare-thumbnail {
  position: relative;
  flex: 0 0 76px;
  width: 76px;
  height: 54px;
  padding: 2px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0.66;
}

.product-compare-thumbnail:hover,
.product-compare-thumbnail:focus-visible {
  border-color: rgba(255, 255, 255, 0.46);
  opacity: 1;
  outline: none;
}

.product-compare-thumbnail.is-active {
  border-color: #e7aa42;
  background: rgba(231, 170, 66, 0.13);
  opacity: 1;
}

.product-compare-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-compare-thumbnail span {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: rgba(3, 8, 10, 0.82);
  color: #fff;
  font-size: 9px;
}

.product-compare-thumbnails-empty {
  width: 100%;
  color: #71858b;
  font-size: 10px;
  text-align: center;
}

.product-compare-viewer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 25px;
  padding: 3px 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  background: #111b20;
  color: #9eb0b5;
  font-size: 10px;
}

.product-compare-viewer-footer span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-compare-no-image {
  display: grid;
  position: absolute;
  inset: 0;
  place-items: center;
  color: #72858b;
  font-size: 11px;
}

.product-compare-no-image[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .product-compare-modal {
    padding: 0;
  }

  .product-compare-panel {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .product-compare-search-strip {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px 10px;
  }

  .product-compare-search-slot {
    grid-column: 1;
    padding-left: 0;
  }

  .product-compare-search-results {
    right: 0;
    left: 0;
  }

  .product-compare-body {
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .product-compare-side,
  .product-compare-source-side,
  .product-compare-target-side {
    min-height: 560px;
    border-left: 0;
  }

  .product-compare-side + .product-compare-side {
    border-top: 1px solid var(--line);
  }

  .product-compare-target-side {
    min-height: 560px;
  }

  .product-compare-info {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 38px;
  }

  .product-compare-product {
    grid-template-rows: 124px minmax(0, 1fr);
  }

  .product-compare-search-results {
    max-height: min(300px, 45vh);
  }
}

@media (max-width: 420px) {
  .product-compare-head {
    padding: 9px 10px;
  }

  .product-compare-side {
    padding: 9px 10px 10px;
  }

  .product-compare-search-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .product-compare-search-form label {
    display: none;
  }

  .product-compare-search-scopes > span {
    display: none;
  }

  .product-compare-search-result {
    grid-template-columns: minmax(0, 1fr) minmax(100px, 0.7fr);
  }

  .product-compare-viewer-label {
    max-width: 78px;
  }

  .product-compare-viewer-action,
  .product-compare-viewer-text-action {
    min-width: 27px;
    padding: 0 5px;
  }

  .product-compare-viewer-zoom {
    min-width: 34px;
  }

  .product-compare-thumbnail {
    flex-basis: 70px;
    width: 70px;
  }
}

body.image-editor-open {
  overflow: hidden;
}

body.basic-recognition-open {
  overflow: hidden;
}

.basic-recognition-modal {
  position: fixed;
  inset: 0;
  z-index: 335;
  display: none;
  place-items: center;
  padding: 14px;
}

.basic-recognition-modal.is-open {
  display: grid;
}

.basic-recognition-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 20, 24, 0.68);
}

.basic-recognition-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1180px, 100%);
  height: min(760px, calc(100dvh - 28px));
  overflow: hidden;
  border: 1px solid #cbd7d9;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(8, 20, 24, 0.34);
}

.basic-recognition-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.basic-recognition-head > div {
  min-width: 0;
}

.basic-recognition-head span,
.basic-recognition-head h2,
.basic-recognition-head p {
  margin: 0;
}

.basic-recognition-head span {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
}

.basic-recognition-head h2 {
  margin-top: 2px;
  font-size: 17px;
}

.basic-recognition-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.basic-recognition-head .icon-button {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid #c8d3d5;
  border-radius: 6px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 22px;
}

.basic-recognition-head .icon-button:hover,
.basic-recognition-head .icon-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.basic-recognition-body {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  min-height: 0;
}

.basic-recognition-image-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: #edf3f3;
}

.basic-recognition-image-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 34px;
  padding: 3px 4px 3px 9px;
  border: 1px solid #c7d3d5;
  border-radius: 6px;
  background: #f8fbfb;
  color: var(--ink-soft);
}

.basic-recognition-image-heading {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 7px;
}

.basic-recognition-image-heading > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.basic-recognition-image-heading > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.basic-recognition-image-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 3px;
}

.basic-recognition-viewer-button {
  display: grid;
  place-items: center;
  width: 29px;
  height: 28px;
  padding: 0;
  border: 1px solid #c4d0d2;
  border-radius: 5px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.basic-recognition-viewer-button:hover,
.basic-recognition-viewer-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.basic-recognition-viewer-text-button {
  width: auto;
  min-width: 43px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.basic-recognition-zoom-level {
  display: grid;
  place-items: center;
  min-width: 43px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.basic-recognition-image-stage {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid #c7d3d5;
  border-radius: 6px;
  background: #fff;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.basic-recognition-image-stage.is-dragging {
  cursor: grabbing;
}

.basic-recognition-image-stage.is-panning {
  cursor: grabbing;
}

.basic-recognition-image-stage.is-swipe-settling .basic-recognition-image-positioner,
.basic-recognition-image-stage.is-swipe-settling .basic-recognition-image-adjacent-positioner {
  transition: transform 220ms cubic-bezier(0.22, 0.72, 0.24, 1);
}

.basic-recognition-image-positioner,
.basic-recognition-image-adjacent-positioner {
  position: absolute;
  left: 50%;
  top: 50%;
  backface-visibility: hidden;
  will-change: transform;
}

.basic-recognition-image-positioner {
  z-index: 2;
}

.basic-recognition-image-adjacent-positioner {
  z-index: 1;
  pointer-events: none;
}

.basic-recognition-image-adjacent-positioner[hidden] {
  display: none;
}

.basic-recognition-image-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  transform-origin: center;
  will-change: transform;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.basic-recognition-image-stage img[hidden] {
  display: none;
}

.basic-recognition-image-stage .basic-recognition-image-adjacent {
  pointer-events: none;
  transform: none;
}

.basic-recognition-image-stage .basic-recognition-image-swipe-carry {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.basic-recognition-image-nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 34px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid rgba(9, 20, 24, 0.16);
  border-radius: 4px;
  background: rgba(9, 20, 24, 0.5);
  color: #fff;
  font-size: 29px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}

.basic-recognition-image-nav.previous {
  left: 7px;
}

.basic-recognition-image-nav.next {
  right: 7px;
}

.basic-recognition-image-nav:disabled {
  display: none;
}

.basic-recognition-image-nav:hover,
.basic-recognition-image-nav:focus-visible {
  background: rgba(9, 20, 24, 0.68);
  outline: none;
}

.basic-recognition-image-stage > span {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 24px);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
  text-align: center;
}

.basic-recognition-form {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: #fff;
}

.basic-recognition-loading {
  display: grid;
  min-height: 100%;
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 28px;
  text-align: center;
}

.basic-recognition-loading strong {
  color: var(--ink);
  font-size: 15px;
}

.basic-recognition-loading span {
  max-width: 360px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.basic-recognition-fields {
  min-width: 0;
}

.basic-recognition-name-match {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.basic-recognition-name-match.is-exact {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.basic-recognition-name-match.is-alias {
  background: var(--amber-soft);
  color: #76510d;
}

.basic-recognition-name-match.is-unmatched,
.basic-recognition-name-match.is-empty {
  background: #f5f7f7;
}

.basic-recognition-field-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  transition: opacity 120ms ease, background-color 120ms ease;
}

.basic-recognition-field-row.is-skipped {
  background: #f7f8f8;
  opacity: 0.58;
}

.basic-recognition-field-row > input {
  width: 100%;
  min-width: 0;
}

.basic-recognition-apply {
  display: flex;
  min-width: 0;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.basic-recognition-apply input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
}

.basic-recognition-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.basic-recognition-actions > span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.basic-recognition-actions > div {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

@media (max-width: 720px) {
  .basic-recognition-modal {
    padding: 0;
  }

  .basic-recognition-panel {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .basic-recognition-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(190px, 34dvh) minmax(0, 1fr);
    overflow: hidden;
  }

  .basic-recognition-image-pane {
    grid-template-rows: auto minmax(0, 1fr);
    padding: 9px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .basic-recognition-image-stage {
    min-height: 0;
  }

  .basic-recognition-image-toolbar {
    min-height: 32px;
    padding-left: 7px;
  }

  .basic-recognition-image-actions {
    gap: 2px;
  }

  .basic-recognition-viewer-button {
    width: 27px;
    height: 26px;
  }

  .basic-recognition-viewer-text-button {
    min-width: 40px;
    padding-right: 5px;
    padding-left: 5px;
  }

  .basic-recognition-zoom-level {
    min-width: 39px;
  }

  .basic-recognition-field-row {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px;
    padding: 9px 11px;
  }

  .basic-recognition-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
    padding: 8px 10px 10px;
  }

  .basic-recognition-actions > div {
    display: flex;
    width: 100%;
  }

  .basic-recognition-actions button {
    flex: 1 1 0;
    width: 100%;
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
  }
}

/* Keep the mobile arrival detail footer anchored while only the detail content scrolls. */
@media (max-width: 720px) {
  html,
  body {
    overscroll-behavior-y: none;
  }

  .arrival-pull-refresh {
    --arrival-pull-refresh-offset: 0px;
    --arrival-pull-refresh-top: 0px;
    position: fixed;
    top: var(--arrival-pull-refresh-top);
    left: 50%;
    z-index: 19;
    display: flex;
    gap: 7px;
    align-items: center;
    width: max-content;
    max-width: calc(100vw - 24px);
    min-height: 38px;
    padding: 7px 11px;
    visibility: hidden;
    overflow: hidden;
    border: 1px solid #b9c8cc;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(23, 36, 42, 0.16);
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    opacity: 0;
    transform: translate3d(-50%, calc(-100% + var(--arrival-pull-refresh-offset)), 0);
    transition: opacity 120ms ease, visibility 0s linear 160ms;
    pointer-events: none;
  }

  .arrival-pull-refresh.is-visible {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
  }

  .arrival-pull-refresh.is-settling {
    transition: transform 160ms ease, opacity 140ms ease, visibility 0s linear 180ms;
  }

  .arrival-pull-refresh-icon {
    position: relative;
    display: grid;
    flex: 0 0 18px;
    place-items: center;
    width: 18px;
    height: 18px;
    color: var(--accent-dark);
  }

  .arrival-pull-refresh-arrow {
    font-size: 18px;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 150ms ease;
  }

  .arrival-pull-refresh.is-armed .arrival-pull-refresh-arrow {
    transform: rotate(180deg);
  }

  .arrival-pull-refresh-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid #bfd5d2;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: arrival-pull-refresh-spin 700ms linear infinite;
  }

  .arrival-pull-refresh.is-refreshing .arrival-pull-refresh-arrow {
    display: none;
  }

  .arrival-pull-refresh.is-refreshing .arrival-pull-refresh-spinner {
    display: block;
  }

  @keyframes arrival-pull-refresh-spin {
    to { transform: rotate(360deg); }
  }

  body.mobile-page-swiping {
    overflow: hidden !important;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .main-shell.mobile-page-swipe-current {
    position: relative;
    z-index: 19;
    backface-visibility: hidden;
    will-change: transform;
  }

  .main-shell.mobile-page-swipe-current.is-settling,
  .mobile-page-swipe-pane.is-settling {
    transition: transform 220ms cubic-bezier(0.22, 0.72, 0.24, 1);
  }

  .mobile-page-swipe-layer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 18;
    overflow: hidden;
    background: transparent;
    contain: strict;
    isolation: isolate;
    pointer-events: none;
  }

  .mobile-page-swipe-pane {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: var(--page);
    backface-visibility: hidden;
    will-change: transform;
  }

  .mobile-page-swipe-pane.is-next {
    box-shadow: -14px 0 28px rgba(23, 36, 42, 0.14);
  }

  .mobile-page-swipe-pane.is-previous {
    box-shadow: 14px 0 28px rgba(23, 36, 42, 0.14);
  }

  .mobile-page-swipe-pane .mobile-page-swipe-snapshot {
    position: absolute !important;
    right: auto !important;
    left: 0 !important;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    overflow: visible !important;
    transform: none !important;
    transition: none !important;
    contain: layout paint;
    pointer-events: none;
  }

  .mobile-page-swipe-snapshot > .view {
    display: none !important;
  }

  .mobile-page-swipe-snapshot > .view.is-active {
    display: block !important;
  }

  .mobile-page-swipe-pane:not(.is-arrival-detail) .mobile-page-swipe-snapshot,
  .mobile-page-swipe-pane:not(.is-arrival-detail) .mobile-page-swipe-snapshot > .view.is-active,
  .mobile-page-swipe-pane:not(.is-arrival-detail) .arrival-workspace {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .mobile-page-swipe-pane.is-arrival-detail .mobile-page-swipe-snapshot {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr);
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding-bottom: 9px;
  }

  .mobile-page-swipe-pane.is-arrival-detail .mobile-page-swipe-snapshot > #searchView.is-active {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr);
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .mobile-page-swipe-pane.is-arrival-detail .arrival-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .mobile-page-swipe-pane.is-arrival-detail .arrival-detail-surface,
  .mobile-page-swipe-pane.is-arrival-detail #sampleDetail.arrival-detail-body {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .mobile-page-swipe-pane.is-arrival-detail .arrival-detail-scroll {
    height: auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .mobile-page-swipe-pane.is-arrival-detail .arrival-detail-body > .arrival-completed-note,
  .mobile-page-swipe-pane.is-arrival-detail .arrival-decision-bar {
    position: relative;
    z-index: 3;
    flex: 0 0 auto;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    box-shadow: 0 -6px 18px rgba(28, 43, 51, 0.09);
  }

  .mobile-swipe-enter-next {
    animation: mobile-swipe-enter-next 180ms cubic-bezier(0.22, 0.72, 0.24, 1);
  }

  .mobile-swipe-enter-previous {
    animation: mobile-swipe-enter-previous 180ms cubic-bezier(0.22, 0.72, 0.24, 1);
  }

  @keyframes mobile-swipe-enter-next {
    from { opacity: 0.82; transform: translate3d(18px, 0, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
  }

  @keyframes mobile-swipe-enter-previous {
    from { opacity: 0.82; transform: translate3d(-18px, 0, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
  }

  @media (prefers-reduced-motion: reduce) {
    .arrival-pull-refresh,
    .arrival-pull-refresh-arrow {
      transition: none;
    }

    .arrival-pull-refresh-spinner {
      animation: none;
    }

    .main-shell.mobile-page-swipe-current.is-settling,
    .mobile-page-swipe-pane.is-settling {
      transition: none;
    }

    .mobile-swipe-enter-next,
    .mobile-swipe-enter-previous {
      animation: none;
    }
  }

  html.arrival-mobile-detail-active {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.arrival-mobile-detail-active {
    position: fixed;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.arrival-mobile-detail-active #appShell:not([hidden]) {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.arrival-mobile-detail-active .app-header {
    position: relative;
    flex: 0 0 auto;
  }

  body.arrival-mobile-detail-active .main-shell {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 9px;
  }

  body.arrival-mobile-detail-active #searchView.is-active {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.arrival-mobile-detail-active .arrival-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.arrival-mobile-detail-active .arrival-detail-surface {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.arrival-mobile-detail-active #sampleDetail.arrival-detail-body {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.arrival-mobile-detail-active .arrival-detail-scroll {
    height: auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.arrival-mobile-detail-active .arrival-detail-body > .arrival-completed-note,
  body.arrival-mobile-detail-active .arrival-decision-bar {
    position: relative;
    z-index: 3;
    flex: 0 0 auto;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    box-shadow: 0 -6px 18px rgba(28, 43, 51, 0.09);
    touch-action: manipulation;
  }
}

.image-editor {
  position: fixed;
  inset: 0;
  z-index: 340;
  display: none;
  place-items: center;
  padding: 14px;
}

.image-editor.is-open {
  display: grid;
}

.image-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 20, 24, 0.68);
}

.image-editor-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1180px, 100%);
  height: min(860px, calc(100dvh - 28px));
  overflow: hidden;
  border: 1px solid #cbd7d9;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(8, 20, 24, 0.34);
}

.image-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.image-editor-head > div {
  min-width: 0;
}

.image-editor-head span,
.image-editor-head h2,
.image-editor-head p {
  display: block;
}

.image-editor-head span {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 700;
}

.image-editor-head h2 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 17px;
}

.image-editor-head p {
  max-width: 70vw;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-editor-head .icon-button {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  background: #e7eeee;
  color: var(--ink);
  font-size: 22px;
}

.image-editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  min-height: 0;
}

.image-editor-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: #101a1e;
}

.image-editor-view-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  background: #17262b;
}

.image-editor-view-tabs button {
  min-height: 30px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #b9c9cc;
  font-size: 12px;
}

.image-editor-view-tabs button:hover,
.image-editor-view-tabs button.is-active {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.image-editor-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #0b1215;
}

.image-editor-crop-view,
.image-editor-preview-view {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
}

.image-editor-crop-view {
  overflow: hidden;
  touch-action: none;
}

.image-editor-rotate-handle {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  background: rgba(17, 31, 36, 0.9);
  color: #fff;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.28);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.image-editor-rotate-handle[hidden],
.image-editor-rotation-value[hidden] {
  display: none;
}

.image-editor-rotate-handle.is-left {
  left: 12px;
}

.image-editor-rotate-handle.is-right {
  right: 12px;
}

.image-editor-rotate-handle span {
  font-size: 23px;
  line-height: 1;
  pointer-events: none;
}

.image-editor-rotate-handle:hover,
.image-editor-rotate-handle:focus-visible,
.image-editor-rotate-handle.is-dragging {
  border-color: var(--amber);
  background: rgba(94, 67, 27, 0.96);
}

.image-editor-rotate-handle.is-dragging {
  transform: translateY(-50%) scale(1.08);
  cursor: grabbing;
}

.image-editor-rotate-handle.is-snapped {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(231, 170, 66, 0.2), 0 5px 16px rgba(0, 0, 0, 0.28);
}

.image-editor-crop-view.is-rotating .cropper-container {
  cursor: grabbing !important;
}

.image-editor-rotation-value {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 5;
  min-width: 54px;
  padding: 6px 9px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 5px;
  background: rgba(17, 31, 36, 0.9);
  color: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  pointer-events: none;
}

.image-editor-rotation-value.is-snapped {
  border-color: var(--amber);
  color: #ffd98f;
}

.image-editor-crop-view.is-inactive {
  visibility: hidden;
  pointer-events: none;
}

.image-editor-crop-view > img {
  display: block;
  max-width: 100%;
}

.image-editor-preview-view {
  display: grid;
  place-items: center;
  padding: 18px;
  background: #0b1215;
  z-index: 2;
}

.image-editor-preview-view > img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-editor-compare {
  position: absolute;
  bottom: 16px;
  left: 50%;
  min-height: 34px;
  padding: 0 13px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 5px;
  background: rgba(19, 34, 39, 0.86);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
  touch-action: none;
  user-select: none;
}

.image-editor-compare:hover,
.image-editor-compare.is-showing-original {
  border-color: var(--amber);
  background: rgba(116, 79, 25, 0.92);
}

.image-editor-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(11, 18, 21, 0.78);
  color: #fff;
  font-size: 13px;
}

.image-editor-controls {
  min-width: 0;
  overflow: auto;
  padding: 12px;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.image-editor-controls section {
  display: grid;
  gap: 8px;
  padding: 0 0 13px;
  margin-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.image-editor-controls section:last-child {
  margin-bottom: 0;
  border-bottom: 0;
}

.image-editor-controls h3 {
  margin: 0 0 1px;
  color: var(--ink);
  font-size: 12px;
}

.image-editor-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.image-editor-controls select {
  width: 100%;
  min-height: 34px;
}

.image-editor-tool-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.image-editor-tool-row.is-reset-only {
  grid-template-columns: 1fr;
}

.image-editor-tool-row button {
  min-width: 0;
  padding: 0 5px;
  font-size: 11px;
}

.image-editor-stats {
  gap: 7px !important;
}

.image-editor-stats > div {
  display: grid;
  gap: 2px;
}

.image-editor-stats span {
  color: var(--muted);
  font-size: 10px;
}

.image-editor-stats strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
}

.image-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.image-editor-actions > span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-editor-actions > div {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

@media (max-width: 720px) {
  .image-editor {
    padding: 0;
  }

  .image-editor-panel {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .image-editor-head {
    padding: 9px 11px;
  }

  .image-editor-head p {
    max-width: calc(100vw - 82px);
  }

  .image-editor-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 52dvh) auto;
    overflow-y: auto;
  }

  .image-editor-controls {
    overflow: visible;
    padding: 11px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .image-editor-preview-view {
    padding: 10px;
  }

  .image-editor-rotate-handle {
    width: 38px;
    height: 38px;
  }

  .image-editor-rotate-handle.is-left {
    left: 6px;
  }

  .image-editor-rotate-handle.is-right {
    right: 6px;
  }

  .image-editor-compare {
    bottom: 10px;
  }

  .image-editor-actions {
    padding: 8px 10px;
  }

  .image-editor-actions > span {
    max-width: 42vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-context-menu {
    transition: none;
  }

  .lightbox-stage.is-swipe-settling .lightbox-image-positioner,
  .lightbox-stage.is-swipe-settling .lightbox-adjacent-positioner,
  .lightbox-stage.is-swipe-settling .lightbox-preview-image,
  .lightbox-stage.is-zoom-settling .lightbox-image-positioner,
  .lightbox-stage.is-zoom-settling #lightboxImage {
    transition: none;
  }
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 7px;
  background: #17262d;
  color: #fff;
  box-shadow: 0 14px 32px rgba(20, 32, 38, 0.26);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

#toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 981px) {
  html,
  body {
    height: 100%;
    height: 100dvh;
    overflow: clip;
  }

  body {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .app-header {
    position: relative;
  }

  .main-shell {
    height: auto;
    min-height: 0;
    overflow: clip;
    padding-bottom: 16px;
  }

  #searchView.is-active,
  #intakeView.is-active {
    height: 100%;
    min-height: 0;
  }

  #searchView.is-active {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .search-workspace {
    height: auto;
    min-height: 0;
  }

  body.intake-view-active .main-shell {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

@media (max-width: 1240px) {
  .header-main {
    grid-template-columns: auto 1fr;
    gap: 10px 24px;
  }

  .header-metrics {
    justify-self: end;
  }

  .tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

  .search-workspace {
    grid-template-columns: minmax(570px, 1.35fr) minmax(340px, 0.8fr);
  }

  .intake-card {
    grid-template-columns: 124px minmax(0, 1fr);
  }

  .intake-card-fields {
    grid-template-columns: minmax(0, 1.5fr) minmax(250px, 0.8fr);
  }

  .intake-card-data {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .intake-card-remark {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .search-toolbar {
    grid-template-columns: minmax(240px, 1fr) auto;
  }

  .search-action {
    grid-column: auto;
    justify-self: auto;
  }

  .search-workspace,
  .form-workspace {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  #intakeView.is-active {
    display: block;
    height: auto;
    min-height: 0;
  }

  .intake-batch-form {
    display: block;
    overflow: visible;
  }

  .intake-card-grid {
    padding: 0;
    overflow: visible;
  }

  .intake-card {
    grid-template-columns: 1fr;
  }

  .intake-card-head {
    align-items: center;
    flex-direction: row;
    min-height: 52px;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .intake-card-fields {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .intake-card-data {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intake-card-remark {
    grid-column: auto;
  }

  .results-surface {
    height: clamp(420px, 62dvh, 620px);
  }

  .detail-surface,
  .preview-surface {
    min-height: 480px;
  }

}

@media (max-width: 720px) {
  .batch-qc-modal {
    padding: 0;
  }

  .batch-qc-panel {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .batch-qc-content {
    padding: 10px;
  }

  .batch-qc-inspection-row,
  .batch-qc-inspection-row.is-heading {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .batch-qc-inspection-row.is-heading span:nth-child(3),
  .batch-qc-inspection-row.is-heading span:nth-child(4) {
    display: none;
  }

  .batch-qc-inspection-row label {
    grid-column: 2;
  }

  .batch-qc-conclusion-grid {
    grid-template-columns: 1fr;
  }

  .batch-qc-conclusion-wide {
    grid-column: 1;
  }

  .header-main {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 10px 14px;
  }

  .brand {
    flex: 1 1 auto;
  }

  .tabs {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tab {
    padding: 0 8px;
  }

  .header-metrics {
    width: 100%;
    order: 4;
  }

  .metric {
    min-width: 0;
  }

  .main-shell {
    padding: 12px 12px 24px;
  }

  .search-toolbar,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .intake-batch-toolbar,
  .intake-batch-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .intake-batch-actions {
    position: static;
  }

  .intake-add-card,
  .intake-batch-actions > div,
  .intake-batch-actions button {
    width: 100%;
  }

  .intake-batch-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .intake-card-data {
    grid-template-columns: 1fr;
  }

  .intake-card-tools .compact-command {
    display: none;
  }

  .search-action {
    width: 100%;
  }

  .results-surface {
    height: clamp(420px, 62dvh, 560px);
  }

  table {
    min-width: 768px;
  }

  th:nth-child(1),
  td:nth-child(1) {
    width: 90px;
  }

  th:nth-child(2),
  td:nth-child(2) {
    width: 118px;
  }

  th:nth-child(3),
  td:nth-child(3) {
    width: 128px;
  }

  th:nth-child(4),
  td:nth-child(4) {
    width: 250px;
  }

  th:nth-child(5),
  td:nth-child(5) {
    width: 182px;
  }

  .detail-fields {
    grid-template-columns: 1fr;
  }

  .sample-highlight-fields,
  .sample-edit-grid {
    grid-template-columns: 1fr;
  }

  .detail-image-tile {
    flex-basis: 82px;
    width: 82px;
  }

  .detail-summary {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .wide {
    grid-column: auto;
  }

  .image-upload-tile {
    flex-basis: 88px;
    width: 88px;
  }

  .lightbox {
    padding: 0;
  }

  .lightbox-panel {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .lightbox-stage {
    padding: 0;
  }

  .lightbox-toolbar {
    align-items: flex-start;
  }

  .lightbox-actions {
    flex-wrap: wrap;
  }

  .viewer-button {
    padding: 0 8px;
  }

  .lightbox-thumbnails {
    justify-content: flex-start;
    min-height: 74px;
    padding: 8px 10px;
  }

  .lightbox-thumbnail {
    flex-basis: 78px;
    width: 78px;
    height: 54px;
  }

  .lightbox-nav.previous {
    left: 4px;
  }

  .lightbox-nav.next {
    right: 4px;
  }
}

@media (max-width: 460px) {
  .header-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

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

}

/* Arrival workflow */
.arrival-mobile-switch {
  display: none;
}

.arrival-search-toolbar {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.arrival-workspace {
  grid-template-columns: minmax(680px, 1.45fr) minmax(400px, 0.8fr);
}

.arrival-results-surface,
.arrival-detail-surface {
  min-height: 0;
}

.arrival-results-surface table {
  width: var(--arrival-table-width, 1308px);
  min-width: var(--arrival-table-width, 1308px);
}

.arrival-results-surface th,
.arrival-results-surface td {
  width: auto;
}

.arrival-results-surface th[data-arrival-column] {
  position: sticky;
}

.arrival-results-surface th,
.arrival-results-surface tbody td {
  border-right: 1px solid #e5ebed;
}

.arrival-results-surface th:nth-child(1),
.arrival-results-surface td:nth-child(1) {
  padding-right: 4px;
  padding-left: 7px;
}

.arrival-results-surface .thumb-column .column-filter {
  width: 68px;
  min-width: 0;
  padding-right: 16px;
  padding-left: 4px;
  font-size: 9px;
}

.arrival-results-surface tbody td {
  min-width: 0;
  overflow: hidden;
}

.arrival-results-surface .arrival-cell-text {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arrival-column-resizer {
  position: absolute;
  top: 0;
  right: -5px;
  z-index: 12;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}

.arrival-column-resizer::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: #c9d3d6;
  content: "";
  transition: width 120ms ease, background-color 120ms ease;
}

.arrival-column-resizer:hover::after,
.arrival-column-resizer.is-resizing::after {
  width: 2px;
  background: var(--accent);
}

body.arrival-column-resizing,
body.arrival-column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.arrival-results-surface .status-column-filter {
  width: 100%;
  min-width: 0;
  padding-right: 17px;
  padding-left: 5px;
  font-size: 9px;
}

.arrival-column-hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.arrival-row-status {
  display: grid;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  gap: 4px;
  justify-items: start;
}

.arrival-row-status > * {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arrival-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  background: #eef2f3;
  color: #5d6b71;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.arrival-status-chip.passed,
.status-chip.passed {
  background: #e2f2e8;
  color: #256a45;
}

.arrival-status-chip.failed,
.status-chip.failed {
  background: #fbe6e4;
  color: #a33d35;
}

.arrival-status-chip.pending,
.status-chip.pending {
  background: #fff0d2;
  color: #8b5a0a;
}

.arrival-status-chip.uninspected,
.status-chip.uninspected {
  background: #e4eef9;
  color: #315f8c;
}

.arrival-status-chip.not-sampled,
.status-chip.not-sampled {
  background: #eef2f3;
  color: #68767c;
}

.arrival-status-chip.retained,
.status-chip.retained {
  background: #def2ee;
  color: #076d68;
}

.arrival-status-chip.returned,
.status-chip.returned {
  background: #f3e9e5;
  color: #81503d;
}

.arrival-status-empty {
  color: #9aa6aa;
  font-size: 11px;
}

.arrival-sample-id,
.arrival-rough-name {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.arrival-sample-id {
  color: var(--blue);
}

.arrival-detail-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.arrival-detail-scroll {
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.arrival-detail-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.arrival-detail-overview > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.arrival-detail-overview span,
.arrival-section-head span {
  color: var(--muted);
  font-size: 10px;
}

.arrival-detail-overview strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arrival-linked-sample {
  color: var(--blue) !important;
}

button.arrival-linked-sample {
  width: fit-content;
  max-width: 100%;
  padding: 0 0 2px;
  border-bottom: 1px dashed currentColor;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.arrival-linked-sample:hover,
button.arrival-linked-sample:focus-visible {
  color: var(--accent-dark) !important;
  border-bottom-style: solid;
}

.arrival-duplicate-alert,
.arrival-duplicate-clear,
.arrival-completed-note {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  padding: 10px 11px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: #6e5b35;
  font-size: 11px;
  line-height: 1.45;
}

.arrival-duplicate-alert strong {
  color: #8e5a0c;
}

.arrival-duplicate-item {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid #e4cf9b;
  border-radius: 4px;
  background: #fffaf0;
  color: #765b24;
  text-align: left;
  font-size: 11px;
}

.arrival-duplicate-item:hover {
  border-color: var(--amber);
}

.arrival-duplicate-clear {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.arrival-qc-form {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.arrival-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 10px;
}

.arrival-form-grid label {
  gap: 4px;
}

.arrival-form-highlight {
  padding: 7px 8px 8px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}

.arrival-form-highlight input {
  border-color: #a7c9c4;
}

.arrival-form-wide {
  grid-column: 1 / -1;
}

.arrival-form-wide textarea {
  min-height: 58px;
  padding: 7px 8px;
}

.arrival-decision-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.arrival-completed-note {
  color: var(--muted);
  font-size: 11px;
}

.arrival-decision-row {
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.arrival-decision-row input {
  flex: 1 1 auto;
  min-width: 120px;
  min-height: 36px;
}

.arrival-decision-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -7px 18px rgba(28, 43, 51, 0.07);
}

.arrival-decision-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.arrival-decision-copy strong {
  color: var(--ink);
  font-size: 12px;
}

.arrival-decision-copy span,
.arrival-sampling-actions > span {
  color: var(--muted);
  font-size: 11px;
}

.arrival-decision-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.arrival-decision-controls input {
  width: min(170px, 20vw);
  min-width: 120px;
  min-height: 34px;
}

.arrival-detail-body > .arrival-completed-note {
  margin: 0;
  border-top: 1px solid var(--line);
  border-left: 0;
  background: var(--surface-soft);
}

.arrival-completed-note span {
  color: var(--muted);
}

.arrival-sampling-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  place-items: center;
  padding: 20px;
}

.arrival-sampling-modal.is-open {
  display: grid;
}

.arrival-sampling-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 28, 33, 0.58);
}

.arrival-sampling-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1000px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(15, 28, 33, 0.25);
}

body.batch-qc-modal-open {
  overflow: hidden;
}

.batch-qc-modal {
  z-index: 350;
}

.batch-qc-panel {
  width: min(1120px, 100%);
  height: min(820px, calc(100dvh - 40px));
}

.batch-qc-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}

.batch-qc-content {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 18px;
}

.batch-qc-rule {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
}

.batch-qc-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.batch-qc-section + .batch-qc-section {
  margin-top: 12px;
}

.batch-qc-section > header {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.batch-qc-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.batch-qc-inspection-row {
  display: grid;
  grid-template-columns: 52px minmax(190px, 1fr) 150px minmax(240px, 1.3fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
}

.batch-qc-inspection-row.is-heading {
  min-height: 34px;
  border-top: 0;
  background: #f7f9f9;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.batch-qc-inspection-index {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.batch-qc-inspection-item {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.batch-qc-inspection-row label {
  min-width: 0;
}

.batch-qc-inspection-row select,
.batch-qc-inspection-row input {
  width: 100%;
  min-height: 34px;
}

.batch-qc-conclusion-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.batch-qc-conclusion-grid label,
.batch-qc-signature-field {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
}

.batch-qc-conclusion-grid input,
.batch-qc-conclusion-grid select,
.batch-qc-conclusion-grid textarea {
  width: 100%;
}

.batch-qc-conclusion-wide {
  grid-column: 1 / -1;
}

.batch-qc-signature-field .arrival-workflow-signature-button {
  min-height: 38px;
}

.batch-qc-error {
  margin: 12px 0 0;
}

.batch-qc-actions > div {
  display: flex;
  gap: 8px;
}

.batch-qc-actions > span {
  color: var(--muted);
  font-size: 10px;
}

@media (min-width: 721px) {
  #arrivalSamplingModal .arrival-sampling-panel {
    height: min(740px, calc(100vh - 40px));
    height: min(740px, calc(100dvh - 40px));
  }
}

.arrival-sample-change-panel {
  width: min(680px, 100%);
}

.arrival-date-panel {
  width: min(440px, 100%);
  height: auto;
}

.arrival-date-content {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 118px;
}

.arrival-date-content label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.arrival-date-content input {
  width: 100%;
  min-height: 42px;
}

#arrivalSamplingContent {
  overflow: hidden;
}

.arrival-sampling-workspace {
  display: grid;
  grid-template-columns: minmax(270px, 0.78fr) minmax(0, 1.42fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.arrival-sampling-search-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding-right: 14px;
  border-right: 1px solid var(--line);
}

.arrival-sampling-search-form {
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.arrival-sampling-search-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.arrival-sampling-search-form label > span {
  color: var(--muted);
  font-size: 10px;
}

.arrival-sampling-search-form input {
  width: 100%;
  min-height: 36px;
}

.arrival-sampling-search-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.arrival-sampling-search-toolbar > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arrival-sampling-search-toolbar button {
  min-height: 32px;
  padding: 0 12px;
}

.arrival-sampling-search-results {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 8px;
  scrollbar-gutter: stable;
}

.arrival-sampling-search-result-head,
.arrival-sampling-search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(88px, 0.9fr);
  gap: 6px;
}

.arrival-sampling-search-result-head {
  position: sticky;
  z-index: 1;
  top: 0;
  align-items: center;
  padding: 3px 5px 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 9px;
}

.arrival-sampling-search-column-heading {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 3px;
}

.arrival-sampling-search-column-heading > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arrival-sampling-search-result {
  align-items: center;
  min-height: 27px;
  padding: 3px 5px;
  border-top: 1px solid var(--line);
}

.arrival-sampling-search-result strong,
.arrival-sampling-search-result > span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 20px;
}

.arrival-sampling-search-result strong {
  color: var(--ink);
  font-size: 11px;
}

.arrival-sampling-search-result > span {
  color: var(--muted);
  font-size: 10px;
}

.arrival-sampling-search-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  padding: 14px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.arrival-sampling-search-empty.is-error {
  color: var(--danger-dark);
}

.arrival-sampling-plan {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.arrival-sample-change-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.arrival-sample-change-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.arrival-sample-change-form input,
.arrival-sample-change-form select {
  width: 100%;
  min-height: 38px;
}

.arrival-sample-change-preview {
  min-height: 94px;
}

.arrival-sample-change-warning {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 9px 10px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: #6e5b35;
  font-size: 11px;
  line-height: 1.45;
}

.arrival-sample-change-warning strong {
  color: #8e5a0c;
}

.arrival-sampling-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.arrival-sampling-head div {
  display: grid;
  gap: 2px;
}

.arrival-sampling-head span {
  color: var(--muted);
  font-size: 10px;
}

.arrival-sampling-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
}

.arrival-sampling-head p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.arrival-sampling-head .icon-button {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  background: #e7eeee;
  color: var(--ink);
  font-size: 22px;
}

.arrival-sampling-head .icon-button:hover,
.arrival-sampling-head .icon-button:focus-visible {
  background: #d8e4e5;
  color: var(--accent-dark);
}

.arrival-sampling-content {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.arrival-sampling-summary,
.arrival-sampling-location-grid,
.arrival-sampling-number {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.arrival-sampling-summary > div,
.arrival-sampling-number > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.arrival-sampling-summary span,
.arrival-sampling-number span,
.arrival-sampling-reason > span {
  color: var(--muted);
  font-size: 10px;
}

.arrival-sampling-summary strong,
.arrival-sampling-number strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 12px;
}

.arrival-sampling-warning,
.arrival-sampling-error,
.arrival-sampling-reason {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding: 10px 11px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: #6e5b35;
  font-size: 11px;
  line-height: 1.45;
}

.arrival-sampling-warning strong {
  color: #8e5a0c;
}

.arrival-sampling-warning small,
.arrival-sampling-number small,
.arrival-sampling-reason small {
  color: var(--muted);
  font-size: 10px;
}

.arrival-sampling-location-grid {
  margin-top: 12px;
}

.arrival-sampling-location-grid label {
  gap: 4px;
}

.arrival-sampling-location-grid select {
  width: 100%;
  min-height: 36px;
}

.arrival-layer-field {
  position: relative;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.arrival-layer-field > span {
  color: var(--muted);
  font-size: 11px;
}

.arrival-layer-picker {
  position: relative;
  min-width: 0;
}

.arrival-layer-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px 10px;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 38px;
  padding: 5px 9px 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.arrival-layer-trigger:hover,
.arrival-layer-trigger:focus-visible,
.arrival-layer-picker.is-open .arrival-layer-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 122, 0.11);
}

.arrival-layer-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.arrival-layer-trigger-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.arrival-layer-trigger-copy strong {
  color: var(--ink);
  font-size: 12px;
}

.arrival-layer-trigger-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arrival-layer-trigger-lock,
.arrival-layer-lock {
  display: grid;
  place-items: center;
}

.arrival-layer-trigger-lock {
  width: 18px;
  height: 18px;
}

.arrival-layer-trigger-lock svg,
.arrival-layer-lock svg,
.arrival-current-location svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.arrival-layer-trigger-lock.is-locked,
.arrival-layer-lock.is-locked,
.arrival-current-location.is-locked {
  color: #34444b;
}

.arrival-layer-trigger-lock.is-unlocked,
.arrival-layer-lock.is-unlocked {
  color: #aeb9bd;
}

.arrival-layer-chevron {
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border-right: 1.5px solid #718087;
  border-bottom: 1.5px solid #718087;
  transform: rotate(45deg);
  transition: transform 140ms ease;
}

.arrival-layer-picker.is-open .arrival-layer-chevron {
  margin-top: 4px;
  transform: rotate(225deg);
}

.arrival-layer-menu {
  position: absolute;
  z-index: 18;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  max-height: 236px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 28, 33, 0.18);
}

.arrival-layer-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: stretch;
  min-width: 0;
  border-radius: 4px;
}

.arrival-layer-option + .arrival-layer-option {
  margin-top: 2px;
}

.arrival-layer-option:hover {
  background: #f1f7f6;
}

.arrival-layer-option.is-locked {
  background: #f3f5f5;
}

.arrival-layer-choice {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  padding: 7px 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.arrival-layer-choice span {
  font-size: 12px;
  font-weight: 700;
}

.arrival-layer-choice small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arrival-layer-choice[aria-selected="true"] {
  color: var(--accent-dark);
}

.arrival-layer-choice:disabled {
  cursor: not-allowed;
  color: #89969b;
}

.arrival-layer-lock {
  width: 30px;
  min-height: 30px;
  margin: 4px 2px;
  border-radius: 4px;
  background: transparent;
}

.arrival-layer-lock:hover,
.arrival-layer-lock:focus-visible {
  background: #dfe8e8;
  color: var(--ink);
}

.arrival-layer-lock:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.arrival-layer-empty {
  padding: 10px;
  color: var(--muted);
  text-align: center;
}

.arrival-current-location {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.arrival-layer-warning {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 9px 10px;
  border-left: 3px solid #58676d;
  background: #edf1f2;
  color: #44545a;
  font-size: 11px;
  line-height: 1.45;
}

.arrival-layer-warning strong {
  color: #27383f;
}

.arrival-sampling-number {
  margin-top: 12px;
}

.arrival-sampling-number > div:first-child {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}

.arrival-sampling-number > div:first-child strong {
  color: var(--accent-dark);
  font-size: 17px;
}

.arrival-sampling-reason {
  border-left-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink);
}

.arrival-sampling-reason p {
  margin: 0;
}

.arrival-sampling-loading,
.arrival-sampling-error {
  min-height: 130px;
  align-content: center;
}

.arrival-sampling-error {
  border-left-color: var(--danger);
  background: #fff1f1;
  color: var(--danger-dark);
}

.arrival-sampling-error ul {
  margin: 0;
  padding-left: 18px;
}

.arrival-sampling-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 58px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.arrival-sampling-actions > span {
  flex: 1 1 auto;
  min-width: 0;
}

.arrival-image-sections {
  display: grid;
  gap: 10px;
}

.arrival-image-section {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

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

.arrival-section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
}

.arrival-image-drop-zone,
.arrival-register-drop-zone {
  min-height: 82px;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  padding: 6px;
  background: #f8fafb;
}

.arrival-image-drop-zone.is-dragover,
.arrival-register-drop-zone.is-dragover {
  border-color: var(--accent);
  background: #edf8f6;
}

.arrival-image-grid,
.arrival-register-image-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
}

.arrival-image-tile,
.arrival-register-image-tile,
.arrival-image-add,
.arrival-register-image-add {
  position: relative;
  flex: 0 0 66px;
  width: 66px;
  height: 66px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
}

.arrival-upload-tile {
  isolation: isolate;
}

.arrival-upload-tile > .arrival-upload-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #f4f7f7;
}

.arrival-upload-tile > .arrival-upload-preview:disabled {
  opacity: 1;
}

.arrival-upload-preview img[hidden],
.arrival-upload-placeholder[hidden] {
  display: none;
}

.arrival-upload-placeholder {
  width: 22px;
  height: 22px;
  border: 2px solid #b9c9c8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: arrival-upload-spin 820ms linear infinite;
}

.arrival-upload-overlay {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px;
  color: #fff;
  background: rgba(20, 36, 38, 0.62);
  pointer-events: none;
}

.arrival-upload-overlay[hidden] {
  display: none;
}

.arrival-upload-label {
  max-width: 100%;
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arrival-upload-progress {
  width: 100%;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.38);
}

.arrival-upload-progress > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #fff;
  transition: width 140ms ease-out;
}

.arrival-upload-overlay.is-processing .arrival-upload-progress > span {
  width: 42% !important;
  animation: arrival-upload-indeterminate 1050ms ease-in-out infinite;
}

.arrival-upload-overlay.is-saving .arrival-upload-progress > span {
  width: 100% !important;
  animation: none;
  opacity: 1;
  transform: none;
}

.arrival-upload-overlay.is-saving .arrival-upload-label::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: arrival-upload-saving-dot 900ms ease-in-out infinite;
}

.arrival-upload-overlay.is-error {
  background: rgba(150, 53, 37, 0.82);
}

@keyframes arrival-upload-spin {
  to { transform: rotate(360deg); }
}

@keyframes arrival-upload-indeterminate {
  0% { transform: translateX(-115%); }
  100% { transform: translateX(280%); }
}

@keyframes arrival-upload-saving-dot {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.arrival-image-tile[draggable="true"] {
  cursor: grab;
  will-change: transform, opacity;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.arrival-image-tile[draggable="true"]:active,
.arrival-image-tile.is-dragging {
  cursor: grabbing;
  opacity: 0.45;
  transform: rotate(-2deg) scale(0.92);
}

.arrival-image-tile.is-reorder-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 122, 0.14), 0 7px 14px rgba(8, 127, 122, 0.16);
  transform: translateY(-4px) scale(1.04);
}

.arrival-image-tile.is-order-moving {
  animation: arrival-image-reorder 300ms cubic-bezier(0.22, 0.8, 0.25, 1) var(--arrival-image-delay, 0ms) both;
}

.arrival-image-tile.is-order-source {
  z-index: 3;
}

@keyframes arrival-image-reorder {
  0% {
    opacity: 0.35;
    transform: translateY(8px) scale(0.9);
  }
  68% {
    opacity: 1;
    transform: translateY(-2px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .arrival-upload-placeholder,
  .arrival-upload-overlay.is-processing .arrival-upload-progress > span,
  .arrival-upload-overlay.is-saving .arrival-upload-label::after {
    animation: none;
  }

  .arrival-upload-progress > span {
    transition: none;
  }

  .arrival-image-tile[draggable="true"] {
    transition: none;
  }

  .arrival-image-tile.is-order-moving {
    animation: none;
  }
}

.arrival-image-preview,
.arrival-register-image-tile > button:first-child {
  width: 100%;
  height: 100%;
  padding: 0;
  background: #fff;
}

.arrival-image-preview img,
.arrival-register-image-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.arrival-image-remove {
  position: absolute;
  z-index: 4;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(23, 36, 42, 0.72);
  color: #fff;
  line-height: 18px;
}

.arrival-image-order {
  position: absolute;
  right: 2px;
  bottom: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(23, 36, 42, 0.72);
  color: #fff;
  font-size: 9px;
  line-height: 17px;
  text-align: center;
}

.arrival-image-add,
.arrival-register-image-add {
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.arrival-image-add:hover,
.arrival-register-image-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#intakeView.is-active {
  grid-template-rows: auto minmax(0, 1fr);
}

.arrival-register-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.arrival-register-card-head {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  justify-content: space-between;
  gap: 7px;
  padding: 8px;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}

.arrival-register-card-head span,
.arrival-register-card-head strong {
  display: block;
}

.arrival-register-card-head span {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 700;
}

.arrival-register-card-head strong {
  margin-top: 2px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.arrival-register-fields {
  display: grid;
  grid-template-columns: 128px minmax(180px, 1.25fr) minmax(145px, 0.9fr) minmax(145px, 0.9fr);
  align-items: start;
  gap: 6px 8px;
  padding: 7px 8px;
}

.arrival-register-fields > label {
  gap: 2px;
  min-width: 0;
}

.arrival-register-fields input,
.arrival-register-fields textarea {
  width: 100%;
  min-height: 30px;
  padding: 4px 7px;
}

.arrival-register-fields textarea {
  height: 30px;
  resize: vertical;
}

.arrival-register-sampling-choice {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 220px);
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 5px 7px;
  border: 1px solid #e5b348;
  border-radius: 5px;
  background: #fff9eb;
}

.arrival-register-sampling-choice legend {
  float: left;
  width: auto;
  padding: 0;
  color: #86560b;
  font-size: 11px;
  font-weight: 800;
}

.arrival-register-sampling-choice > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.arrival-register-sampling-choice label {
  min-width: 0;
  cursor: pointer;
}

.arrival-register-sampling-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  opacity: 0;
}

.arrival-register-sampling-choice label span {
  display: grid;
  place-items: center;
  min-height: 28px;
  border: 1px solid #d7c69e;
  border-radius: 4px;
  background: #fff;
  color: #695b3d;
  font-size: 11px;
  font-weight: 800;
}

.arrival-register-sampling-choice input[value="抽样"]:checked + span {
  border-color: #13827b;
  background: #dff2ee;
  color: #076d68;
  box-shadow: inset 0 0 0 1px #13827b;
}

.arrival-register-sampling-choice input[value="不抽样"]:checked + span {
  border-color: #9b5f45;
  background: #f3e9e5;
  color: #764632;
  box-shadow: inset 0 0 0 1px #9b5f45;
}

.arrival-register-sampling-choice:has(input:checked) {
  border-color: #bdd1ce;
  background: #f7faf9;
}

.arrival-inline-suggestions {
  display: grid;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(15, 28, 33, 0.14);
}

.arrival-inline-suggestion {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
}

.arrival-inline-suggestion:last-child {
  border-bottom: 0;
}

.arrival-inline-suggestion:focus,
.arrival-inline-suggestion:hover {
  outline: none;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.arrival-register-image-sections {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  padding-top: 1px;
}

.arrival-register-images {
  min-width: 0;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.arrival-register-images:first-child {
  padding-left: 0;
  border-left: 0;
}

.arrival-register-image-grid {
  min-height: 58px;
}

.arrival-register-drop-zone {
  height: calc(100% - 22px);
  min-height: 68px;
}

.arrival-register-image-tile,
.arrival-register-image-add {
  flex-basis: 58px;
  width: 58px;
  height: 58px;
}

.arrival-register-card:focus-within {
  border-color: #93bcb8;
  box-shadow: 0 0 0 3px rgba(8, 127, 122, 0.08), var(--shadow);
}

@media (max-width: 1240px) {
  .arrival-workspace {
    grid-template-columns: minmax(570px, 1.25fr) minmax(340px, 0.8fr);
  }

  .arrival-register-card {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .arrival-register-fields {
    grid-template-columns: 116px repeat(3, minmax(125px, 1fr));
  }
}

@media (max-width: 980px) {
  .arrival-search-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .arrival-workspace {
    grid-template-columns: 1fr;
  }

  .arrival-detail-surface {
    min-height: 620px;
  }

  .arrival-register-card {
    grid-template-columns: 1fr;
  }

  .arrival-register-card-head {
    align-items: center;
    flex-direction: row;
    min-height: 52px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .arrival-register-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .arrival-register-sampling-choice {
    grid-column: 1 / -1;
  }

  .arrival-register-image-sections {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .arrival-mobile-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #e7edef;
  }

  .arrival-mobile-switch button {
    min-height: 36px;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }

  .arrival-mobile-switch button.is-active {
    background: #fff;
    color: var(--accent-dark);
    box-shadow: 0 1px 4px rgba(23, 36, 42, 0.12);
  }

  .arrival-mobile-switch button:disabled {
    cursor: default;
    opacity: 0.45;
  }

  #searchView.mobile-detail-active .arrival-search-toolbar {
    display: none;
  }

  .arrival-workspace[data-mobile-pane="list"] .arrival-detail-surface,
  .arrival-workspace[data-mobile-pane="detail"] .arrival-results-surface {
    display: none;
  }

  .arrival-search-toolbar {
    grid-template-columns: 1fr;
  }

  .arrival-search-toolbar .search-field,
  .arrival-search-toolbar .search-action {
    grid-column: 1 / -1;
  }

  .arrival-search-toolbar .search-action,
  .arrival-search-toolbar select {
    width: 100%;
  }

  .arrival-detail-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .arrival-results-surface {
    height: auto;
    min-height: 0;
  }

  .arrival-results-surface .surface-head {
    min-height: 52px;
    padding: 9px 11px;
  }

  .arrival-results-surface .surface-head p {
    display: none;
  }

  .arrival-results-surface .table-wrap {
    overflow: visible;
  }

  .arrival-results-surface table,
  .arrival-results-surface thead,
  .arrival-results-surface tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .arrival-results-surface table {
    width: 100%;
    min-width: 0;
  }

  .arrival-results-surface colgroup,
  .arrival-column-resizer {
    display: none;
  }

  .arrival-results-surface thead tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: #f8faf9;
  }

  .arrival-results-surface thead th {
    position: static;
    display: block;
    width: auto !important;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .arrival-results-surface thead th:not(:last-child),
  .arrival-results-surface tbody td:not(:last-child) {
    border-right: 0;
  }

  .arrival-results-surface thead th:nth-child(10) {
    grid-column: 1 / -1;
  }

  .arrival-results-surface .column-heading {
    min-height: 18px;
    margin-bottom: 4px;
  }

  .arrival-results-surface .column-filter {
    width: 100%;
    min-height: 32px;
    font-size: 12px;
  }

  .arrival-results-surface .column-filter-control {
    height: 32px;
    min-height: 32px;
  }

  .arrival-results-surface .column-filter-control input.column-filter {
    height: 30px;
    min-height: 30px;
    font-size: 12px;
  }

  .arrival-results-surface .thumb-column .column-filter {
    width: 100%;
    font-size: 12px;
  }

  .arrival-results-surface tbody {
    display: grid;
    gap: 7px;
    padding: 8px;
    background: #eef2f3;
  }

  .arrival-results-surface tbody tr[data-arrival-index] {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    grid-template-areas:
      "image name qc"
      "image model retention"
      "image brand retention"
      "image contract retention"
      "image customer customer"
      "image mark mark"
      "image date date";
    column-gap: 10px;
    row-gap: 3px;
    min-height: 132px;
    padding: 9px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(28, 43, 51, 0.05);
  }

  .arrival-results-surface tbody tr[data-arrival-index].is-multi-selected {
    border-color: #8ec2bb;
    background: #f2faf8;
    box-shadow: inset 3px 0 0 var(--accent), 0 2px 7px rgba(28, 43, 51, 0.05);
  }

  .arrival-results-surface tbody tr[data-arrival-index].is-multi-selected.is-selected {
    border-color: #55a99e;
    background: #e4f4f0;
    box-shadow: inset 4px 0 0 var(--accent), 0 2px 7px rgba(28, 43, 51, 0.05);
  }

  .arrival-results-surface tbody td {
    display: block;
    width: auto !important;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .arrival-results-surface tbody td:nth-child(1) {
    grid-area: image;
    align-self: start;
  }

  .arrival-results-surface tbody td:nth-child(2) {
    grid-area: date;
    align-self: end;
    color: var(--muted);
    font-size: 10px;
  }

  .arrival-results-surface tbody td:nth-child(3) {
    grid-area: name;
  }

  .arrival-results-surface tbody td:nth-child(4) {
    grid-area: model;
  }

  .arrival-results-surface tbody td:nth-child(5) {
    grid-area: brand;
  }

  .arrival-results-surface tbody td:nth-child(6) {
    grid-area: contract;
  }

  .arrival-results-surface tbody td:nth-child(7) {
    grid-area: customer;
  }

  .arrival-results-surface tbody td:nth-child(8) {
    grid-area: mark;
  }

  .arrival-results-surface tbody td:nth-child(9) {
    grid-area: qc;
    align-self: center;
    justify-self: end;
  }

  .arrival-results-surface tbody td:nth-child(10) {
    grid-area: retention;
    align-self: start;
    justify-self: end;
  }

  .arrival-results-surface tbody td.arrival-mobile-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 10px;
  }

  .arrival-results-surface tbody td.arrival-mobile-meta::before {
    flex: 0 0 auto;
    color: #78878d;
    content: attr(data-mobile-label) "：";
    font-weight: 700;
  }

  .arrival-results-surface tbody td.arrival-mobile-meta .arrival-cell-text {
    flex: 1 1 auto;
  }

  .arrival-results-surface .result-image-button,
  .arrival-results-surface .no-image-mini {
    width: 50px;
    height: 48px;
  }

  .arrival-results-surface .result-image-layer {
    width: 38px;
    height: 44px;
  }

  .arrival-results-surface .table-name-highlight {
    max-width: 100%;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .arrival-results-surface .arrival-rough-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .arrival-results-surface .table-model-highlight {
    max-width: 100%;
    padding: 2px 6px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .arrival-results-surface .arrival-row-status {
    justify-items: end;
  }

  .arrival-results-surface .arrival-status-chip {
    min-height: 19px;
    padding: 0 6px;
    font-size: 9px;
  }

  .arrival-results-surface .arrival-sample-id {
    max-width: 92px;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .arrival-results-surface .results-footer {
    padding: 8px 10px;
  }

  .arrival-detail-surface {
    height: calc(100dvh - 178px);
    min-height: 480px;
  }

  .arrival-detail-scroll {
    padding: 10px;
  }

  .arrival-form-grid {
    grid-template-columns: 1fr;
  }

  .arrival-form-wide {
    grid-column: auto;
  }

  .arrival-decision-row {
    align-items: stretch;
    flex-direction: column;
  }

  .arrival-decision-row input,
  .arrival-decision-row button {
    width: 100%;
  }

  .arrival-decision-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .arrival-decision-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .arrival-decision-controls input {
    width: auto;
    min-width: 0;
  }

  .arrival-sampling-modal {
    padding: 0;
  }

  .arrival-sampling-panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  #arrivalSamplingContent {
    overflow: auto;
  }

  .arrival-sampling-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .arrival-sampling-search-panel {
    min-height: 0;
    padding: 0 0 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .arrival-sampling-search-results {
    max-height: 240px;
  }

  .arrival-sampling-plan {
    overflow: visible;
    padding-right: 0;
  }

  [data-draggable-panel] {
    transform: none !important;
  }

  .arrival-sample-change-form {
    grid-template-columns: 1fr;
  }

  .arrival-sampling-summary,
  .arrival-sampling-location-grid,
  .arrival-sampling-number {
    grid-template-columns: 1fr;
  }

  .arrival-sampling-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .arrival-sampling-actions > span {
    grid-column: 1 / -1;
  }

  .arrival-sampling-actions button {
    width: 100%;
  }

  .arrival-register-fields {
    grid-template-columns: 1fr;
  }

  .arrival-register-card .compact-command {
    display: inline-flex;
    align-items: center;
  }

  .arrival-register-sampling-choice {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .arrival-inline-suggestion {
    min-height: 44px;
    font-size: 16px;
  }

  .arrival-register-image-sections {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .arrival-register-images,
  .arrival-register-images:first-child {
    padding: 9px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .arrival-register-images:first-child {
    padding-top: 0;
    border-top: 0;
  }
}

/* Authentication and administration */
[hidden] {
  display: none !important;
}

.auth-gate {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  place-items: center;
  border-top: 8px solid var(--amber);
  background: #e8edef;
}

.auth-panel {
  width: min(430px, 100%);
  overflow: hidden;
  border: 1px solid #cbd5d9;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(21, 38, 45, 0.16);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  background: var(--header);
  color: #fff;
}

.auth-brand .brand-logo {
  flex: 0 0 72px;
  width: 72px;
  height: 62px;
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

.auth-brand strong {
  font-size: 18px;
}

.auth-brand div > span {
  margin-top: 3px;
  color: #a9bbbf;
  font-size: 11px;
}

.auth-heading {
  padding: 28px 28px 8px;
}

.auth-heading > span,
.eyebrow {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}

.auth-heading h1 {
  margin: 5px 0 7px;
  font-size: 24px;
}

.auth-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 16px;
  padding: 18px 28px 30px;
}

.auth-form input {
  min-height: 44px;
}

.auth-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
}

.header-main {
  grid-template-columns: auto minmax(260px, 1fr) auto auto;
  gap: 20px;
}

.header-account {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.account-menu-wrap {
  position: relative;
  min-width: 0;
}

.account-menu-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: min(172px, 20vw);
  min-width: 96px;
  min-height: 36px;
  padding: 0 10px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: left;
  font-size: 12px;
}

.account-menu-trigger > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-chevron {
  flex: 0 0 auto;
  color: #b9c9cc;
  font-size: 14px;
  line-height: 1;
  transition: transform 160ms ease;
}

.account-menu-trigger[aria-expanded="true"] {
  border-color: rgba(231, 170, 66, 0.75);
  background: #243b44;
}

.account-menu-trigger[aria-expanded="true"] .account-menu-chevron {
  transform: rotate(180deg);
}

.account-menu-trigger:hover,
.account-menu-trigger:focus-visible {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: grid;
  min-width: 156px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(15, 28, 33, 0.22);
}

.account-menu[hidden] {
  display: none;
}

.account-menu button {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 12px;
}

.account-menu button:hover,
.account-menu button:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.account-menu button:last-child:hover,
.account-menu button:last-child:focus-visible {
  background: #fff1f1;
  color: var(--danger);
}

.header-account-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: #dbe5e7;
  font-size: 12px;
}

.header-account-button:hover,
.header-account-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.header-account-button.admin-entry {
  border-color: rgba(231, 170, 66, 0.55);
  color: #ffd992;
}

body.password-modal-open {
  overflow: hidden;
}

.password-change-modal {
  z-index: 360;
}

.password-change-panel {
  width: min(420px, 100%);
  height: auto;
  max-height: min(560px, calc(100dvh - 40px));
}

.password-change-content {
  display: grid;
  gap: 11px;
  padding: 18px 16px 6px;
}

.password-change-content input {
  width: 100%;
  min-height: 42px;
}

.password-change-error {
  margin: 0;
}

.password-change-actions {
  margin-top: 6px;
}

.password-change-actions > div {
  display: flex;
  gap: 8px;
}

body.retained-export-modal-open {
  overflow: hidden;
}

.retained-export-modal {
  z-index: 360;
}

.retained-export-panel {
  width: min(440px, 100%);
  height: auto;
  max-height: min(520px, calc(100dvh - 40px));
}

.retained-export-content {
  display: grid;
  gap: 10px;
  padding: 20px 16px 8px;
}

.retained-export-content label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.retained-export-content input {
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.retained-export-content .form-error {
  margin: 0;
}

.retained-export-actions {
  margin-top: 6px;
}

.retained-export-actions > div {
  display: flex;
  gap: 8px;
}

@media (max-width: 720px) {
  .arrival-head-actions {
    gap: 7px;
  }

  .arrival-export-button {
    min-height: 34px;
    padding: 0 9px;
  }

  .retained-export-modal {
    padding: 12px;
  }

  .retained-export-panel {
    width: min(440px, 100%);
    height: auto;
    max-height: calc(100dvh - 24px);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
  }

  .retained-export-actions {
    grid-template-columns: 1fr;
  }

  .retained-export-actions > span:empty {
    display: none;
  }

  .retained-export-actions > div {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

#adminView {
  min-height: 0;
}

.admin-subtabs {
  display: flex;
  align-items: end;
  gap: 2px;
  margin-bottom: 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-strong);
  scrollbar-width: thin;
}

.admin-subtab {
  flex: 0 0 auto;
  min-width: 126px;
  min-height: 42px;
  padding: 0 18px;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-subtab:hover {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

.admin-subtab.is-active {
  border-bottom-color: var(--amber);
  background: #fff;
  color: var(--accent-dark);
}

.admin-subtab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.admin-tab-stage {
  min-width: 0;
}

.admin-panel {
  min-width: 0;
  overflow: hidden;
}

.admin-panel[hidden] {
  display: none;
}

.compact-head {
  min-height: 46px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.admin-user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.admin-user-form > button {
  justify-self: stretch;
  min-width: 116px;
}

.admin-master-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.admin-brand-form {
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.6fr) auto auto;
}

.admin-master-form label {
  min-width: 0;
}

.admin-master-wide {
  min-width: 0;
}

.admin-enabled-check {
  display: flex;
  min-height: 36px;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  padding: 0 4px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-enabled-check input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
}

.admin-master-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.admin-master-footer {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}

.admin-master-footer button {
  min-height: 29px;
}

.admin-ai-config-list {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: #eef2f3;
}

.admin-ai-config-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.admin-ai-config-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.admin-ai-config-head div {
  display: grid;
  gap: 2px;
}

.admin-ai-config-head span {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
}

.admin-ai-config-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.admin-ai-config-head p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.admin-ai-form {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.admin-ai-fields {
  display: grid;
  grid-template-columns: minmax(260px, 1.45fr) minmax(240px, 1.25fr) minmax(190px, 0.9fr) minmax(150px, 0.65fr);
  gap: 12px;
  align-items: end;
}

.admin-ai-fields label {
  min-width: 0;
}

.admin-ai-fields input,
.admin-ai-fields select {
  width: 100%;
}

.admin-ai-actions {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.admin-ai-actions > div {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.admin-ai-detection {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.admin-ai-detection.is-working {
  color: #785512;
}

.admin-ai-detection.is-success {
  color: var(--accent-dark);
  font-weight: 700;
}

.admin-ai-detection.is-error {
  color: var(--danger-dark);
  font-weight: 700;
}

.admin-ai-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: #fff;
}

.admin-ai-meta > div {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.admin-ai-meta > div:last-child {
  border-right: 0;
}

.admin-ai-meta span,
.admin-ai-meta strong {
  display: block;
}

.admin-ai-meta span {
  color: var(--muted);
  font-size: 10px;
}

.admin-ai-meta strong {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.admin-credential-notice {
  margin: 12px 16px 0;
  padding: 10px 12px;
  border: 1px solid #d4aa61;
  border-radius: 6px;
  background: var(--amber-soft);
  color: #68480f;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.admin-record-toolbar {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(260px, 1.55fr) repeat(3, minmax(126px, 0.72fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 11px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.admin-record-head {
  min-height: 58px;
}

.admin-record-toolbar label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-record-toolbar label > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.admin-record-toolbar input,
.admin-record-toolbar select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
}

.admin-record-toolbar [hidden] {
  display: none;
}

.admin-record-toolbar-actions {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px;
}

.admin-record-toolbar-actions button {
  min-height: 36px;
  padding-right: 13px;
  padding-left: 13px;
}

.admin-record-resultbar,
.admin-record-footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 6px 16px;
  color: var(--muted);
  font-size: 11px;
}

.admin-record-resultbar {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

#adminRecordProgress {
  color: var(--ink-soft);
  font-weight: 700;
}

#adminRecordFilterSummary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-record-footer {
  min-height: 43px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.admin-record-footer button {
  min-height: 29px;
}

.admin-table-wrap {
  max-width: 100%;
  overflow: auto;
}

.admin-user-panel .admin-table-wrap {
  max-height: 280px;
}

.admin-record-panel .admin-table-wrap {
  max-height: 440px;
  border: 0;
}

.admin-master-panel .admin-table-wrap {
  max-height: 440px;
}

.admin-audit-panel .admin-table-wrap {
  max-height: 280px;
}

.admin-table {
  width: 100%;
  min-width: 650px;
}

.admin-record-panel .admin-table {
  min-width: 1080px;
  table-layout: fixed;
}

.admin-record-panel .admin-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #edf2f2;
  box-shadow: inset 0 -1px 0 var(--line-strong);
  color: #53646b;
  font-size: 10px;
  text-transform: none;
}

.admin-record-panel .admin-table th:nth-child(1) { width: 16%; }
.admin-record-panel .admin-table th:nth-child(2) { width: 17%; }
.admin-record-panel .admin-table th:nth-child(3) { width: 14%; }
.admin-record-panel .admin-table th:nth-child(4) { width: 17%; }
.admin-record-panel .admin-table th:nth-child(5) { width: 13%; }
.admin-record-panel .admin-table th:nth-child(6) { width: 23%; }

.admin-record-panel .admin-table tbody tr {
  transition: background-color 140ms ease;
}

.admin-record-panel .admin-table tbody tr:hover {
  background: #f7faf9;
}

.admin-record-panel .admin-table tbody td {
  border-bottom-color: #e5eaec;
}

.admin-record-id,
.admin-record-name {
  overflow-wrap: anywhere;
}

.admin-record-id {
  color: var(--blue);
  font-size: 12px;
}

.admin-record-name {
  color: var(--ink);
  font-size: 12px;
}

.admin-image-count {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 7px;
  border: 1px solid #d4dddf;
  border-radius: 5px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 10px;
  white-space: nowrap;
}

.admin-related-sample {
  margin-top: 5px;
  color: var(--blue);
  font-size: 11px;
}

.admin-process-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.admin-process-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  background: #eef2f3;
  color: #5d6b71;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-process-chip.is-sampled,
.admin-process-chip.qc-uninspected {
  background: #e4eef9;
  color: #315f8c;
}

.admin-process-chip.is-not-sampled,
.admin-process-chip.qc-not-sampled,
.admin-process-chip.is-neutral {
  background: #edf1f2;
  color: #68767c;
}

.admin-process-chip.qc-passed {
  background: #e2f2e8;
  color: #256a45;
}

.admin-process-chip.qc-failed {
  background: #fbe6e4;
  color: #a33d35;
}

.admin-process-chip.qc-pending {
  background: #fff0d2;
  color: #8b5a0a;
}

.admin-process-chip.is-retained {
  background: #def2ee;
  color: #076d68;
}

.admin-process-chip.is-returned {
  background: #f3e9e5;
  color: #81503d;
}

.admin-brand-table {
  min-width: 720px;
}

.admin-customer-table {
  min-width: 980px;
}

.admin-table th,
.admin-table td {
  height: auto;
  padding: 9px 10px;
  vertical-align: middle;
}

.admin-table th {
  position: static;
  white-space: nowrap;
}

.admin-table td strong,
.admin-table td small {
  display: block;
}

.admin-table td small {
  margin-top: 2px;
  color: var(--muted);
}

.admin-inline-field,
.admin-inline-select {
  width: 100%;
  min-width: 110px;
  min-height: 30px;
  margin-top: 5px;
  padding: 4px 6px;
  font-size: 12px;
}

.admin-inline-field {
  max-width: 150px;
}

.admin-master-panel .admin-inline-field {
  max-width: none;
  min-width: 105px;
  margin-top: 0;
}

.admin-master-panel .admin-master-name {
  min-width: 150px;
  font-weight: 700;
}

.admin-master-panel .admin-master-remark {
  min-width: 220px;
}

.admin-row-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 5px;
}

.admin-record-panel .admin-row-actions {
  display: grid;
  gap: 6px;
}

.admin-record-command-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.admin-inspector-revoke {
  display: inline-grid;
  grid-template-columns: minmax(112px, 1fr) auto;
  gap: 4px;
}

.admin-inspector-revoke select {
  width: 100%;
  min-height: 28px;
  padding: 0 24px 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background-color: #fff;
  font-size: 11px;
}

.admin-action {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  white-space: nowrap;
}

.admin-action:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.admin-action.danger {
  border-color: #dcb6b6;
  color: var(--danger);
}

.admin-action.danger:hover {
  border-color: var(--danger);
  background: #fff4f4;
}

.admin-action.warning {
  border-color: #d9b36d;
  color: #8e5a0c;
}

.admin-action.warning:hover {
  border-color: var(--amber);
  background: #fff8ea;
}

.admin-action.corrective {
  border-color: #91b4d5;
  background: #f4f8fc;
  color: #285f91;
  font-weight: 700;
}

.admin-action.corrective:hover {
  border-color: var(--blue);
  background: #eaf2fa;
  color: #174f83;
}

.admin-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
}

.admin-status.is-disabled {
  background: #eef1f2;
  color: #76848a;
}

.admin-empty {
  padding: 26px !important;
  color: var(--muted);
  text-align: center;
}

.admin-correction-panel {
  width: min(660px, 100%);
}

.admin-correction-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}

.admin-correction-content {
  display: grid;
  gap: 15px;
}

.admin-correction-record {
  display: grid;
  grid-template-columns: 0.85fr 1.25fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.admin-correction-record > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px 12px;
  border-left: 1px solid var(--line);
}

.admin-correction-record > div:first-child {
  border-left: 0;
}

.admin-correction-record span,
.admin-correction-change span {
  color: var(--muted);
  font-size: 10px;
}

.admin-correction-record strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 12px;
}

.admin-correction-change {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.admin-correction-change > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.admin-correction-change .is-before {
  background: #f3f5f5;
  color: #59666b;
}

.admin-correction-change .is-after {
  border-color: #a9c5df;
  background: #eff6fc;
  color: #245c8d;
}

.admin-correction-change strong {
  font-size: 14px;
}

.admin-correction-change small {
  color: inherit;
  font-size: 10px;
}

.admin-correction-arrow {
  align-self: center;
  color: var(--accent-dark) !important;
  font-size: 22px !important;
  font-weight: 700;
}

.admin-correction-reason {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.admin-correction-reason textarea {
  width: 100%;
  min-height: 98px;
  resize: vertical;
  line-height: 1.55;
}

@media (min-width: 981px) {
  body {
    display: block;
  }

  #appShell:not([hidden]) {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: clip;
  }

  #adminView.is-active {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding-bottom: 4px;
  }

  .admin-subtabs {
    flex: 0 0 auto;
  }

  .admin-tab-stage {
    flex: 0 1 auto;
    min-height: 0;
  }

  .admin-panel.is-active {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: calc(100dvh - 182px);
    min-height: 0;
  }

  .admin-panel .admin-table-wrap {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 420px;
  }

  .admin-record-panel .admin-table-wrap {
    max-height: 520px;
  }

  .admin-audit-panel .admin-table-wrap {
    max-height: 420px;
  }
}

@media (max-width: 1400px) {
  .header-main {
    gap: 14px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .metric {
    min-width: 54px;
    padding-right: 7px;
    padding-left: 7px;
  }
}

@media (max-width: 1240px) {
  .header-main {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .tabs {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .header-account {
    grid-column: 3;
    grid-row: 1;
  }

  .admin-user-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-master-form,
  .admin-brand-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-ai-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-user-form > button {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .admin-master-form > button {
    justify-self: stretch;
  }
}

@media (max-width: 720px) {
  .auth-gate {
    align-items: start;
    padding: 18px 12px;
  }

  .auth-panel {
    margin-top: max(24px, 8vh);
  }

  .auth-heading {
    padding: 22px 20px 6px;
  }

  .auth-form {
    padding: 16px 20px 24px;
  }

  .header-account {
    order: 2;
    margin-left: auto;
    padding-left: 0;
    border-left: 0;
  }

  .account-identity {
    min-width: 0;
  }

  .account-identity strong,
  .account-identity span {
    max-width: 96px;
  }

  .is-admin .tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-subtabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin: 0 0 10px;
    padding: 0;
    overflow: visible;
    border-bottom: 0;
  }

  .admin-subtab {
    min-width: 0;
    min-height: 36px;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #f4f7f7;
    font-size: 12px;
  }

  .admin-subtab.is-active {
    border-color: var(--accent);
    box-shadow: inset 0 -2px 0 var(--amber);
  }

  .admin-user-form,
  .admin-master-form,
  .admin-brand-form,
  .admin-ai-fields,
  .admin-master-toolbar,
  .admin-record-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-user-form > button {
    grid-column: auto;
    width: 100%;
  }

  .admin-master-form > button,
  .admin-master-toolbar > button {
    width: 100%;
  }

  .admin-record-toolbar > button {
    width: 100%;
  }

  .admin-ai-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .admin-ai-actions > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-ai-actions button {
    width: 100%;
  }

  .admin-ai-config-list {
    gap: 10px;
    padding: 8px;
  }

  .admin-ai-config-head,
  .admin-ai-form {
    padding: 11px;
  }

  .admin-ai-meta {
    grid-template-columns: 1fr;
  }

  .admin-ai-meta > div {
    padding: 11px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-ai-meta > div:last-child {
    border-bottom: 0;
  }

  .admin-user-panel .admin-table-wrap,
  .admin-master-panel .admin-table-wrap,
  .admin-record-panel .admin-table-wrap,
  .admin-audit-panel .admin-table-wrap {
    max-height: 360px;
  }

  .header-main {
    gap: 7px 10px;
    padding: 7px 10px;
  }

  .brand {
    grid-template-columns: 46px auto;
    gap: 8px;
  }

  .brand-logo {
    width: 46px;
    height: 40px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .brand p {
    margin-top: 1px;
    font-size: 9px;
  }

  .tabs {
    gap: 3px;
  }

  .tab {
    min-height: 34px;
    font-size: 12px;
  }

  .header-metrics {
    gap: 0;
  }

  .metric {
    min-height: 29px;
    padding: 2px 7px;
  }

  .metric span {
    font-size: 9px;
  }

  .metric strong {
    font-size: 14px;
  }

  .header-account {
    gap: 4px;
  }

  .header-account-button {
    min-height: 29px;
    padding: 0 7px;
    font-size: 11px;
  }

  .account-identity span {
    display: none;
  }

  .main-shell {
    padding: 9px 9px 18px;
  }

  .search-toolbar {
    gap: 8px;
    margin-bottom: 9px;
    padding: 10px;
  }

  .admin-table-wrap {
    overflow: visible;
    max-height: none !important;
  }

  .admin-table,
  .admin-table thead,
  .admin-table tbody {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tbody {
    display: grid;
    gap: 8px;
    padding: 8px;
    background: #eef2f3;
  }

  .admin-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(28, 43, 51, 0.05);
  }

  .admin-table tbody td {
    display: block;
    width: auto !important;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .admin-master-panel .admin-table tbody tr {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-master-panel .admin-table-wrap {
    max-height: min(52dvh, 520px) !important;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .admin-master-panel .admin-table tbody td {
    grid-column: 1 / -1;
  }

  .admin-master-panel .admin-table tbody td::before {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
  }

  .admin-master-panel .admin-inline-field {
    width: 100%;
    min-width: 0;
  }

  .admin-user-panel .admin-table tbody td:nth-child(1),
  .admin-user-panel .admin-table tbody td:nth-child(5),
  .admin-record-panel .admin-table tbody td:nth-child(1),
  .admin-record-panel .admin-table tbody td:nth-child(2),
  .admin-record-panel .admin-table tbody td:nth-child(5),
  .admin-record-panel .admin-table tbody td:nth-child(6),
  .admin-audit-panel .admin-table tbody td:nth-child(1),
  .admin-audit-panel .admin-table tbody td:nth-child(5) {
    grid-column: 1 / -1;
  }

  .admin-user-panel .admin-table tbody td:nth-child(2),
  .admin-user-panel .admin-table tbody td:nth-child(3),
  .admin-user-panel .admin-table tbody td:nth-child(4) {
    align-self: center;
  }

  .admin-user-panel .admin-table tbody td:nth-child(3)::before,
  .admin-user-panel .admin-table tbody td:nth-child(4)::before,
  .admin-record-panel .admin-table tbody td:nth-child(3)::before,
  .admin-record-panel .admin-table tbody td:nth-child(4)::before,
  .admin-record-panel .admin-table tbody td:nth-child(5)::before,
  .admin-audit-panel .admin-table tbody td:nth-child(2)::before,
  .admin-audit-panel .admin-table tbody td:nth-child(3)::before,
  .admin-audit-panel .admin-table tbody td:nth-child(4)::before,
  .admin-audit-panel .admin-table tbody td:nth-child(5)::before {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 10px;
  }

  .admin-user-panel .admin-table tbody td:nth-child(3)::before { content: "状态"; }
  .admin-user-panel .admin-table tbody td:nth-child(4)::before { content: "最后登录"; }
  .admin-record-panel .admin-table tbody td:nth-child(3)::before { content: "日期"; }
  .admin-record-panel .admin-table tbody td:nth-child(4)::before { content: "图片"; }
  .admin-record-panel .admin-table tbody td:nth-child(5)::before { content: "状态 / 位置"; }
  .admin-audit-panel .admin-table tbody td:nth-child(2)::before { content: "操作人"; }
  .admin-audit-panel .admin-table tbody td:nth-child(3)::before { content: "动作"; }
  .admin-audit-panel .admin-table tbody td:nth-child(4)::before { content: "对象"; }
  .admin-audit-panel .admin-table tbody td:nth-child(5)::before { content: "说明"; }

  .admin-table .admin-row-actions {
    justify-content: flex-start;
  }

}

.admin-user-panel .admin-table th:nth-child(1),
.admin-user-panel .admin-table td:nth-child(1) {
  width: 180px;
}

.admin-user-panel .admin-table th:nth-child(2),
.admin-user-panel .admin-table td:nth-child(2) {
  width: 138px;
}

.admin-user-panel .admin-table th:nth-child(3),
.admin-user-panel .admin-table td:nth-child(3) {
  width: 92px;
}

.admin-user-panel .admin-table th:nth-child(4),
.admin-user-panel .admin-table td:nth-child(4) {
  width: 150px;
}

/* Arrival inspection record */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.arrival-search-toolbar {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.arrival-inspection-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.arrival-inspection-content {
  position: relative;
  min-width: 0;
}

.arrival-inspection-sections {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.arrival-inspection-content.is-not-sampled .arrival-inspection-sections {
  opacity: 0.32;
  filter: grayscale(0.7);
  pointer-events: none;
  user-select: none;
}

.arrival-inspection-unavailable {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 20px;
  background: rgba(247, 250, 250, 0.72);
  color: var(--muted);
  text-align: center;
  cursor: default;
}

.arrival-inspection-unavailable strong {
  position: sticky;
  top: 20px;
  font-size: 18px;
  font-weight: 700;
}

.arrival-inspection-section {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.arrival-inspection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.arrival-inspection-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.arrival-inspection-head span {
  min-width: 48px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.arrival-inspection-table {
  min-width: 0;
}

.arrival-inspection-row {
  display: grid;
  grid-template-columns: 36px minmax(112px, 0.85fr) minmax(88px, 0.5fr) minmax(112px, 1fr) minmax(88px, 0.55fr);
  align-items: center;
  min-width: 0;
  border-top: 1px solid #e7ecee;
}

.arrival-inspection-row:first-child {
  border-top: 0;
}

.arrival-inspection-row > * {
  min-width: 0;
  margin: 0;
  padding: 6px 7px;
}

.arrival-inspection-row > * + * {
  border-left: 1px solid #e7ecee;
}

.arrival-inspection-row.is-heading {
  min-height: 32px;
  background: #f5f8f8;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.arrival-inspection-row.is-heading > * {
  text-align: left;
}

.arrival-inspection-index {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.arrival-inspection-row label {
  display: block;
}

.arrival-inspection-row select,
.arrival-inspection-row input {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 5px 7px;
  font-size: 11px;
}

.arrival-inspection-item-input {
  border-color: #c7d4d7;
  background: #fbfcfc;
  color: var(--ink);
  font-weight: 700;
}

.arrival-inspection-item-input:not(:disabled):hover,
.arrival-inspection-item-input:not(:disabled):focus {
  border-color: var(--accent);
  background: #fff;
}

.arrival-inspection-item-input:disabled {
  border-color: transparent;
  background: transparent;
  opacity: 1;
}

.arrival-inspection-row input::placeholder {
  color: #9aa6aa;
}

.arrival-inspection-owner-cell {
  display: grid;
  place-items: center;
}

.arrival-inspection-owner-button {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 6px;
  border: 1px solid #b8c9cc;
  border-radius: 4px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.arrival-inspection-owner-button:hover,
.arrival-inspection-owner-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.arrival-inspection-owner-button.is-signed {
  border-color: #b7d9d4;
  background: #edf8f6;
  color: #096b63;
}

.arrival-inspection-owner-name {
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: center;
}

.arrival-inspection-owner-name.is-empty {
  color: var(--muted);
  font-weight: 500;
}

.arrival-conclusion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 10px;
  padding: 11px;
}

.arrival-conclusion-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
}

.arrival-conclusion-grid input,
.arrival-conclusion-grid select,
.arrival-conclusion-grid textarea {
  width: 100%;
  min-width: 0;
  min-height: 34px;
}

.arrival-conclusion-grid textarea {
  min-height: 70px;
  resize: vertical;
}

.arrival-conclusion-wide {
  grid-column: 1 / -1;
}

.arrival-workflow-signature-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
}

.arrival-workflow-signature-button,
.arrival-workflow-signature-name {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  place-items: center;
  padding: 6px 9px;
  border: 1px solid #b8c9cc;
  border-radius: 4px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: center;
}

.arrival-workflow-signature-button:hover,
.arrival-workflow-signature-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.arrival-workflow-signature-button.is-signed,
.arrival-workflow-signature-name:not(.is-empty) {
  border-color: #b7d9d4;
  background: #edf8f6;
  color: #096b63;
}

.arrival-workflow-signature-name.is-empty {
  color: var(--muted);
  font-weight: 500;
}

.arrival-inspection-actions {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: #f8fbfa;
}

.arrival-inspection-actions.is-autosave {
  display: flex;
  justify-content: flex-end;
}

.arrival-inspection-actions.is-autosave .arrival-inspection-commands {
  width: 100%;
}

.arrival-inspection-actions.is-autosave .arrival-inspection-commands button {
  margin-left: auto;
}

.arrival-inspection-commands {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.arrival-inspection-commands button {
  min-height: 34px;
  white-space: nowrap;
}

.arrival-inspection-form :disabled {
  cursor: default;
}

body.qc-document-open {
  overflow: hidden;
}

@media (min-width: 981px) {
  html,
  body {
    overflow: hidden;
  }

  body {
    position: fixed;
    inset: 0;
    width: 100%;
  }

  #appShell:not([hidden]) {
    position: fixed;
    inset: 0;
  }
}

.qc-document-modal {
  position: fixed;
  inset: 0;
  z-index: 360;
  display: none;
  place-items: center;
  padding: 20px;
}

.qc-document-modal.is-open {
  display: grid;
}

.qc-document-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 28, 33, 0.68);
}

.qc-document-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1120px, 100%);
  height: min(900px, calc(100dvh - 40px));
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #e9edef;
  box-shadow: 0 24px 70px rgba(8, 20, 25, 0.32);
}

.qc-document-modal.is-notice .qc-document-panel {
  width: min(440px, 100%);
  height: auto;
  max-height: calc(100dvh - 40px);
}

.qc-document-modal.is-notice .qc-document-scroll {
  overflow: visible;
  padding: 0;
  background: #fff;
}

.qc-document-notice {
  display: grid;
  justify-items: center;
  gap: 22px;
  min-height: 180px;
  align-content: center;
  padding: 28px;
  text-align: center;
}

.qc-document-notice p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.qc-document-notice button {
  min-width: 92px;
}

.qc-document-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--header);
  color: #fff;
}

.qc-document-toolbar > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.qc-document-toolbar span {
  color: #a9bbbf;
  font-size: 9px;
}

.qc-document-toolbar h2 {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qc-document-toolbar .icon-button {
  flex: 0 0 auto;
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.qc-document-scroll {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  overscroll-behavior: contain;
}

.qc-document-sheet {
  width: 100%;
  min-width: 820px;
  max-width: 1020px;
  min-height: 690px;
  margin: 0 auto;
  padding: 36px 40px 44px;
  background: #fff;
  color: #172024;
  box-shadow: 0 4px 18px rgba(17, 29, 34, 0.12);
  font-family: "SimSun", "Microsoft YaHei UI", sans-serif;
}

.qc-document-sheet table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.qc-document-sheet th,
.qc-document-sheet td {
  height: 34px;
  padding: 6px 7px;
  border: 1px solid #273136;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: left;
  vertical-align: middle;
}

.qc-document-sheet th {
  background: #f5f6f6;
  font-weight: 700;
  text-align: center;
}

.qc-document-name {
  height: 58px !important;
  background: #fff !important;
  font-family: "Microsoft YaHei UI", sans-serif;
  font-size: 22px !important;
  text-align: center !important;
}

.qc-document-details {
  margin-top: -1px;
}

.qc-document-details th:nth-child(1),
.qc-document-details td:nth-child(1) {
  width: 46px;
  text-align: center;
}

.qc-document-details th:nth-child(2),
.qc-document-details td:nth-child(2) {
  width: 190px;
}

.qc-document-details th:nth-child(3),
.qc-document-details td:nth-child(3),
.qc-document-details th:nth-child(4),
.qc-document-details td:nth-child(4),
.qc-document-details th:nth-child(5),
.qc-document-details td:nth-child(5) {
  width: 62px;
  text-align: center;
}

.qc-document-details tbody td:nth-child(3),
.qc-document-details tbody td:nth-child(4),
.qc-document-details tbody td:nth-child(5) {
  color: var(--accent-dark);
  font-family: "Microsoft YaHei UI", sans-serif;
  font-size: 15px;
  font-weight: 800;
}

.qc-document-details th:nth-child(7),
.qc-document-details td:nth-child(7) {
  width: 102px;
  text-align: center;
}

.qc-document-owner {
  font-family: "Microsoft YaHei UI", sans-serif;
  font-size: 11px;
  font-weight: 700;
}

.qc-document-conclusion {
  margin-top: -1px;
}

.qc-document-conclusion th {
  width: 86px;
}

.qc-document-conclusion td {
  height: 44px;
}

.qc-document-choice {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px 9px 2px 0;
  white-space: nowrap;
}

.qc-document-choice i {
  display: inline-grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border: 1px solid #4c565a;
  color: var(--accent-dark);
  font-family: "Microsoft YaHei UI", sans-serif;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.qc-document-choice.is-selected {
  font-weight: 700;
}

.qc-document-description {
  min-height: 70px;
  white-space: pre-wrap;
}

@media (max-width: 1400px) {
  .arrival-inspection-row:not(.is-heading) {
    grid-template-columns: 34px minmax(0, 1fr) 102px;
    grid-template-areas:
      "index item result"
      "index remark owner";
    padding: 7px 0;
  }

  .arrival-inspection-row:not(.is-heading) > * {
    border-left: 0;
  }

  .arrival-inspection-row:not(.is-heading) .arrival-inspection-index {
    grid-area: index;
    align-self: stretch;
    display: grid;
    place-items: center;
    border-right: 1px solid #e7ecee;
  }

  .arrival-inspection-row:not(.is-heading) .arrival-inspection-item-cell {
    grid-area: item;
  }

  .arrival-inspection-row:not(.is-heading) .arrival-inspection-result-cell {
    grid-area: result;
  }

  .arrival-inspection-row:not(.is-heading) .arrival-inspection-remark-cell {
    grid-area: remark;
    padding-top: 0;
  }

  .arrival-inspection-row:not(.is-heading) .arrival-inspection-owner-cell {
    grid-area: owner;
    padding-top: 0;
  }

  .arrival-inspection-row.is-heading {
    display: none;
  }
}

@media (max-width: 980px) {
  .arrival-search-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 720px) {
  .arrival-search-toolbar {
    grid-template-columns: 1fr;
  }

  .arrival-search-toolbar .search-field,
  .arrival-search-toolbar .search-action {
    grid-column: auto;
  }

  .arrival-inspection-form {
    margin-top: 12px;
    padding-top: 12px;
  }

  .arrival-inspection-row:not(.is-heading) {
    grid-template-columns: 30px minmax(0, 1fr) 104px;
  }

  .arrival-conclusion-grid {
    grid-template-columns: 1fr;
  }

  .arrival-conclusion-wide {
    grid-column: auto;
  }

  .arrival-inspection-actions {
    grid-template-columns: 1fr;
  }

  .arrival-inspection-commands {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .arrival-inspection-commands button {
    width: 100%;
    white-space: normal;
  }

  .arrival-inspection-commands .primary:last-child:nth-child(3) {
    grid-column: 1 / -1;
  }

  .qc-document-modal {
    padding: 0;
  }

  .qc-document-panel {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .qc-document-toolbar {
    min-height: 58px;
    padding: 9px 11px;
  }

  .qc-document-toolbar h2 {
    font-size: 13px;
  }

  .qc-document-scroll {
    padding: 10px;
  }

  .qc-document-sheet {
    min-width: 760px;
    padding: 28px 30px 36px;
  }
}

@media (max-width: 420px) {
  .arrival-inspection-row:not(.is-heading) {
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-areas:
      "index item"
      "index result"
      "index remark"
      "index owner";
  }

  .arrival-inspection-row:not(.is-heading) .arrival-inspection-result-cell {
    padding-top: 0;
  }

  .arrival-inspection-commands {
    grid-template-columns: 1fr;
  }

  .arrival-inspection-commands .primary:last-child:nth-child(3) {
    grid-column: auto;
  }
}

@media (min-width: 721px) and (max-width: 1180px) {
  .admin-record-toolbar {
    grid-template-columns: minmax(130px, 0.75fr) minmax(240px, 1.5fr) repeat(2, minmax(128px, 0.75fr));
  }

  .admin-record-toolbar-actions {
    grid-column: 4;
  }
}

@media (max-width: 720px) {
  .admin-record-head {
    align-items: center;
    flex-direction: row;
    gap: 10px;
  }

  .admin-record-head > div {
    min-width: 0;
  }

  .admin-record-head p {
    display: none;
  }

  .admin-record-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .admin-record-kind-field,
  .admin-record-query-field,
  .admin-record-toolbar-actions {
    grid-column: 1 / -1;
  }

  .admin-record-toolbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-record-toolbar-actions button {
    width: 100%;
  }

  .admin-record-resultbar,
  .admin-record-footer {
    padding-right: 10px;
    padding-left: 10px;
  }

  .admin-record-resultbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  #adminRecordFilterSummary {
    width: 100%;
  }

  .admin-record-panel .admin-record-table-wrap {
    max-height: min(58dvh, 620px) !important;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .admin-record-panel .admin-table tbody {
    gap: 7px;
    padding: 7px;
  }

  .admin-record-panel .admin-table tbody tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 11px;
  }

  .admin-record-panel .admin-table tbody td:nth-child(1),
  .admin-record-panel .admin-table tbody td:nth-child(2),
  .admin-record-panel .admin-table tbody td:nth-child(5),
  .admin-record-panel .admin-table tbody td:nth-child(6) {
    grid-column: 1 / -1;
  }

  .admin-record-panel .admin-table tbody td::before {
    display: block !important;
    margin-bottom: 4px;
    color: var(--muted);
    content: attr(data-label) !important;
    font-size: 9px;
    font-weight: 700;
  }

  .admin-record-panel .admin-table tbody td:nth-child(1)::before,
  .admin-record-panel .admin-table tbody td:nth-child(2)::before {
    display: none !important;
  }

  .admin-record-panel .admin-table tbody td:nth-child(2) {
    padding-bottom: 8px;
    border-bottom: 1px solid #e5eaec;
  }

  .admin-record-panel .admin-row-actions,
  .admin-record-command-row {
    width: 100%;
  }

  .admin-record-command-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-record-command-row .admin-action,
  .admin-record-panel .admin-row-actions > .admin-action {
    width: 100%;
  }

  .admin-inspector-revoke {
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }

  .admin-correction-record {
    grid-template-columns: 1fr;
  }

  .admin-correction-record > div {
    padding: 9px 10px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .admin-correction-record > div:first-child {
    border-top: 0;
  }

  .admin-correction-change {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .admin-correction-arrow {
    justify-self: center;
    transform: rotate(90deg);
  }

  .admin-correction-content {
    padding: 13px;
  }

  .admin-correction-form .arrival-sampling-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .header-account {
    margin-left: auto;
    padding-left: 0;
    border-left: 0;
  }

  .account-menu-trigger {
    width: min(146px, 36vw);
    min-width: 88px;
    min-height: 34px;
  }

  .account-menu {
    right: 0;
    min-width: 150px;
  }

  .password-change-modal {
    padding: 12px;
  }

  .password-change-panel {
    width: min(420px, 100%);
    height: auto;
    max-height: calc(100dvh - 24px);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
  }

  .password-change-actions {
    grid-template-columns: 1fr;
  }

  .password-change-actions > span:empty {
    display: none;
  }

  .password-change-actions > div {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

/* iOS and WeChat zoom focused form controls when their text is smaller than 16px. */
@media (max-width: 720px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Independent product image library */
.product-library-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(180px, 260px) auto minmax(12px, 1fr) auto auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.product-library-toolbar label {
  gap: 4px;
}

.product-library-toolbar .quick-search-control {
  min-height: 36px;
}

.product-library-toolbar .quick-search-control input {
  min-height: 34px;
}

.product-library-toolbar-spacer {
  min-width: 0;
}

.product-library-recycle-toggle[aria-pressed="true"] {
  border-color: #d1a85e;
  background: #fff6e5;
  color: #7f5b1e;
}

.product-library-workspace {
  display: grid;
  grid-template-columns: minmax(520px, 0.78fr) minmax(620px, 1.22fr);
  gap: 12px;
  height: calc(100dvh - 172px);
  min-height: 500px;
}

.product-library-list-surface,
.product-library-detail-surface {
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.product-library-list-surface {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.product-library-detail-surface {
  grid-template-rows: auto minmax(0, 1fr);
}

.product-library-mobile-switch {
  display: none;
}

.product-library-table-wrap {
  min-height: 0;
  overflow: auto;
}

.product-library-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  table-layout: fixed;
}

.product-library-table th,
.product-library-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e7ecee;
  text-align: left;
  vertical-align: middle;
}

.product-library-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 38px;
  background: #f4f7f7;
  color: #596970;
  font-size: 11px;
}

.product-library-table tbody tr[data-product-id] {
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.product-library-table tbody tr[data-product-id]:hover {
  background: #f4faf9;
}

.product-library-table tbody tr[data-product-id].is-selected {
  background: #ecf7f5;
  box-shadow: inset 3px 0 0 var(--accent);
}

.product-library-table td strong,
.product-library-table td small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-library-table td strong {
  color: #132f34;
  font-size: 13px;
}

.product-library-table td small,
.product-library-table time {
  color: var(--muted);
  font-size: 10px;
}

.product-library-thumb-column {
  width: 76px;
}

.product-library-date-column {
  width: 96px;
}

.product-library-row-thumb,
.product-library-row-empty {
  display: grid;
  width: 54px;
  height: 54px;
  overflow: hidden;
  place-items: center;
  border: 1px solid #d5dee1;
  border-radius: 6px;
  background: #edf2f3;
}

.product-library-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-library-row-empty {
  color: #84939a;
  font-size: 10px;
}

.product-library-footer {
  justify-content: space-between;
}

.product-library-detail-scroll {
  min-height: 0;
  padding: 12px;
  overflow: auto;
  overscroll-behavior: contain;
}

.product-library-product-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.product-library-product-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 0;
}

.product-library-product-title strong {
  max-width: 100%;
  color: #0f3538;
  font-size: 19px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-library-product-title span {
  max-width: 100%;
  color: #34545b;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.product-library-product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.product-library-product-actions {
  display: flex;
  gap: 7px;
}

.product-library-product-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.product-library-type-tabs {
  display: flex;
  gap: 3px;
  margin-top: 11px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #edf2f3;
}

.product-library-type-tabs button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 34px;
  border-radius: 5px;
  background: transparent;
  color: #627279;
  font-size: 12px;
  font-weight: 700;
}

.product-library-type-tabs button.is-active {
  background: #fff;
  color: var(--accent-dark);
  box-shadow: 0 1px 4px rgba(23, 36, 42, 0.12);
}

.product-library-brand-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.product-library-brand-chip {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #d5dfe1;
  border-radius: 6px;
  background: #fff;
  color: #617178;
  font-size: 11px;
}

.product-library-brand-chip.is-active {
  border-color: #6daaa4;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.product-library-image-toolbar {
  display: grid;
  grid-template-columns: auto minmax(120px, 170px) minmax(120px, 170px) auto auto;
  gap: 7px;
  align-items: center;
  min-height: 42px;
  margin-top: 8px;
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f8faf9;
}

.product-library-image-toolbar.is-product-type {
  grid-template-columns: auto minmax(150px, 220px) auto auto;
}

.product-library-packaging-upload {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-height: 40px;
  margin-top: 7px;
}

.product-library-packaging-upload select {
  width: min(220px, 48%);
  min-height: 32px;
  padding: 5px 28px 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
}

.product-library-packaging-upload button {
  min-height: 32px;
  padding: 0 11px;
}

.product-library-selection-count {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.product-library-image-toolbar select {
  min-width: 0;
  min-height: 30px;
  padding: 4px 26px 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
}

.product-library-image-toolbar button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

.product-library-image-section {
  padding: 11px 0 4px;
}

.product-library-image-section + .product-library-image-section {
  border-top: 1px solid #e6ebed;
}

.product-library-image-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.product-library-image-section-head strong {
  color: #29464c;
  font-size: 12px;
}

.product-library-image-section-head span {
  color: var(--muted);
  font-size: 10px;
}

.product-library-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 9px;
}

.product-library-image-tile,
.product-library-image-add {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #d5dee1;
  border-radius: 7px;
  background: #edf2f3;
}

.product-library-image-tile {
  transition: transform 170ms ease, box-shadow 170ms ease, opacity 170ms ease;
}

.product-library-image-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(23, 36, 42, 0.13);
}

.product-library-image-tile.is-dragging {
  opacity: 0.38;
  transform: scale(0.96);
}

.product-library-image-tile.is-reorder-target {
  box-shadow: 0 0 0 3px rgba(8, 127, 122, 0.3);
}

.product-library-image-tile.is-order-moving {
  animation: product-image-order-in 260ms ease both;
  animation-delay: var(--product-image-delay, 0ms);
}

@keyframes product-image-order-in {
  from { opacity: 0.55; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.product-library-image-preview {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
}

.product-library-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-library-image-check {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  display: block;
  width: 24px;
  height: 24px;
  margin: 0;
  cursor: pointer;
}

.product-library-image-check input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.product-library-image-check span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 5px;
  background: rgba(21, 34, 40, 0.74);
  box-shadow: 0 1px 4px rgba(8, 18, 22, 0.2);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.product-library-image-check span::after {
  content: "";
  width: 6px;
  height: 11px;
  margin-top: -2px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  opacity: 0;
  transform: rotate(45deg) scale(0.7);
  transition: opacity 120ms ease, transform 140ms ease;
}

.product-library-image-check:hover span {
  background: rgba(21, 34, 40, 0.88);
}

.product-library-image-check input:checked + span {
  border-color: rgba(255, 255, 255, 0.96);
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(8, 127, 122, 0.32);
}

.product-library-image-check input:checked + span::after {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}

.product-library-image-check input:focus-visible + span {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.product-library-image-date {
  position: absolute;
  right: 5px;
  bottom: 5px;
  max-width: calc(100% - 10px);
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(18, 29, 34, 0.72);
  color: #fff;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
}

.product-library-image-remove,
.product-library-image-restore {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  display: grid;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  place-items: center;
  border-radius: 5px;
  background: rgba(21, 34, 40, 0.72);
  color: #fff;
  font-size: 10px;
}

.product-library-image-remove:hover {
  background: rgba(178, 58, 58, 0.94);
}

.product-library-image-remove {
  width: 24px;
  min-width: 24px;
  padding: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}

.product-library-image-restore {
  background: rgba(8, 127, 122, 0.9);
}

.product-library-image-add {
  display: grid;
  min-height: 126px;
  place-items: center;
  border-style: dashed;
  border-color: #9cb4b7;
  background: #f7faf9;
  color: var(--accent-dark);
  font-size: 30px;
  transition: border-color 140ms ease, background 140ms ease;
}

.product-library-image-add:hover,
.product-library-image-grid.is-dragover .product-library-image-add {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.product-library-empty-images {
  display: grid;
  min-height: 170px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.product-library-product-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.product-library-product-fields .form-error {
  grid-column: 1 / -1;
}

.product-library-product-panel {
  width: min(560px, calc(100vw - 28px));
  height: auto;
}

body.product-image-recognition-modal-open {
  overflow: hidden;
}

.product-image-recognition-modal {
  z-index: 360;
}

.product-image-recognition-panel {
  width: min(1080px, 100%);
  height: min(840px, calc(100dvh - 40px));
}

.product-image-recognition-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}

.product-image-recognition-content {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 18px;
}

.product-image-recognition-query,
.product-image-recognition-notice,
.product-image-recognition-candidates,
.product-image-recognition-results,
.product-image-recognition-stopped {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.product-image-recognition-query {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.product-image-recognition-description {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.product-image-recognition-description textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  line-height: 1.55;
}

.product-image-recognition-drop-zone {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 118px;
  padding: 10px;
  overflow: hidden;
  border: 1px dashed #9cb4b7;
  border-radius: 7px;
  background: #f7faf9;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.product-image-recognition-drop-zone::after {
  content: "松开即可添加图片";
  position: absolute;
  inset: 5px;
  z-index: 5;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 6px;
  background: rgba(231, 247, 244, 0.94);
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.product-image-recognition-drop-zone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(8, 127, 122, 0.13);
}

.product-image-recognition-drop-zone.is-dragover::after {
  opacity: 1;
}

.product-image-recognition-upload-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 18px;
}

.product-image-recognition-upload-hint > span {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.product-image-recognition-upload-hint > small {
  color: var(--muted);
  font-size: 10px;
}

.product-image-recognition-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  min-height: 66px;
}

.product-image-recognition-preview-item,
.product-image-recognition-add {
  flex: 0 0 66px;
  width: 66px;
  height: 66px;
}

.product-image-recognition-preview-image,
.product-image-recognition-preview-image img {
  display: block;
  width: 100%;
  height: 100%;
}

.product-image-recognition-preview-image img {
  object-fit: contain;
}

.product-image-recognition-add {
  background: #fff;
}

.product-image-recognition-add:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.product-image-recognition-remove:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.product-image-recognition-error {
  margin: 0;
}

.product-image-recognition-output {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.product-image-recognition-empty,
.product-image-recognition-loading,
.product-image-recognition-no-match {
  display: grid;
  min-height: 130px;
  place-items: center;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.product-image-recognition-empty.is-error {
  border-color: #e0b2b2;
  background: #fff4f4;
  color: var(--danger-dark);
}

.product-image-recognition-loading {
  align-content: center;
  gap: 6px;
}

.product-image-recognition-loading > span {
  width: 28px;
  height: 28px;
  border: 3px solid #cfdddd;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: product-recognition-spin 800ms linear infinite;
}

.product-image-recognition-loading strong {
  color: var(--ink);
  font-size: 13px;
}

.product-image-recognition-loading small {
  color: var(--muted);
  font-size: 10px;
}

@keyframes product-recognition-spin {
  to { transform: rotate(360deg); }
}

.product-image-recognition-notice,
.product-image-recognition-candidates,
.product-image-recognition-stopped {
  padding: 10px 12px;
}

.product-image-recognition-notice.is-warning {
  border-color: #e4c88e;
  background: #fff9ed;
}

.product-image-recognition-notice > strong,
.product-image-recognition-stopped > strong {
  color: #79591f;
  font-size: 11px;
}

.product-image-recognition-notice ul {
  display: grid;
  gap: 5px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.product-image-recognition-notice li {
  display: grid;
  grid-template-columns: minmax(100px, 0.45fr) minmax(0, 1fr);
  gap: 8px;
}

.product-image-recognition-notice li span,
.product-image-recognition-notice li small {
  overflow-wrap: anywhere;
  font-size: 10px;
}

.product-image-recognition-notice li span {
  color: var(--ink);
}

.product-image-recognition-notice li small {
  color: #765f35;
}

.product-image-recognition-candidates {
  display: grid;
  gap: 8px;
}

.product-image-recognition-candidates > div:first-child,
.product-image-recognition-results > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-image-recognition-candidates strong,
.product-image-recognition-results header strong {
  color: var(--ink);
  font-size: 12px;
}

.product-image-recognition-candidates span,
.product-image-recognition-results header span {
  color: var(--muted);
  font-size: 10px;
}

.product-image-recognition-name-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-image-recognition-name-list span {
  padding: 5px 8px;
  border: 1px solid #b7d8d3;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.product-image-recognition-results {
  overflow: hidden;
}

.product-image-recognition-results > header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.product-image-recognition-results > header > div {
  display: grid;
  gap: 2px;
}

.product-image-recognition-results > header button {
  flex: 0 0 auto;
  min-height: 32px;
}

.product-image-recognition-match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.product-image-recognition-match {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  min-width: 0;
  min-height: 132px;
  padding: 10px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: inherit;
  text-align: left;
}

.product-image-recognition-match:hover,
.product-image-recognition-match:focus-visible {
  z-index: 1;
  background: #f2faf8;
  box-shadow: inset 0 0 0 2px #84beb6;
}

.product-image-recognition-rank {
  position: absolute;
  z-index: 1;
  top: 14px;
  left: 14px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: rgba(10, 107, 103, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.product-image-recognition-match-image {
  display: grid;
  width: 92px;
  height: 110px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef2f3;
  color: var(--muted);
  font-size: 10px;
}

.product-image-recognition-match-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-image-recognition-match-body {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.product-image-recognition-match-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.product-image-recognition-match-head strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
}

.product-image-recognition-match-head b {
  flex: 0 0 auto;
  color: var(--accent-dark);
  font-size: 13px;
}

.product-image-recognition-model {
  overflow-wrap: anywhere;
  color: #334d54;
  font-size: 11px;
  font-weight: 700;
}

.product-image-recognition-image-type {
  color: var(--muted);
  font-size: 9px;
}

.product-image-recognition-match-body small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.product-image-recognition-no-match {
  margin: 12px;
}

.product-image-recognition-stopped {
  border-color: #e0b2b2;
  background: #fff4f4;
}

.product-image-recognition-stopped > strong {
  color: var(--danger-dark);
}

.product-image-recognition-stopped p {
  margin: 5px 0 0;
  color: #7e4545;
  font-size: 11px;
}

.product-image-recognition-actions > div {
  display: flex;
  gap: 8px;
}

body.product-library-mobile-detail-active .product-library-toolbar {
  display: none;
}

@media (max-width: 1180px) {
  .product-library-workspace {
    grid-template-columns: minmax(420px, 0.72fr) minmax(520px, 1fr);
  }

  .product-library-image-grid {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  }
}

@media (max-width: 900px) {
  .product-library-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) repeat(4, auto);
  }

  .product-library-toolbar > button[type="submit"] {
    grid-column: 3;
  }

  .product-library-toolbar-spacer {
    display: none;
  }

  .product-library-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .product-library-detail-surface {
    min-height: 650px;
  }
}

@media (max-width: 720px) {
  .product-library-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 9px;
  }

  .product-library-toolbar label {
    grid-column: 1 / -1;
  }

  .product-library-toolbar > button {
    width: 100%;
  }

  .product-library-toolbar > button[type="submit"] {
    grid-column: auto;
  }

  .product-image-recognition-modal {
    padding: 8px;
  }

  .product-image-recognition-panel {
    width: 100%;
    height: calc(100dvh - 16px);
    max-height: none;
  }

  .product-image-recognition-content {
    padding: 10px;
  }

  .product-image-recognition-preview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .product-image-recognition-match-grid {
    grid-template-columns: 1fr;
  }

  .product-image-recognition-match {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .product-image-recognition-match-image {
    width: 84px;
    height: 102px;
  }

  .product-image-recognition-notice li {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .product-image-recognition-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .product-image-recognition-actions > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-library-workspace {
    gap: 8px;
    min-height: 0;
  }

  .product-library-mobile-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #e7edef;
  }

  .product-library-mobile-switch button {
    min-height: 36px;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }

  .product-library-mobile-switch button.is-active {
    background: #fff;
    color: var(--accent-dark);
    box-shadow: 0 1px 4px rgba(23, 36, 42, 0.12);
  }

  .product-library-mobile-switch button:disabled {
    opacity: 0.45;
  }

  .product-library-workspace[data-mobile-pane="list"] .product-library-detail-surface,
  .product-library-workspace[data-mobile-pane="detail"] .product-library-list-surface {
    display: none;
  }

  .product-library-list-surface {
    min-height: 0;
  }

  .product-library-table-wrap {
    overflow: visible;
  }

  .product-library-table,
  .product-library-table thead,
  .product-library-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .product-library-table thead {
    display: none;
  }

  .product-library-table tbody {
    display: grid;
    gap: 7px;
    padding: 8px;
    background: #eef2f3;
  }

  .product-library-table tbody tr[data-product-id] {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    grid-template-areas: "image name" "image model" "image date";
    gap: 3px 10px;
    min-height: 80px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .product-library-table tbody tr[data-product-id].is-selected {
    border-color: #8ec2bb;
    background: #f2faf8;
  }

  .product-library-table td {
    display: block;
    width: auto !important;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .product-library-table td:nth-child(1) { grid-area: image; }
  .product-library-table td:nth-child(2) { grid-area: date; }
  .product-library-table td:nth-child(3) { grid-area: name; }
  .product-library-table td:nth-child(4) { grid-area: model; }

  .product-library-row-thumb,
  .product-library-row-empty {
    width: 58px;
    height: 58px;
  }

  .product-library-detail-surface {
    height: calc(100dvh - 142px);
    min-height: 480px;
  }

  .product-library-detail-scroll {
    padding: 9px;
  }

  .product-library-product-head {
    grid-template-columns: 1fr;
  }

  .product-library-product-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-library-type-tabs button {
    min-height: 38px;
    padding: 0 5px;
    font-size: 11px;
  }

  .product-library-image-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-library-packaging-upload {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .product-library-packaging-upload select {
    width: 100%;
  }

  .product-library-selection-count {
    grid-column: 1 / -1;
  }

  .product-library-image-toolbar button,
  .product-library-image-toolbar select {
    width: 100%;
  }

  .product-library-image-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .product-library-image-add {
    min-height: 0;
    font-size: 25px;
  }

  .product-library-image-check {
    top: 4px;
    left: 4px;
  }

  .product-library-image-remove,
  .product-library-image-restore {
    top: 4px;
    right: 4px;
    min-width: 22px;
    height: 22px;
  }

  .product-library-image-remove {
    width: 24px;
    min-width: 24px;
    height: 24px;
    font-size: 18px;
  }

  .product-library-product-fields {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .product-library-product-fields .form-error {
    grid-column: auto;
  }
}

@media (max-width: 420px) {
  .product-library-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
