:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  background: #f3f6f4;
  color: #192e29;
  --muted: #536a61;
  --line: #dbe5e0;
  --accent: #17604f;
  --accent-dark: #12483c;
  --soft: #edf5f0;
  --focus: #187c62;
  --error: #962d24;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 1rem; line-height: 1.5; }
h1, h2, p, ul { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link { position: fixed; inset: .4rem auto auto .5rem; z-index: 1; transform: translateY(-200%); background: #fff; padding: .5rem .7rem; }
.skip-link:focus { transform: none; }

.topbar { background: #163b32; color: #fff; }
.topbar-inner, .page { width: min(100%, 86rem); margin: 0 auto; padding-inline: clamp(.7rem, 3vw, 2.4rem); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.25rem; }
.brand { font-weight: 750; letter-spacing: .08em; }
.session-controls { display: flex; align-items: center; gap: .65rem; color: #cee6da; font-size: .85rem; }
.quiet-button { border: 1px solid #79a697; border-radius: .4rem; background: transparent; color: #f5fbf7; padding: .25rem .55rem; }
.quiet-button:focus-visible { outline-color: #c4f2dd; }
.page { padding-block: clamp(1rem, 3vw, 2rem) 2.5rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: .7rem; margin-bottom: .9rem; }
h1 { font-size: clamp(1.5rem, 3vw, 2.35rem); line-height: 1.25; }
.list-summary { margin-top: .25rem; color: var(--muted); font-size: .875rem; }
.list-note { margin-top: .65rem; color: var(--muted); font-size: .8rem; }
.size-note { margin: 0 0 .65rem; color: var(--muted); font-size: .82rem; }
.muted, .empty-list, .empty-history { color: var(--muted); }
.empty-list { padding: 1rem; background: #fff; border: 1px solid var(--line); border-radius: .65rem; margin-bottom: .6rem; }
.notice { background: var(--soft); color: #12483c; border-radius: .45rem; padding: .38rem .55rem; font-size: .82rem; overflow-wrap: anywhere; }
.notice[data-tone="error"] { background: #fff0ed; color: var(--error); }
.pick-notice { margin: 0 0 .75rem; }

.primary-button, .secondary-button { border-radius: .43rem; padding: .42rem .62rem; min-height: 2.4rem; border: 1px solid transparent; white-space: nowrap; font-weight: 650; font-size: .825rem; }
.primary-button { background: var(--accent); color: white; }
.primary-button:hover:not(:disabled) { background: var(--accent-dark); }
.secondary-button { color: var(--accent-dark); background: #fff; border-color: #abc7b9; }
.secondary-button:hover:not(:disabled), .secondary-button[aria-expanded="true"] { background: var(--soft); }
.access-panel { max-width: 30rem; margin: min(6vh, 3rem) auto; display: grid; gap: .85rem; background: #fff; border: 1px solid var(--line); padding: clamp(1rem, 4vw, 2rem); border-radius: .8rem; }
.access-panel h1 { font-size: 1.45rem; }
.access-panel form { display: grid; gap: .65rem; }
.access-panel button { justify-self: start; min-width: 5rem; }
#scan-status[data-tone="error"] { color: var(--error); }

#pick-list { width: 100%; background: #fff; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: .7rem; table-layout: fixed; }
.photo-col { width: 8%; }
.size-col { width: 7%; }
.packing-col { width: 11%; }
.number-col { width: 7.3%; }
.shipment-col { width: 40%; }
.actions-col { width: 12.1%; }
#pick-list th, #pick-list td { text-align: start; vertical-align: middle; }
#pick-list thead th { background: #e9f2ed; padding: .6rem .5rem; font-size: .82rem; color: #244c40; font-weight: 700; }
#pick-list thead th:first-child { border-top-left-radius: .65rem; }
#pick-list thead th:last-child { border-top-right-radius: .65rem; }
.pick-row td { padding: .55rem .5rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.pick-row:nth-of-type(4n+3) { background: #fafcfb; }
.count-cell strong { font-variant-numeric: tabular-nums; }
.count-cell small { color: var(--muted); font-size: .73rem; }
.remaining-cell strong { color: var(--accent-dark); }
.product-size, .product-packing { font-size: .9rem; }
.cell-label { display: none; }
.photo-cell { text-align: center !important; }
.photo-button { display: inline-grid; place-items: center; background: #eff4f1; border: 1px solid var(--line); padding: 0; border-radius: .45rem; width: min(100%, 4rem); aspect-ratio: 1; overflow: hidden; }
.photo-button:hover { border-color: var(--accent); }
.product-thumb { display: block; width: 100%; height: 100%; object-fit: contain; }
.image-state { color: var(--muted); font-size: .7rem; }
.actions-cell .secondary-button { margin: .15rem .15rem .15rem 0; }
.completed-state { color: var(--accent-dark); font-size: .84rem; font-weight: 650; }
.completed-heading th { padding: .55rem .7rem; background: var(--soft); border-top: 1px solid var(--line); color: var(--accent-dark); }

fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
.shipment-form fieldset { display: grid; align-items: end; grid-template-columns: minmax(3.8rem, .65fr) minmax(4rem, 1fr) minmax(4.6rem, 1.15fr) auto; gap: .35rem; }
.field { min-width: 0; display: grid; align-content: start; gap: .18rem; font-weight: 650; font-size: .75rem; color: #35594d; }
.field input, .field select, .field textarea { color: #1b342b; width: 100%; min-width: 0; min-height: 2.4rem; padding: .35rem .4rem; border: 1px solid #adc3b8; border-radius: .35rem; background: #fff; font-size: 1rem; font-weight: 400; }
.field textarea { resize: vertical; }
.field :disabled { background: #eff4f1; }
.row-status, .feedback-status { margin-top: .4rem; }
.pick-details > td { padding: .6rem .75rem .8rem; background: #f0f6f2; border-top: 1px solid var(--line); }
.row-panels { display: grid; gap: .65rem; }
.feedback-form fieldset { display: grid; align-items: end; grid-template-columns: minmax(7rem, .35fr) minmax(0, 1fr) auto; gap: .55rem; }
.history-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.history-panel h2 { font-size: .89rem; margin-bottom: .27rem; }
.history-panel ul { padding: 0; list-style: none; }
.history-panel li { display: grid; gap: .13rem; padding: .34rem 0; border-top: 1px solid #d2e1d8; overflow-wrap: anywhere; font-size: .85rem; }
.history-panel li p { white-space: pre-wrap; }
.history-panel time, .empty-history { color: var(--muted); font-size: .75rem; }

#photo-dialog { width: min(91vw, 45rem); padding: .7rem; border: 1px solid var(--line); border-radius: .65rem; }
#photo-dialog::backdrop { background: #0d211bcc; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .55rem; }
.dialog-header h2 { font-size: 1rem; }
#full-photo { width: 100%; max-height: 76dvh; object-fit: contain; display: block; background: #f6f9f7; }

@media (max-width: 67rem) and (min-width: 53.01rem) {
  .shipment-form .save-shipment { grid-column: 1 / -1; justify-self: end; }
  .shipment-form fieldset { grid-template-columns: minmax(3.8rem, .65fr) minmax(4rem, 1fr) minmax(4.6rem, 1.15fr); }
}

@media (max-width: 53rem) {
  #pick-list { display: block; background: #fff; border: 1px solid var(--line); border-radius: .6rem; }
  #pick-list colgroup { display: none; }
  #pick-list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #pick-list tbody { display: block; }
  .pick-row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .2rem .3rem; padding: .6rem .55rem; border: 0; border-top: 1px solid var(--line); background: #fff !important; }
  #pending-rows > .pick-row:first-child { border-top: 0; }
  .pick-row td { display: block; min-width: 0; padding: 0; border: 0; }
  .pick-row .photo-cell { grid-column: 1 / 4; grid-row: 1 / span 2; align-self: center; }
  .pick-row .size-cell { grid-column: 4 / 7; grid-row: 1; }
  .pick-row .packing-cell { grid-column: 7 / -1; grid-row: 1; }
  .pick-row .ordered-cell { grid-column: 4 / 7; grid-row: 2; }
  .pick-row .shipped-cell { grid-column: 7 / 10; grid-row: 2; }
  .pick-row .remaining-cell { grid-column: 10 / -1; grid-row: 2; }
  .cell-label { display: block; color: var(--muted); font-size: .66rem; font-weight: 630; }
  .remaining-cell { border-radius: .3rem; background: #e4f2e9; }
  .pick-row .remaining-cell { padding-inline: .2rem; }
  .pick-row .shipment-cell { grid-column: 1 / -1; margin-top: .3rem; }
  .shipment-form fieldset { grid-template-columns: minmax(0, .68fr) minmax(0, 1fr) minmax(0, 1.18fr); }
  .shipment-form .save-shipment { grid-column: 1 / -1; width: 100%; }
  .pick-row .field input, .pick-row .save-shipment, .pick-details .field select, .pick-details .save-feedback { min-height: 2.75rem; }
  .pick-row .actions-cell { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: .25rem; }
  .actions-cell .secondary-button { min-height: 2.75rem; margin: .12rem 0 0; }
  .pick-details { display: block; }
  .pick-details > td { display: block; border: 0; border-top: 1px solid var(--line); padding: .65rem; }
  .completed-heading { display: block; margin-top: .8rem; }
  .completed-heading th { display: block; border: 0; border-radius: .45rem; }
  .feedback-form fieldset { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .feedback-description { grid-column: 1 / -1; }
  .history-panel { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
}
