body.pallet-settings-page-body {
  min-height: 100vh;
  min-height: 100svh;
  background: #e8f1f8;
  overflow-x: hidden;
}

.pallet-settings-page {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: clamp(14px, 2.5vh, 24px) 24px 28px;
}

.pallet-settings-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.pallet-settings-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pallet-settings-brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  fill: #e7f1fb;
  stroke: var(--primary-dark);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.pallet-settings-brand-copy {
  min-width: 0;
}

.pallet-settings-brand-copy h1 {
  margin: 0;
  color: var(--primary-dark);
  font-size: clamp(23px, 2.3vw, 27px);
  font-weight: 900;
  letter-spacing: .04em;
  white-space: nowrap;
}

.pallet-settings-brand-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.pallet-settings-session-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.pallet-settings-current-user {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.pallet-settings-current-user strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
}

.pallet-settings-header-actions {
  display: flex;
  gap: 8px;
}

.pallet-settings-header-actions .quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 42px;
  min-height: 42px;
  padding: 8px 13px;
  text-decoration: none;
}

.pallet-settings-header-actions > a.quiet-button {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #eef6fc;
  color: var(--primary-dark);
  font-weight: 800;
  white-space: nowrap;
}

.pallet-settings-list-panel {
  padding: 18px;
}

.pallet-settings-section-heading {
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
}

.pallet-settings-section-heading h2 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 22px;
}

.pallet-settings-section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.pallet-settings-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.pallet-settings-summary-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fbfe;
  padding: 10px 12px;
}

.pallet-settings-summary-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.pallet-settings-summary-item strong {
  min-width: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
  text-align: right;
}

.pallet-settings-summary-item small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pallet-settings-summary-item.is-configured {
  border-color: #a9d3ba;
  background: #f0faf4;
}

.pallet-settings-summary-item.is-configured strong {
  color: var(--success);
}

.pallet-settings-summary-item.is-unconfigured {
  border-color: #e6c879;
  background: #fff8e5;
}

.pallet-settings-summary-item.is-unconfigured span,
.pallet-settings-summary-item.is-unconfigured strong,
.pallet-settings-summary-item.is-unconfigured small {
  color: #8a5a00;
}

.pallet-settings-list-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(170px, 220px) auto;
  align-items: end;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fbfe;
}

.pallet-settings-list-toolbar label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.pallet-settings-list-toolbar label > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pallet-settings-list-toolbar input,
.pallet-settings-list-toolbar select {
  min-height: 46px;
}

.pallet-settings-reload-button {
  min-width: 112px;
  min-height: 46px;
}

.pallet-settings-message[hidden],
.pallet-settings-list-panel > .message[hidden] {
  display: none;
  min-height: 0;
  margin: 0;
}

.pallet-settings-table-wrap {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.pallet-settings-table {
  min-width: 980px;
}

.pallet-settings-table th:nth-child(1) { width: 11%; }
.pallet-settings-table th:nth-child(2) { width: 24%; }
.pallet-settings-table th:nth-child(3),
.pallet-settings-table th:nth-child(4) { width: 22%; }
.pallet-settings-table th:nth-child(5) { width: 10%; }
.pallet-settings-table th:nth-child(6) { width: 11%; }

.pallet-settings-table th:nth-child(5),
.pallet-settings-table td:nth-child(5),
.pallet-settings-table th:nth-child(6),
.pallet-settings-table td:nth-child(6) {
  text-align: center;
}

.pallet-settings-table td:nth-child(6) .quiet-button {
  min-width: 76px;
  min-height: 40px;
}

.pallet-settings-table tr.is-unconfigured td {
  border-bottom-color: #e6c879;
  background: #fff8e5;
}

.pallet-settings-table tr.is-unconfigured td:first-child {
  box-shadow: inset 4px 0 0 #dba62f;
}

.pallet-settings-csv-panel {
  padding: 18px;
}

.pallet-settings-csv-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pallet-settings-csv-heading h2 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 20px;
}

.pallet-settings-csv-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.pallet-settings-csv-toggle {
  min-width: 196px;
  min-height: 44px;
}

.pallet-settings-csv-content {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.pallet-settings-csv-content[hidden],
.pallet-settings-csv-content > .message[hidden] {
  display: none;
  min-height: 0;
  margin: 0;
}

.pallet-settings-csv-guides {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.pallet-settings-csv-guides > span {
  color: var(--primary-dark);
  font-weight: 900;
}

.pallet-settings-csv-file-area {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fbfe;
}

.pallet-settings-csv-file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--primary-dark);
  min-height: 44px;
  padding: 8px 13px;
  font-weight: 800;
  white-space: nowrap;
}

.pallet-settings-csv-file-button:hover {
  border-color: var(--primary-dark);
  background: #eef6fc;
}

.pallet-settings-csv-file-button:focus-within {
  outline: 3px solid #8ec6f3;
  outline-offset: 2px;
}

