:root {
  --logistics-ink: #213e4a;
  --logistics-muted: #536c77;
  --logistics-line: #dce6e5;
  --logistics-head: #f3f7f6;
  --logistics-accent: #275d70;
  --cargo-width: 145px;
  font-family: Arial, Helvetica, sans-serif;
}

[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.logistics-header {
  min-height: 58px;
  justify-content: space-between;
}
.logistics-header .site-brand { width: auto; }
.logistics-header .site-brand img { width: 210px; }
.demo-label { color: #d5e2e6; font-size: 12px; white-space: nowrap; }
.logistics-page { max-width: 1720px; margin: 0 auto; padding: 10px 14px 24px; }
.logistics-page .breadcrumbs { margin: 0 0 8px; }
.logistics-page h1 { margin: 0 0 8px; color: var(--logistics-ink); }
.logistics-tabs { display: flex; gap: 5px; margin-bottom: 8px; border-bottom: 1px solid var(--logistics-line); }
.logistics-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding-inline: 12px;
  border-bottom: 2px solid transparent;
  color: var(--logistics-muted);
  font-size: 13px;
  text-decoration: none;
}
.logistics-tabs a[aria-current="page"] {
  border-color: var(--logistics-accent);
  color: var(--logistics-ink);
  font-weight: 700;
}

.register-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--logistics-line);
}
.register-toolbar #search { max-width: 360px; min-width: 0; min-height: 32px; padding: 5px 8px; font-size: 12px; }
#goods-filter { width: auto; min-height: 32px; padding: 4px 7px; font-size: 12px; }
.row-count { margin-left: auto; white-space: nowrap; font-size: 12px; color: var(--logistics-muted); }
.column-settings {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
}
.logistics-page button { min-height: 28px; }
.column-settings summary, .quiet-button, .package-button {
  border: 1px solid #bfcfd1;
  border-radius: 5px;
  background: #fff;
  color: var(--logistics-accent);
  min-height: 28px;
  padding: 3px 7px;
  align-content: center;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.column-settings summary:hover, .quiet-button:hover:not(:disabled), .package-button:hover {
  background: var(--logistics-head);
}
.column-settings summary:focus-visible { outline: 3px solid #bc7440; outline-offset: 2px; }
.column-options {
  position: absolute;
  right: 0;
  z-index: 3;
  width: 138px;
  margin-top: 5px;
  padding: 4px;
  border: 1px solid #bfcfd1;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 5px 14px #192d371c;
}
.column-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  margin: 0;
  padding: 5px 7px;
  font-size: 13px;
  color: var(--logistics-ink);
}
.column-options input { width: auto; }
.row-count, .date, .number { font-variant-numeric: tabular-nums; }
.date { white-space: nowrap; }

.table-scroll {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.table-scroll:focus-visible { outline: 2px solid var(--logistics-accent); outline-offset: -2px; }
.logistics-page table, .logistics-dialog table { border-collapse: separate; border-spacing: 0; }
.logistics-page th, .logistics-page td, .logistics-dialog th, .logistics-dialog td {
  padding: 2px 7px;
  vertical-align: middle;
  border-bottom: 1px solid #e8edec;
  font-size: 12px;
  line-height: 1.35;
}
.logistics-page thead th, .logistics-dialog thead th {
  background: var(--logistics-head);
  color: var(--logistics-muted);
  font-size: 11px;
  letter-spacing: normal;
  text-transform: none;
}
.register-table > thead th[scope="colgroup"] { padding-block: 4px; background: #eaf1f0; }
.register-table > thead > tr:last-child > th, .pool-table thead th { padding-block: 4px; white-space: nowrap; }
.register-table > tbody > :is(tr[data-goods], .register-package-row) > td { white-space: nowrap; }
.register-table > tbody > tr:last-child > *, .pool-table > tbody > tr:last-child > * { border-bottom: 0; }
.register-table > tbody > tr[data-goods]:hover > *, .pool-table > tbody > tr:not(.pool-detail-row):hover > * { background: #f6f9f8; }
.pinned {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  box-shadow: 1px 0 var(--logistics-line);
}
.logistics-page .cargo-column { min-width: var(--cargo-width); }
.cargo-name { text-transform: none; letter-spacing: normal; }
.logistics-page .mode-column { min-width: 74px; }
.logistics-page .dispatch-column { min-width: 132px; }
.shipment-column { min-width: 99px; }
.allocation-column { min-width: 75px; }
.location-column { min-width: 115px; }
.date-column { min-width: 89px; }
.status-column { min-width: 61px; }
.column-caseId { min-width: 96px; }
.column-customerPo, .column-supplierPo { min-width: 132px; }
.column-line { min-width: 54px; }
.column-factory { min-width: 72px; }
.column-quantity { min-width: 43px; }
.column-unit { min-width: 38px; }
.measure-column { min-width: 53px; }
.number { text-align: right; }
.shipment-cell { white-space: nowrap; }
.batch-links { display: grid; justify-items: start; gap: 1px; }
.logistics-page .plan-select { min-height: 27px; padding: 3px 4px; font-size: 12px; }
.plan-mode { width: 65px; }
.plan-locationId { width: 130px; }
.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--logistics-accent);
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.text-button:hover { text-decoration: underline; }
.cargo-button { max-width: calc(var(--cargo-width) - 14px); }
.cargo-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-caption { display: none; }
.cargo-status {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: #edf1f0;
  color: #4f666e;
  line-height: 1.2;
  white-space: nowrap;
  font-size: 11px;
}
.cargo-status.ready { color: #286247; background: #e8f3ec; }
.cargo-status.in-transit { color: #225971; background: #e3f0f5; }
.review-needed { color: #755419; }
.package-cell { text-align: right; }
.package-button[aria-expanded="true"] { border-color: var(--logistics-accent); background: #eaf2f4; }
.goods-actions { display: flex; gap: 4px; align-items: center; }
.package-shortcut { min-width: 27px; padding-inline: 4px; font-size: 14px; }
.register-package-row > * { background: #f2f7f6; }
.register-package-row:hover > * { background: #eaf3f1; }
.logistics-page .register-package-id { padding-inline-start: 12px; border-inline-start: 2px solid #b6cfce; white-space: nowrap; }
.package-identity strong { font-weight: 600; }
.package-name { display: block; color: var(--logistics-muted); font-size: 11px; }
.packing-link { display: inline-flex; min-height: 26px; align-items: center; font-weight: 600; }

.shipment-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pool-meta { color: var(--logistics-muted); font-size: 11px; white-space: nowrap; }
.pool-table { min-width: 670px; }
.pool-table > :is(thead, tbody) > tr > :is(th, td) { white-space: nowrap; }
.consolidation-scroll { container-type: inline-size; }
.consolidation-table > thead > tr > :first-child, .pool-record > th {
  position: sticky;
  left: 0;
  z-index: 1;
  box-shadow: 1px 0 var(--logistics-line);
}
.pool-record { cursor: pointer; }
.pool-record > th { background: #fff; }
.pool-table > tbody > .pool-record:has(.pool-toggle[aria-expanded="true"]) > * { background: #eaf3f1; }
.pool-toggle { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.logistics-page .pool-detail-row > td { padding: 0; background: #f4f8f7; }
.pool-detail-panel {
  position: sticky;
  left: 0;
  box-sizing: border-box;
  max-width: calc(100vw - 24px);
  max-width: 100cqw;
  padding: 6px 8px 8px;
  border-inline-start: 2px solid #b6cfce;
  white-space: normal;
}
.pool-detail-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 4px; }
.pool-detail-toolbar .shipment-controls { margin: 0 0 0 auto; }
.pool-detail-panel > .table-scroll { background: #fff; border: 1px solid var(--logistics-line); border-radius: 4px; }
.pool-detail-panel > .freight-disclosure { margin-block: 5px 0; }
.pool-cargo-table :is(th, td), .agent-packing-table :is(th, td) { white-space: nowrap; }
.pool-shipping-content { padding-inline: 8px; }
.pool-shipping-content > .detail-section:first-child { border-top: 0; margin-top: 8px; }
.location-directory { margin: 0; padding: 0; border: 0; border-top: 1px solid var(--logistics-line); }
.location-directory > summary { padding: 6px 8px; align-content: center; min-height: 32px; }
.ongoing-table th, .ongoing-table td { white-space: nowrap; }
.ongoing-table tr > :first-child { position: sticky; left: 0; background: #fff; box-shadow: 1px 0 var(--logistics-line); }
.ongoing-table thead tr > :first-child { background: var(--logistics-head); }
.ongoing-table th:nth-child(3) { min-width: 83px; }
.ongoing-table td:first-child a { display: inline-flex; align-items: center; min-height: 26px; }
.quiet-button:disabled { color: #697e84; border-color: #d8e0e2; cursor: default; }
.empty-row { margin: 0; padding: 14px; color: var(--logistics-muted); }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.section-heading h2 { margin: 0; }
.shipment-view { padding: 16px; }
.shipment-heading { flex-wrap: wrap; justify-content: flex-start; margin-bottom: 12px; }
.shipment-heading .cargo-status { margin-left: auto; }
.shipment-controls { flex-wrap: wrap; justify-content: flex-end; margin-bottom: 10px; }
.shipment-controls .primary { padding: 4px 10px; }
.shipment-controls .primary:disabled { opacity: .55; cursor: default; }
.back-link { display: inline-flex; align-items: center; min-height: 34px; font-size: 12px; }
.detail-section { margin-top: 14px; border-top: 1px solid var(--logistics-line); }
.detail-section h3 { margin: 11px 0 8px; color: var(--logistics-ink); }
.shipment-cargo-table { min-width: 620px; }
.packages-table.full { min-width: 675px; }
.packages-table:not(.full) :is(th, td) { padding-inline: 6px; }
.allocation-table { min-width: 320px; }
.logistics-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 13px 10px;
  margin: 10px 0 0;
}
.logistics-facts > div { min-width: 0; }
.logistics-facts dt { margin-bottom: 4px; font-size: 11px; color: var(--logistics-muted); }
.logistics-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--logistics-ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.logistics-dialog {
  width: min(620px, calc(100% - 24px));
  max-height: calc(100% - 28px);
  overflow: auto;
  padding: 14px;
  border: 1px solid #becfce;
  border-radius: 9px;
  background: #fff;
  color: var(--logistics-ink);
}
.logistics-dialog::backdrop { background: #172c37a6; }
.logistics-dialog .section-heading + form { margin-top: 10px; }
.agent-packing-dialog { width: min(810px, calc(100% - 24px)); }
.agent-packing-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 2px 8px;
  min-width: 0;
  margin: 8px 0;
  padding: 4px 8px;
  border: 1px solid var(--logistics-line);
  border-radius: 5px;
}
.agent-packing-fields legend { color: var(--logistics-muted); font-size: 12px; }
.agent-packing-fields label { display: flex; align-items: center; gap: 6px; margin: 0; min-height: 30px; font-size: 12px; }
.agent-packing-fields input { flex: none; width: 16px; height: 16px; margin: 0; }
.cargo-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.allocation-cargo { font-size: 13px; margin: 10px 0 12px; }
.form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.location-fields { grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr) minmax(0, 1fr); }
.form-fields label { margin: 0; font-size: 12px; }
.form-fields .wide-field { grid-column: 1 / -1; }
.form-fields select, .form-fields input { margin-top: 4px; min-height: 42px; }
.allocation-location-field { display: flex; align-items: flex-end; gap: 6px; }
.allocation-location-field label { flex: 1; min-width: 0; }
.allocation-location-field button { min-height: 42px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 13px; }
.form-actions button { min-height: 42px; }
.error { color: #a13b28; font-size: 13px; margin-bottom: 0; }
.shipment-entry-table { margin-top: 12px; }
.shipment-entry-table th:last-child { width: 92px; }
.shipment-entry-table tbody input { min-height: 32px; padding: 4px 7px; }
.packing-picks, #shipment-entry-lines { margin-top: 10px; }
.package-picker :is(th, td) { white-space: nowrap; }
.package-picker td:first-child { padding: 0; }
.package-picker input[type="checkbox"] {
  width: 30px;
  height: 28px;
  margin: 0;
  vertical-align: middle;
  accent-color: var(--logistics-accent);
}
.picker-contents, .picker-contents .packing-contents { margin: 0; padding: 0; }
.packing-actions, .register-actions, .cargo-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.packing-actions { padding: 0 8px 8px; }
.manual-pending { border-top: 1px solid var(--logistics-line); }
.manual-pending h2 { margin: 6px 8px; font-size: 13px; }
#shipment-update-form input { margin-top: 4px; }
.packing-group .packing-package { margin: 0; padding: 0; border-top: 1px solid var(--logistics-line); }
.packing-package-summary {
  min-height: 34px;
  align-content: center;
  padding: 5px 8px;
  background: var(--logistics-head);
}
.packing-package-summary .package-identity { display: inline; margin-inline-end: 8px; }
.packing-package-summary .package-name { display: inline; margin-inline-start: 6px; }
.packing-package > .logistics-facts {
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px 10px;
  padding-inline: 8px;
}
.packing-contents { margin: 8px 0; }

.load-dialog { width: min(710px, calc(100% - 24px)); }
.load-heading { margin-block: 10px 4px; }
.load-heading h3, .container-editor h4 { margin: 0; font-size: 13px; }
.container-editor { padding: 8px; margin-bottom: 6px; border: 1px solid var(--logistics-line); border-radius: 5px; }
.container-editor .form-fields { margin-top: 6px; grid-template-columns: 1fr 1fr .8fr; }
#load-cargo { margin-top: 10px; }
.container-allocation-table { min-width: 490px; }
.container-allocation-table select { min-height: 34px; margin: 0; padding: 4px 6px; }
.container-cargo-table { min-width: 570px; }
.container-cargo-table :is(th, td) { white-space: nowrap; }
.shipping-directory { margin-top: 12px; }
.freight-disclosure { padding: 0 0 6px; margin: 5px 0; border: 1px solid var(--logistics-line); border-radius: 5px; }
.freight-disclosure:not([open]) { padding-bottom: 0; }
.freight-disclosure > summary {
  min-height: 38px;
  padding: 6px 8px;
  align-content: center;
  background: var(--logistics-head);
  font-size: 13px;
}
.freight-disclosure > .container-summary :is(span, small) { margin-inline-start: 10px; }
.freight-disclosure > :is(button, dl) { margin: 6px 8px; }
.freight-disclosure > .table-scroll { margin-block: 4px 0; }
.covered-cargo { border: 0; margin: 0; padding: 0; }
.covered-cargo table { margin: 4px 0; }

@media (max-width: 620px) {
  :root { --cargo-width: 106px; }
  .logistics-header { min-height: 52px; padding: 0 14px; flex-wrap: nowrap; }
  .logistics-header .site-brand img { width: 147px; margin: 0; }
  .logistics-page { padding: 6px 10px 24px; }
  .logistics-page .breadcrumbs { margin: 0 0 6px; }
  .logistics-page .breadcrumbs a { display: inline-flex; align-items: center; min-height: 32px; }
  .logistics-page h1 { margin-bottom: 6px; }
  .logistics-tabs { margin-bottom: 8px; }
  .logistics-tabs a { flex: 1 1 0; justify-content: center; min-width: 0; padding-inline: 5px; text-align: center; font-size: 12px; }
  .register-toolbar { padding: 7px; flex-wrap: wrap; }
  .register-toolbar #search { flex: 1 1 150px; max-width: none; }
  .logistics-page .mode-column { min-width: 65px; }
  .logistics-page .dispatch-column { min-width: 124px; }
  .logistics-page th, .logistics-page td { padding: 2px 5px; }
  .plan-mode { width: 59px; }
  .plan-locationId { width: 114px; }
  .cargo-button { max-width: calc(var(--cargo-width) - 10px); }
  .mobile-caption {
    display: block;
    color: var(--logistics-muted);
    font-size: 11px;
    font-weight: 400;
    overflow-wrap: anywhere;
  }
  .shipment-view { padding: 11px; }
  .container-editor .form-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pool-cargo-table :is(th, td):nth-child(-n + 4) { white-space: normal; overflow-wrap: anywhere; }
  .pool-cargo-table :is(th, td):nth-child(1) { min-width: 88px; max-width: 100px; }
  .pool-cargo-table :is(th, td):nth-child(2) { min-width: 106px; max-width: 115px; }
  .pool-cargo-table :is(th, td):nth-child(3) { min-width: 76px; }
  .pool-cargo-table :is(th, td):nth-child(4) { min-width: 105px; max-width: 120px; }
  .container-cargo-table { table-layout: fixed; min-width: 520px; }
  .container-cargo-table :is(th, td):nth-child(-n + 3) { white-space: normal; overflow-wrap: anywhere; }
  .container-cargo-table th:nth-child(1) { width: 88px; }
  .container-cargo-table th:nth-child(2) { width: 106px; }
  .container-cargo-table th:nth-child(3) { width: 79px; }
  .container-cargo-table th:nth-child(4) { width: 120px; }
  .container-cargo-table th:nth-child(5) { width: 48px; }
  .container-cargo-table th:nth-child(6) { width: 42px; }
  .container-cargo-table td:nth-child(4) { white-space: normal; }
  .logistics-dialog .logistics-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .register-toolbar:has(#goods-filter:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .register-toolbar #goods-filter { max-width: 168px; }
  .register-toolbar #column-settings { justify-self: start; }
  .register-toolbar #add-manually { justify-self: end; }
  .register-toolbar .column-options { left: 0; right: auto; }
  .register-toolbar:has(#goods-filter:not([hidden])) .row-count { display: none; }
}

@media (max-width: 420px) {
  .row-count { display: none; }
}

@media (max-width: 520px) {
  .location-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .location-name-field, .allocation-mode-field, .allocation-location-field { grid-column: 1 / -1; }
}

@media (pointer: coarse) {
  .logistics-tabs a, .logistics-page button, .quiet-button, .package-button, .back-link,
  .column-settings summary, .column-options label, .location-directory summary, .freight-disclosure > summary,
  .packing-link, .packing-package-summary, .agent-packing-fields label,
  .shipment-entry-table tbody input, #shipment-update-form input {
    min-height: 44px;
  }
  .package-shortcut, .ongoing-table td:first-child a { min-width: 44px; min-height: 44px; }
  .package-picker input[type="checkbox"] { width: 44px; height: 44px; }
  .logistics-page .breadcrumbs a, .register-toolbar #search, #goods-filter, .logistics-page .plan-select, .form-fields input,
  .form-fields select, .form-actions button, .container-allocation-table select {
    min-height: 44px;
  }
  .register-toolbar #search, #goods-filter, .logistics-page .plan-select, .form-fields input, .form-fields select, .container-allocation-table select,
  .shipment-entry-table tbody input, #shipment-update-form input { font-size: 16px; }
  .cargo-name .text-button { width: 100%; }
}