.pallet-settings-csv-file-name {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pallet-settings-csv-file-area > .quiet-button {
  min-height: 44px;
  padding: 8px 13px;
  white-space: nowrap;
}

.pallet-settings-csv-results {
  display: grid;
  gap: 12px;
}

.pallet-settings-csv-results[hidden] {
  display: none;
}

.pallet-settings-csv-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(112px, 1fr));
  gap: 8px;
  margin: 0;
}

.pallet-settings-csv-summary > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fbfe;
  padding: 9px 10px;
}

.pallet-settings-csv-summary dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pallet-settings-csv-summary dd {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 21px;
  font-weight: 900;
}

.pallet-settings-csv-summary > .is-info {
  border-color: #a7c7df;
  background: #edf6fd;
}

.pallet-settings-csv-summary > .is-info dd {
  color: var(--primary-dark);
}

.pallet-settings-csv-summary > .is-error {
  border-color: #e2b4aa;
  background: #fff4f2;
}

.pallet-settings-csv-summary > .is-error dt,
.pallet-settings-csv-summary > .is-error dd {
  color: var(--danger);
}

.pallet-settings-csv-summary > .is-warning {
  border-color: #e6c879;
  background: #fff8e5;
}

.pallet-settings-csv-summary > .is-warning dt,
.pallet-settings-csv-summary > .is-warning dd {
  color: #8a5a00;
}

.pallet-settings-csv-result-actions {
  display: flex;
  justify-content: flex-end;
}

.pallet-settings-csv-result-actions .save-button {
  min-width: 132px;
  width: calc((100% - 40px) / 6);
}

.pallet-settings-csv-preview-shell {
  margin-top: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.pallet-settings-csv-preview-title {
  display: block;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: #f7fbfe;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pallet-settings-csv-preview-top-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.pallet-settings-csv-preview-scroll-content {
  width: 2310px;
  height: 1px;
}

.pallet-settings-csv-preview-wrap {
  margin-top: 0;
  border: 0;
  border-radius: 0;
}

.pallet-settings-csv-preview-wrap table {
  width: 2310px;
  min-width: 2310px;
  table-layout: fixed;
}

.pallet-settings-csv-preview-wrap th,
.pallet-settings-csv-preview-wrap td {
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.pallet-settings-csv-preview-wrap col:nth-child(1) { width: 70px; }
.pallet-settings-csv-preview-wrap col:nth-child(2) { width: 110px; }
.pallet-settings-csv-preview-wrap col:nth-child(3),
.pallet-settings-csv-preview-wrap col:nth-child(4) { width: 260px; }
.pallet-settings-csv-preview-wrap col:nth-child(5),
.pallet-settings-csv-preview-wrap col:nth-child(8) { width: 120px; }
.pallet-settings-csv-preview-wrap col:nth-child(6),
.pallet-settings-csv-preview-wrap col:nth-child(9) { width: 90px; }
.pallet-settings-csv-preview-wrap col:nth-child(7),
.pallet-settings-csv-preview-wrap col:nth-child(10) { width: 190px; }
.pallet-settings-csv-preview-wrap col:nth-child(11) { width: 110px; }
.pallet-settings-csv-preview-wrap col:nth-child(12) { width: 700px; }

.pallet-settings-csv-preview-wrap thead th,
.pallet-settings-csv-preview-wrap tbody td:not(:last-child) {
  text-align: center;
}

.pallet-settings-csv-preview-wrap thead tr:first-child th {
  background: #d9eaf7;
}

.pallet-settings-csv-preview-wrap thead tr:first-child th:last-child,
.pallet-settings-csv-preview-wrap tbody td:last-child {
  text-align: left;
}

.pallet-settings-csv-preview-wrap thead tr:first-child th[colspan] {
  border-bottom: 1px solid #c3d5e2;
}

.pallet-settings-csv-preview-wrap thead tr:first-child th:nth-child(5),
.pallet-settings-csv-preview-wrap thead tr:first-child th:nth-child(6) {
  border-left: 2px solid #c3d5e2;
  border-right: 2px solid #c3d5e2;
}

.pallet-settings-csv-preview-wrap thead tr:nth-child(2) th:nth-child(1),
.pallet-settings-csv-preview-wrap thead tr:nth-child(2) th:nth-child(4),
.pallet-settings-csv-preview-wrap tbody td:nth-child(5),
.pallet-settings-csv-preview-wrap tbody td:nth-child(8) {
  border-left: 2px solid #c3d5e2;
}

.pallet-settings-csv-preview-wrap thead tr:nth-child(2) th:nth-child(3),
.pallet-settings-csv-preview-wrap thead tr:nth-child(2) th:nth-child(6),
.pallet-settings-csv-preview-wrap tbody td:nth-child(7),
.pallet-settings-csv-preview-wrap tbody td:nth-child(10) {
  border-right: 2px solid #c3d5e2;
}

.pallet-settings-csv-validation-cell {
  line-height: 1.45;
}

.pallet-settings-csv-validation-line + .pallet-settings-csv-validation-line {
  margin-top: 5px;
}

.pallet-settings-csv-validation-line.is-error {
  color: var(--danger);
}

.pallet-settings-csv-validation-line.is-warning {
  color: var(--warning);
}

.pallet-settings-csv-confirm-dialog {
  width: min(620px, calc(100% - 32px));
}

.pallet-settings-csv-confirm-dialog > h2 {
  margin: 0;
  color: var(--primary-dark);
}

.pallet-settings-csv-confirm-dialog > p {
  margin: 8px 0 16px;
  color: var(--muted);
  font-weight: 700;
}

.pallet-settings-csv-confirm-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.pallet-settings-csv-confirm-summary > div {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fbfe;
}

.pallet-settings-csv-confirm-summary dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pallet-settings-csv-confirm-summary dd {
  margin: 3px 0 0;
  color: var(--primary-dark);
  font-size: 19px;
  font-weight: 900;
}

.pallet-settings-edit-dialog {
  width: min(760px, calc(100% - 32px));
}

.pallet-settings-edit-dialog-form {
  display: grid;
  gap: 14px;
}

.pallet-settings-edit-dialog-header {
  display: grid;
  gap: 8px;
}

.pallet-settings-edit-dialog-header h2 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 24px;
}

.pallet-settings-edit-product {
  margin: 0;
  padding: 11px 13px;
  border: 1px solid #bfd3e3;
  border-radius: 6px;
  background: #f4f8fc;
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.4;
}

.pallet-settings-edit-guide {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.pallet-settings-edit-grid {
  gap: 14px;
}

.pallet-settings-edit-group {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #d5e2ec;
  border-radius: 6px;
  background: #f8fbfd;
}

.pallet-settings-edit-group h3 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 17px;
}

.pallet-settings-edit-group label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pallet-settings-edit-group input {
  box-sizing: border-box;
  width: 100%;
  min-height: 52px;
  color: var(--primary-dark);
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.pallet-settings-edit-total {
  display: block;
  margin-top: 3px;
  padding: 9px 10px;
  border: 1px solid #bfd3e3;
  border-radius: 6px;
  background: #ffffff;
  color: var(--primary-dark);
  font-size: 18px;
  line-height: 1.35;
}

.pallet-settings-edit-message:empty {
  display: none;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.pallet-settings-edit-actions {
  align-items: center;
  margin-top: 2px;
}

.pallet-settings-edit-actions .quiet-button,
.pallet-settings-edit-actions .save-button {
  min-width: 140px;
  min-height: 52px;
}

.pallet-settings-edit-actions .save-button {
  min-width: 180px;
}

@media (min-width: 900px) and (max-width: 1366px) {
  .pallet-settings-list-toolbar select {
    height: 46px;
    min-height: 46px;
  }
}

@media (max-width: 900px) {
  .pallet-settings-page {
    padding: 12px 16px 20px;
  }

  .pallet-settings-header {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .pallet-settings-session-actions {
    justify-content: space-between;
  }

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

  .pallet-settings-csv-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pallet-settings-csv-result-actions .save-button {
    width: calc((100% - 16px) / 3);
  }
}

@media (max-width: 600px) {
  .pallet-settings-page {
    padding: 10px 12px 16px;
  }

  .pallet-settings-brand-copy h1 {
    font-size: 22px;
  }

  .pallet-settings-brand-copy p {
    font-size: 13px;
  }

  .pallet-settings-session-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .pallet-settings-current-user {
    white-space: normal;
  }

  .pallet-settings-header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pallet-settings-header-actions .quiet-button {
    width: 100%;
  }

  .pallet-settings-summary {
    gap: 8px;
  }

  .pallet-settings-csv-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .pallet-settings-csv-toggle {
    width: 100%;
  }

  .pallet-settings-csv-file-area {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .pallet-settings-csv-file-button,
  .pallet-settings-csv-file-area > .quiet-button {
    width: 100%;
  }

  .pallet-settings-csv-summary,
  .pallet-settings-csv-confirm-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pallet-settings-csv-result-actions .save-button {
    width: 100%;
  }

  .pallet-settings-summary-item {
    grid-template-columns: 1fr auto;
    gap: 0 4px;
    padding: 9px 10px;
  }

  .pallet-settings-summary-item span {
    grid-column: 1 / -1;
  }

  .pallet-settings-list-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .pallet-settings-edit-grid {
    grid-template-columns: 1fr;
  }

  .pallet-settings-edit-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pallet-settings-edit-actions .quiet-button,
  .pallet-settings-edit-actions .save-button {
    width: 100%;
  }

  .pallet-settings-reload-button {
    width: 100%;
  }
}
