/* Palety readability v47: scoped layout, typography and responsive safety. */
/* Zakres sprawy jest niezależny od rodzaju brakujących danych. */
#view-pallets .pallet-review-groups { display: none; }
#view-pallets .queue-mode .pallet-review-groups { display: grid; gap: 8px; padding: 16px; border-bottom: 1px solid var(--line); }
#view-pallets .pallet-review-group-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
#view-pallets .pallet-review-group-buttons button { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; min-height: 54px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-align: left; white-space: normal; line-height: 1.4; letter-spacing: 0; }
#view-pallets .pallet-review-group-buttons button span { min-width: 0; overflow-wrap: anywhere; }
#view-pallets .pallet-review-group-buttons button strong { flex: 0 0 auto; font-size: 20px; font-variant-numeric: tabular-nums; }
#view-pallets .pallet-review-group-buttons button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); box-shadow: inset 0 -3px 0 var(--accent); color: var(--text); }
#view-pallets .pallet-review-group-buttons button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#view-pallets .pallet-review-row-id { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
#view-pallets .pallet-review-row-age-label { display: block; color: var(--muted); font-size: 10px; line-height: 1.5; }
#view-pallets .pallet-review-groups p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--text); }
#view-pallets .pallet-review-groups > small { color: var(--muted); font-size: 12px; line-height: 1.5; }
#view-pallets .pallet-review-row-state { display: block; margin-top: 6px; padding-left: 7px; border-left: 3px solid var(--accent); color: var(--text); font-size: 12px; font-weight: 700; line-height: 1.5; }
#view-pallets .pallet-review-row-state.warehouse { border-color: #d69a30; }
#view-pallets .pallet-review-row-state.closed { border-color: var(--muted); }
#view-pallets #palletWarehouseExportBtn { color: var(--text); }
#view-pallets .pallet-case-close-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; color: var(--text); font-size: 13px; }
#view-pallets .pallet-case-close-action > div { display: grid; gap: 4px; min-width: 0; }
#view-pallets .pallet-case-close-action small { color: var(--muted); line-height: 1.5; }
#view-pallets .pallet-case-close-action button { white-space: normal; color: var(--text); border: 1px solid var(--line); background: var(--panel); border-radius: 8px; min-height: 44px; }
#view-pallets .pallet-case-state { padding: 12px 14px; margin: 12px 0; border-left: 3px solid var(--muted); background: var(--panel-soft, var(--panel)); line-height: 1.5; }
#view-pallets .pallet-case-state h3 { margin: 0; font-size: 16px; }
#view-pallets .pallet-case-state p { margin: 8px 0; }
#view-pallets .pallet-case-state dl { display: grid; gap: 8px; }
#view-pallets .pallet-case-state dt { color: var(--muted); font-size: 12px; }
#view-pallets .pallet-case-state dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
#view-pallets .pallet-badge.closed_unresolved { background: color-mix(in srgb, var(--muted) 15%, var(--panel)); color: var(--text); white-space: normal; }
#view-pallets .pallet-bars .closed_unresolved { background: var(--muted); }
#view-pallets .pallet-chart-legend .closed_unresolved { background: var(--muted); }
#palletCaseDialog { color: var(--text); max-width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; box-sizing: border-box; }
#palletCaseDialog form { display: grid; gap: 12px; min-width: 0; }
#palletCaseDialog :is(select, textarea, button) { min-width: 0; max-width: 100%; box-sizing: border-box; }
#palletCaseDialog :is(p, h3, label, button) { overflow-wrap: anywhere; white-space: normal; }
#view-pallets .pallet-review-row-issue { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.5; overflow-wrap: anywhere; }
#view-pallets .queue-mode #palletStatusFilter { display: none; }
#view-pallets .queue-mode .pallet-filter-more label:has(#palletProblemFilter) { display: none; }
@media (max-width: 720px) {
  #view-pallets .pallet-review-group-buttons { grid-template-columns: minmax(0, 1fr); }
  #view-pallets .queue-mode .pallet-review-groups { padding: 12px; }
  #view-pallets .pallet-case-close-action { align-items: stretch; flex-direction: column; }
  #palletCaseDialog :is(select, textarea) { font-size: 16px; }
}

#view-pallets {
  --pallet-gap: clamp(10px, 1vw, 16px);
}

/* Rejestr komunikatów bota */
#view-pallets .pallet-bot-messages { display:grid; gap:16px; }
#view-pallets .pallet-alert-hero { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:22px 24px; background:linear-gradient(135deg,var(--panel),color-mix(in srgb,var(--accent) 10%,var(--panel))); }
#view-pallets .pallet-alert-hero h2 { margin:3px 0 5px; }
#view-pallets .pallet-alert-hero p { margin:0; color:var(--muted); }
#view-pallets .pallet-alert-kpis { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; }
#view-pallets .pallet-alert-kpis article { position:relative; overflow:hidden; min-height:112px; padding:17px; border:1px solid var(--line); border-radius:16px; background:var(--panel); display:grid; gap:5px; }
#view-pallets .pallet-alert-kpis article::before { content:""; position:absolute; inset:0 auto 0 0; width:4px; background:var(--accent); }
#view-pallets .pallet-alert-kpis article.warning::before { background:#f5ad42; } #view-pallets .pallet-alert-kpis article.success::before { background:#37c997; } #view-pallets .pallet-alert-kpis article.danger::before { background:#ed6b70; }
#view-pallets .pallet-alert-kpis span,#view-pallets .pallet-alert-kpis small { color:var(--muted); } #view-pallets .pallet-alert-kpis strong { font-size:25px; }
#view-pallets .pallet-alert-panel { padding:0; overflow:hidden; }
#view-pallets .pallet-alert-filters { display:grid; grid-template-columns:repeat(5,minmax(130px,1fr)) auto; gap:10px; align-items:end; padding:16px; border-bottom:1px solid var(--line); }
#view-pallets .pallet-alert-filters label { display:grid; gap:5px; font-size:12px; color:var(--muted); }
#view-pallets .pallet-alert-layout { display:grid; grid-template-columns:minmax(0,1fr); min-height:560px; overflow:hidden; position:relative; }
#view-pallets .pallet-alert-layout > div { min-width:0; }
#view-pallets .pallet-alert-table tr[data-bot-alert-id] { cursor:pointer; } #view-pallets .pallet-alert-table tr[data-bot-alert-id]:hover { background:color-mix(in srgb,var(--accent) 7%,transparent); }
#view-pallets .pallet-alert-reasons { display:flex; flex-wrap:wrap; gap:6px; }
#view-pallets .pallet-alert-reason { display:inline-flex; padding:4px 8px; border-radius:999px; background:color-mix(in srgb,#f5ad42 16%,transparent); color:#d78e24; font-size:11px; font-weight:700; }
#view-pallets .pallet-alert-status { display:inline-flex; padding:5px 9px; border-radius:999px; font-size:11px; font-weight:800; white-space:nowrap; background:color-mix(in srgb,#54a6ff 16%,transparent); color:#54a6ff; }
#view-pallets .pallet-alert-status.resolved { background:color-mix(in srgb,#37c997 16%,transparent); color:#28a97d; } #view-pallets .pallet-alert-status.sent,#view-pallets .pallet-alert-status.pending { background:color-mix(in srgb,#f5ad42 16%,transparent); color:#d78e24; } #view-pallets .pallet-alert-status.error { background:color-mix(in srgb,#ed6b70 16%,transparent); color:#ed6b70; }
#view-pallets .pallet-alert-detail { background:color-mix(in srgb,var(--panel) 96%,var(--accent)); border-left:1px solid var(--line); box-shadow:-18px 0 45px rgba(0,0,0,.28); display:none; gap:14px; inset:0 0 0 auto; max-height:none; overflow:auto; padding:14px 20px 24px; position:absolute; width:min(480px,92%); z-index:12; align-content:start; }
#view-pallets .pallet-alert-layout.detail-open .pallet-alert-detail { display:grid; }
#view-pallets .pallet-alert-detail-close { align-items:center; background:var(--surface); border:1px solid var(--line); border-radius:10px; color:var(--text); display:flex; font-size:12px; font-weight:800; gap:8px; justify-content:center; justify-self:end; min-height:38px; padding:7px 11px; position:sticky; top:0; width:auto; z-index:4; }
#view-pallets .pallet-alert-detail-close kbd { background:color-mix(in srgb,var(--text) 8%,var(--surface)); border:1px solid var(--line); border-radius:5px; color:var(--muted); font-size:10px; padding:2px 5px; }
#view-pallets .pallet-alert-detail section { padding:15px; border:1px solid var(--line); border-radius:14px; background:var(--panel); } #view-pallets .pallet-alert-detail h3 { margin:0 0 9px; font-size:13px; }
#view-pallets .pallet-alert-detail-head { display:flex; justify-content:space-between; gap:12px; align-items:center; } #view-pallets .pallet-alert-detail-head span { color:var(--muted); font-size:12px; } #view-pallets .pallet-alert-detail-head h2 { margin:4px 0 0; font-size:20px; }
#view-pallets .pallet-alert-photo-wrap { background:#071018; border:1px solid var(--line); border-radius:14px; display:grid; gap:0; grid-template-rows:clamp(220px,36vh,360px) auto; min-height:calc(clamp(220px,36vh,360px) + 36px); overflow:hidden; }
#view-pallets .pallet-alert-photo-wrap .pallet-alert-photo { background:#071018; border:0; border-radius:0; display:block; height:clamp(220px,36vh,360px); object-fit:contain; width:100%; }
#view-pallets .pallet-alert-photo-wrap small { background:rgba(7,16,24,.92); color:#d7e2e8; padding:8px 10px; text-align:center; }
#view-pallets .pallet-alert-photo-missing { background:color-mix(in srgb,#ed6b70 10%,var(--panel)); border:1px solid color-mix(in srgb,#ed6b70 45%,var(--line)); border-radius:14px; color:#ed6b70; font-weight:700; padding:14px; }
#view-pallets .pallet-alert-bubble { white-space:pre-wrap; padding:13px; margin-bottom:7px; border-radius:13px 13px 13px 4px; background:color-mix(in srgb,var(--accent) 13%,var(--panel)); line-height:1.5; }
#view-pallets .pallet-alert-quick-sto { background:color-mix(in srgb,var(--accent) 10%,var(--panel)); border:1px solid color-mix(in srgb,var(--accent) 55%,var(--line)); border-radius:14px; display:grid; gap:12px; padding:16px; }
#view-pallets .pallet-alert-quick-sto h3 { font-size:18px; margin:3px 0 4px; }
#view-pallets .pallet-alert-quick-sto p { color:var(--muted); margin:0; }
#view-pallets .pallet-alert-quick-sto label { display:grid; gap:6px; font-weight:700; }
#view-pallets .pallet-alert-quick-sto input { font-size:17px; font-weight:750; letter-spacing:.02em; text-transform:uppercase; }
#view-pallets .pallet-alert-quick-sto > small { color:var(--muted); }
#view-pallets .pallet-alert-data { display:grid; grid-template-columns:1fr 1fr; gap:12px; } #view-pallets .pallet-alert-data div { display:grid; gap:3px; } #view-pallets .pallet-alert-data span { color:var(--muted); font-size:11px; text-transform:uppercase; }
#view-pallets .pallet-alert-history { display:grid; gap:8px; } #view-pallets .pallet-alert-history div { display:grid; grid-template-columns:1fr auto; gap:3px 8px; padding-bottom:8px; border-bottom:1px solid var(--line); } #view-pallets .pallet-alert-history small { grid-column:1/-1; color:var(--muted); }
#view-pallets .pallet-alert-error { border-color:color-mix(in srgb,#ed6b70 50%,var(--line))!important; }
@media (max-width:1200px) { #view-pallets .pallet-alert-kpis { grid-template-columns:repeat(3,1fr); } #view-pallets .pallet-alert-filters { grid-template-columns:repeat(3,1fr); } }
@media (max-width:720px) { #view-pallets .pallet-alert-kpis { grid-template-columns:1fr 1fr; } #view-pallets .pallet-alert-filters { grid-template-columns:1fr 1fr; } #view-pallets .pallet-alert-filters .actions { grid-column:1/-1; } #view-pallets .pallet-alert-table thead { display:none; } #view-pallets .pallet-alert-table tr { display:grid; padding:12px; border-bottom:1px solid var(--line); } #view-pallets .pallet-alert-table td { display:grid; grid-template-columns:105px 1fr; border:0!important; padding:5px!important; } #view-pallets .pallet-alert-table td::before { content:attr(data-label); color:var(--muted); font-size:11px; font-weight:700; } }
@media (max-width:480px) { #view-pallets .pallet-alert-kpis,#view-pallets .pallet-alert-filters { grid-template-columns:1fr; } #view-pallets .pallet-alert-filters .actions { grid-column:auto; } #view-pallets .pallet-alert-detail { padding:12px; } }

#view-pallets > .topbar {
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
}

#view-pallets > .topbar h1 {
  font-size: clamp(25px, 2vw, 32px);
  line-height: 1.1;
}

#view-pallets > .topbar p {
  line-height: 1.4;
}

#view-pallets .pallet-section-tabs {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  overflow-x: visible;
  padding: 6px;
  scrollbar-width: thin;
}

#view-pallets .pallet-section-tabs button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 9px 14px;
  white-space: nowrap;
}

#view-pallets .pallet-stats-dashboard {
  gap: var(--pallet-gap);
  padding: clamp(13px, 1.4vw, 20px);
}

#view-pallets :is(.pallet-period-cards, .pallet-quality-cards, .pallet-business-cards, .pallet-weight-cards) {
  align-items: stretch;
}

#view-pallets :is(.pallet-period-cards, .pallet-quality-cards, .pallet-business-cards, .pallet-weight-cards) > * {
  box-sizing: border-box;
  height: auto;
  min-width: 0;
  overflow: hidden;
}

#view-pallets .pallet-stat-card {
  align-content: start;
  display: grid;
  gap: 6px;
  grid-template-rows: auto minmax(36px, auto) auto;
  min-height: 124px;
  padding: 15px 16px;
}

#view-pallets .pallet-stat-card > * {
  margin: 0;
  min-width: 0;
  position: static;
}

#view-pallets .pallet-stat-card strong {
  align-self: center;
  display: block;
  font-size: clamp(28px, 2vw, 36px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

#view-pallets .pallet-stat-card small {
  align-self: end;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

#view-pallets .pallet-quality-card {
  gap: 12px;
  min-height: 60px;
}

#view-pallets :is(.pallet-quality-card, .pallet-business-cards article, .pallet-weight-card) :is(span, strong, small) {
  line-height: 1.28;
  min-width: 0;
  overflow-wrap: anywhere;
}

#view-pallets :is(.pallet-stats-head, .pallet-trend-head, .pallet-alert-head, .pallet-weight-summary-head, .panel-head) {
  flex-wrap: wrap;
  min-width: 0;
}

#view-pallets :is(.pallet-stats-head, .pallet-trend-head, .pallet-alert-head, .pallet-weight-summary-head, .panel-head) > * {
  min-width: 0;
}

#view-pallets .pallet-alert-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}

#view-pallets .pallet-alert-card {
  min-height: 70px;
}

#view-pallets .pallet-alert-card > div {
  overflow: hidden;
}

#view-pallets .pallet-alert-card :is(strong, small) {
  display: block;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#view-pallets .pallet-weight-card {
  min-height: 92px;
}

#view-pallets .pallet-weight-analytics > *,
#view-pallets .pallet-trend-chart > * {
  min-width: 0;
}

#view-pallets .table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

#view-pallets :is(.pallet-register-table, .pallet-verification-table, .pallet-employee-table, .pallet-session-table) {
  table-layout: auto;
}

#view-pallets :is(.pallet-register-table, .pallet-verification-table, .pallet-employee-table, .pallet-session-table) th {
  line-height: 1.25;
  white-space: nowrap;
}

#view-pallets :is(.pallet-register-table, .pallet-verification-table, .pallet-employee-table, .pallet-session-table) td {
  line-height: 1.35;
  min-width: 84px;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

#view-pallets .pallet-register-table { min-width: 1200px; }
#view-pallets .pallet-verification-table { min-width: 900px; }
#view-pallets .pallet-employee-table { min-width: 1180px; }
#view-pallets .pallet-session-table { min-width: 1080px; }

#view-pallets .pallet-layout {
  grid-template-columns: minmax(0, 1.58fr) minmax(360px, .82fr);
}

#view-pallets .pallet-detail,
#view-pallets .pallet-review-editor,
#view-pallets .pallet-review-visual {
  min-width: 0;
}

#view-pallets :is(.pallet-key-facts, .pallet-detail-grid, .pallet-telegram-details) strong {
  line-height: 1.3;
  overflow-wrap: anywhere;
}

#view-pallets .pallet-employee-kpis > * {
  box-sizing: border-box;
  min-width: 0;
}

#view-pallets .pallet-employee-kpis :is(span, strong, small),
#view-pallets .pallet-shift-card :is(dt, dd, strong, small) {
  overflow-wrap: anywhere;
}

#view-pallets .pallet-report-center form,
#view-pallets .pallet-data-export,
#view-pallets .pallet-data-export .actions {
  min-width: 0;
}

#view-pallets .pallet-report-center form > *,
#view-pallets .pallet-data-export .actions > * {
  min-width: 0;
}

body.dark #view-pallets :is(.pallet-alert-center, .pallet-weight-summary, .pallet-detail, .pallet-report-center) {
  box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
}

/* Queue workbench v50: compact record picker + guaranteed editing space. */
#view-pallets .pallet-workspace.queue-mode .pallet-layout {
  grid-template-columns: clamp(310px, 23vw, 380px) minmax(0, 1fr);
  min-width: 0;
  width: 100%;
}

#view-pallets .pallet-workspace.queue-mode .pallet-layout > *,
#view-pallets .pallet-workspace.queue-mode .pallet-review-workbench > * {
  min-width: 0;
}

#view-pallets .pallet-workspace.queue-mode .pallet-layout > .table-wrap {
  overflow-x: hidden;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table {
  min-width: 0;
  table-layout: auto;
  width: 100%;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table thead {
  display: none;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody {
  display: grid;
  gap: 7px;
  padding: 8px;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody tr {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  display: grid;
  gap: 4px 8px;
  grid-template-areas:
    "sto age image"
    "method tare image"
    "date difference image";
  grid-template-columns: minmax(0, 1fr) auto 58px;
  padding: 10px;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody tr.selected {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent), 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td {
  border: 0;
  display: none;
  min-width: 0;
  padding: 0;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="sto"],
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="method"],
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="tare"],
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="age"],
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="difference"],
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="date"],
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="image"] {
  display: block;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="sto"] {
  grid-area: sto;
  overflow-wrap: anywhere;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="sto"] strong {
  font-size: 13px;
  line-height: 1.25;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="method"] {
  color: var(--muted);
  font-size: 11px;
  grid-area: method;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="tare"] {
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  grid-area: tare;
  text-align: right;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="tare"]::before {
  color: var(--muted);
  content: "Tara ";
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="age"] {
  align-self: start;
  grid-area: age;
  text-align: right;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="difference"] {
  align-self: center;
  grid-area: difference;
  text-align: right;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="date"] {
  color: var(--muted);
  font-size: 10px;
  grid-area: date;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="image"] {
  align-self: center;
  grid-area: image;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table .pallet-list-thumbnail {
  height: 58px;
  width: 58px;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody tr {
  grid-template-areas: "sto sto image" "age date image";
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 58px;
  align-items: start;
  gap: 10px 8px;
  border-radius: 8px;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td {
  height: auto;
  max-height: none;
  width: auto;
  position: static;
  background: transparent;
  box-shadow: none;
  white-space: normal;
  overflow: visible;
}

#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td::before { display: none; }
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody tr:has(> td[colspan]) { display: block; cursor: default; }
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[colspan] { display: block; line-height: 1.6; padding: 8px; color: var(--muted); }
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td:is([data-pallet-column="method"], [data-pallet-column="tare"], [data-pallet-column="difference"]) { display: none; }
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="sto"] > strong { display: block; }
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="age"] { text-align: left; }
#view-pallets .pallet-workspace.queue-mode .pallet-register-table tbody td[data-pallet-column="date"] { text-align: right; }

@media (max-width: 760px) {
  #view-pallets .pallet-workspace.queue-mode:not(.detail-open) .pallet-layout { grid-template-columns: minmax(0, 1fr); }
}

#view-pallets .pallet-workspace.queue-mode .pallet-detail {
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
}

#view-pallets .pallet-workspace.queue-mode .pallet-review-workbench {
  grid-template-columns: minmax(0, .95fr) minmax(300px, 1.05fr);
  max-width: 100%;
}

#view-pallets .pallet-workspace.queue-mode .pallet-queue-nav {
  flex-wrap: wrap;
}

#view-pallets .pallet-key-facts article > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 900px) {
  #view-pallets .pallet-register-table tbody td[data-pallet-column="image"] {
    grid-column: 1 / -1;
    order: -1;
  }

  #view-pallets .pallet-register-table tbody td[data-pallet-column="image"]::before {
    display: none;
  }
}

@media (max-width: 1220px) {
  #view-pallets .pallet-workspace.queue-mode.detail-open .pallet-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #view-pallets .pallet-workspace.queue-mode.detail-open .pallet-layout > .table-wrap {
    display: none;
  }

  #view-pallets .pallet-workspace.queue-mode.detail-open .pallet-detail {
    border-left: 0;
    border-top: 0;
  }

  #view-pallets .pallet-workspace.queue-mode.detail-open .pallet-mobile-back {
    align-items: center;
    display: inline-flex;
    margin-bottom: 12px;
    min-height: 42px;
  }
}

@media (max-width: 1180px) {
  #view-pallets .pallet-period-cards,
  #view-pallets .pallet-quality-cards,
  #view-pallets .pallet-business-cards,
  #view-pallets .pallet-weight-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #view-pallets .pallet-weight-analytics,
  #view-pallets .pallet-layout {
    grid-template-columns: 1fr;
  }

  #view-pallets .pallet-detail {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  #view-pallets > .topbar {
    align-items: stretch;
    padding: 16px;
  }

  #view-pallets .pallet-section-tabs {
    flex-wrap: nowrap;
    margin-inline: -2px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  #view-pallets .pallet-section-tabs button {
    min-height: 44px;
    scroll-snap-align: start;
  }

  #view-pallets .pallet-stats-dashboard {
    padding: 11px;
  }

  #view-pallets .pallet-stat-card {
    min-height: 112px;
    padding: 13px;
  }

  #view-pallets .pallet-alert-card {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  #view-pallets :is(.pallet-register-table, .pallet-verification-table, .pallet-employee-table, .pallet-session-table) {
    min-width: 0;
  }

  #view-pallets .pallet-report-center form,
  #view-pallets .pallet-data-export .actions,
  #view-pallets .pallet-employee-hero form {
    grid-template-columns: 1fr;
  }

  #view-pallets .pallet-report-center form > *,
  #view-pallets .pallet-data-export .actions > *,
  #view-pallets .pallet-employee-hero form > * {
    grid-column: auto;
    width: 100%;
  }
}

@media (max-width: 480px) {
  #view-pallets .pallet-period-cards,
  #view-pallets .pallet-quality-cards,
  #view-pallets .pallet-business-cards,
  #view-pallets .pallet-weight-cards,
  #view-pallets .pallet-employee-kpis,
  #view-pallets .pallet-key-facts,
  #view-pallets .pallet-detail-grid {
    grid-template-columns: 1fr;
  }

  #view-pallets .pallet-alert-card {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  #view-pallets .pallet-alert-card > b {
    grid-column: 2;
    justify-self: start;
  }

  #view-pallets .pallet-stat-card strong {
    font-size: 30px;
  }
}

/* Kontrola ręczna różnic wagowych */
#view-pallets .pallet-manual-checks { padding: 16px; }
#view-pallets .pallet-manual-checks-hero { align-items: center; display: flex; justify-content: space-between; margin-bottom: 14px; padding: 20px; }
#view-pallets .pallet-manual-checks-hero h2 { margin: 3px 0 5px; }
#view-pallets .pallet-manual-check-kpis { display: grid; gap: 12px; grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 14px; }
#view-pallets .pallet-manual-check-kpis article { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: grid; gap: 4px; padding: 16px; }
#view-pallets .pallet-manual-check-kpis strong { color: var(--accent); font-size: 28px; }
#view-pallets .pallet-manual-check-kpis small,
#view-pallets .pallet-manual-check-table td small { color: var(--muted); display: block; }
#view-pallets .pallet-manual-check-panel { padding: 16px; }
#view-pallets .pallet-manual-check-tools { display: grid; gap: 14px; grid-template-columns: minmax(260px,.7fr) minmax(360px,1.3fr); margin-bottom: 16px; }
#view-pallets .pallet-manual-check-tools form { align-content: start; display: grid; gap: 10px; }
#view-pallets .pallet-manual-check-tools label { display: grid; gap: 5px; }
#view-pallets .pallet-manual-check-bulk { background: color-mix(in srgb,var(--accent) 7%,var(--surface)); border: 1px solid color-mix(in srgb,var(--accent) 38%,var(--line)); border-radius: 14px; padding: 14px; }
#view-pallets .pallet-manual-check-bulk textarea { min-height: 96px; resize: vertical; }
#view-pallets #palletManualChecksResult { display: grid; gap: 3px; }
#view-pallets .pallet-manual-check-table { min-width: 1420px; }
#view-pallets .pallet-manual-check-table td { vertical-align: middle; }
#view-pallets .pallet-manual-state { display:grid; gap:6px; min-width:150px; }
#view-pallets .pallet-alert-status.unverified { background:color-mix(in srgb,var(--warning) 14%,transparent); color:var(--warning); }
#view-pallets .pallet-manual-age { border-radius:999px; display:inline-flex; font-size:11px; font-weight:800; justify-self:start; padding:4px 8px; white-space:nowrap; }
#view-pallets .pallet-manual-age.info { background:color-mix(in srgb,var(--accent) 14%,transparent); color:var(--accent); }
#view-pallets .pallet-manual-age.warning { background:color-mix(in srgb,var(--warning) 14%,transparent); color:var(--warning); }
#view-pallets .pallet-manual-age.danger { background:color-mix(in srgb,var(--danger) 14%,transparent); color:var(--danger); }
#view-pallets .pallet-manual-actions { display:grid; gap:7px; min-width:170px; }
#view-pallets .pallet-manual-actions button { min-height:38px; white-space:normal; }
#view-pallets .pallet-manual-close-dialog { background:var(--panel); border:1px solid var(--line); border-radius:14px; color:var(--text); inset:0; margin:auto; max-height:calc(100dvh - 24px); max-width:min(560px,calc(100vw - 24px)); overflow:auto; padding:0; position:fixed; width:100%; }
#view-pallets .pallet-manual-close-dialog::backdrop { background:rgba(2,8,14,.72); backdrop-filter:blur(3px); }
#view-pallets .pallet-manual-close-dialog form { display:grid; gap:14px; padding:20px; }
#view-pallets .pallet-manual-close-head { align-items:start; display:flex; gap:12px; justify-content:space-between; }
#view-pallets .pallet-manual-close-head h3 { margin:4px 0 0; }
#view-pallets .pallet-manual-close-warning { background:color-mix(in srgb,var(--warning) 11%,var(--surface)); border:1px solid color-mix(in srgb,var(--warning) 42%,var(--line)); border-radius:10px; line-height:1.45; margin:0; padding:12px; }
#view-pallets .pallet-manual-reopen-info { background:color-mix(in srgb,var(--accent) 9%,var(--surface)); border:1px solid color-mix(in srgb,var(--accent) 38%,var(--line)); border-radius:10px; line-height:1.45; margin:0; padding:12px; }
#view-pallets .pallet-manual-close-dialog label { display:grid; gap:6px; font-weight:750; }
#view-pallets .pallet-manual-close-dialog textarea { min-height:90px; resize:vertical; }
#view-pallets .pallet-manual-close-actions { display:flex; gap:9px; justify-content:flex-end; }
#view-pallets .pallet-manual-close-actions button:not(.danger):not(.primary) { background:var(--surface); color:var(--text); }
#view-pallets .pallet-manual-close-actions .danger { background:var(--danger); border-color:var(--danger); color:#fff; }
#view-pallets .pallet-manual-history { border-top:1px solid var(--line); margin-top:4px; padding-top:7px; }
#view-pallets .pallet-manual-history summary { align-items:center; color:var(--accent); cursor:pointer; display:flex; font-size:12px; font-weight:800; gap:6px; list-style:none; }
#view-pallets .pallet-manual-history summary::-webkit-details-marker { display:none; }
#view-pallets .pallet-manual-history summary::before { content:'›'; font-size:18px; line-height:1; transition:transform .18s ease; }
#view-pallets .pallet-manual-history[open] summary::before { transform:rotate(90deg); }
#view-pallets .pallet-manual-history summary span { align-items:center; background:color-mix(in srgb,var(--accent) 14%,transparent); border-radius:999px; display:inline-flex; font-size:10px; height:20px; justify-content:center; min-width:20px; padding:0 6px; }
#view-pallets .pallet-manual-history ol { display:grid; gap:0; list-style:none; margin:10px 0 2px; padding:0 0 0 5px; }
#view-pallets .pallet-manual-history li { border-left:2px solid color-mix(in srgb,var(--accent) 42%,var(--line)); display:grid; gap:3px; padding:0 0 14px 15px; position:relative; }
#view-pallets .pallet-manual-history li:last-child { padding-bottom:2px; }
#view-pallets .pallet-manual-history li::before { background:var(--accent); border:3px solid var(--surface); border-radius:50%; content:''; height:11px; left:-7px; position:absolute; top:3px; width:11px; }
#view-pallets .pallet-manual-history li.closed_unverified::before { background:var(--warning); }
#view-pallets .pallet-manual-history li.completed::before { background:var(--success); }
#view-pallets .pallet-manual-history li > div { display:grid; gap:2px; }
#view-pallets .pallet-manual-history li strong { font-size:12px; line-height:1.3; }
#view-pallets .pallet-manual-history li time,
#view-pallets .pallet-manual-history li small { color:var(--muted); font-size:10px; }
#view-pallets .pallet-manual-history li p { font-size:11px; line-height:1.35; margin:2px 0 0; }
#view-pallets .pallet-manual-history-empty { border-top:1px solid var(--line); margin-top:4px; padding-top:7px; }
#view-pallets .pallet-employee-note { background: color-mix(in srgb,var(--warning) 13%,var(--surface)); border: 1px solid color-mix(in srgb,var(--warning) 42%,var(--line)); border-radius: 8px; display: inline-block; font-weight: 700; line-height: 1.35; max-width: 260px; padding: 7px 9px; }
#view-pallets .pallet-alert-bulk-actions { align-items: center; background: color-mix(in srgb,var(--warning) 10%,var(--surface)); border: 1px solid color-mix(in srgb,var(--warning) 42%,var(--line)); border-radius: 12px; display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; padding: 10px 12px; }
#view-pallets .pallet-alert-bulk-actions[hidden] { display: none; }
#view-pallets .pallet-alert-bulk-actions strong { color: var(--warning); }
#view-pallets .pallet-alert-select { text-align: center; width: 42px; }
#view-pallets .pallet-alert-select input { height: 18px; margin: 0; width: 18px; }
#view-pallets .pallet-alert-table { min-width:0; table-layout:fixed; width:100%; }
#view-pallets .pallet-alert-table th,
#view-pallets .pallet-alert-table td { overflow-wrap:anywhere; padding:12px 10px; vertical-align:middle; }
#view-pallets .pallet-alert-table th:nth-child(1) { width:44px; }
#view-pallets .pallet-alert-table th:nth-child(2) { width:15%; }
#view-pallets .pallet-alert-table th:nth-child(3) { width:14%; }
#view-pallets .pallet-alert-table th:nth-child(4) { width:20%; }
#view-pallets .pallet-alert-table th:nth-child(5) { width:19%; }
#view-pallets .pallet-alert-table th:nth-child(6) { width:13%; }
#view-pallets .pallet-alert-table th:nth-child(7) { width:19%; }
#view-pallets .pallet-alert-person,
#view-pallets .pallet-alert-state { display:grid; gap:5px; }
#view-pallets .pallet-alert-person small,
#view-pallets .pallet-alert-state small { color:var(--muted); line-height:1.25; }
#view-pallets .pallet-alert-sto { font-size:13px; }
#view-pallets .pallet-alert-disposition { background: color-mix(in srgb,var(--warning) 8%,var(--surface)); border-color: color-mix(in srgb,var(--warning) 38%,var(--line)); }
#view-pallets .pallet-alert-disposition div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#view-pallets .pallet-alert-caption { display:-webkit-box; line-height:1.35; max-width:none; overflow:hidden; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
#view-pallets .pallet-alert-suggestion { align-items:flex-start; border-radius:10px; display:grid; gap:2px; min-width:0; padding:8px 10px; text-align:left; white-space:normal; width:100%; }
#view-pallets .pallet-alert-suggestion small { color: inherit; line-height: 1.25; opacity: .82; }
#view-pallets .pallet-alert-suggestion.duplicate { background: color-mix(in srgb,var(--info) 18%,var(--surface)); border-color: color-mix(in srgb,var(--info) 50%,var(--line)); color: var(--info); }
#view-pallets .pallet-alert-suggestion.wrong_group { background: color-mix(in srgb,var(--warning) 14%,var(--surface)); border-color: color-mix(in srgb,var(--warning) 48%,var(--line)); color: var(--warning); }
#view-pallets .pallet-alert-suggestion.review { background: var(--surface); color: var(--text); }

@media (max-width: 760px) {
  #view-pallets .pallet-alert-table { min-width: 0; }
  #view-pallets .pallet-alert-detail { border-left:0; width:100%; }
  #view-pallets .pallet-manual-checks { padding: 10px; }
  #view-pallets .pallet-manual-checks-hero { align-items: stretch; flex-direction: column; gap: 12px; }
  #view-pallets .pallet-manual-check-kpis,
  #view-pallets .pallet-manual-check-tools { grid-template-columns: 1fr; }
  #view-pallets .pallet-manual-check-table { min-width:0; }
  #view-pallets .pallet-manual-check-panel .table-wrap { overflow:visible; }
  #view-pallets .pallet-manual-check-table thead { display:none; }
  #view-pallets .pallet-manual-check-table tbody,
  #view-pallets .pallet-manual-check-table tr,
  #view-pallets .pallet-manual-check-table td { display:block; width:100%; }
  #view-pallets .pallet-manual-check-table tr { border-bottom:8px solid var(--bg); padding:8px 0; }
  #view-pallets .pallet-manual-check-table td { border:0; display:grid; gap:4px; grid-template-columns:minmax(0,1fr); height:auto; padding:8px 10px; text-align:left; }
  #view-pallets .pallet-manual-check-table td::before { color:var(--muted); content:attr(data-label); font-size:10px; font-weight:800; text-transform:uppercase; }
  #view-pallets .pallet-manual-state { min-width:0; }
  #view-pallets .pallet-employee-note { max-width:none; width:100%; }
  #view-pallets .pallet-manual-actions { grid-column:1/-1; grid-template-columns:1fr; min-width:0; }
  #view-pallets .pallet-manual-history { max-width:none; width:100%; }
  #view-pallets .pallet-manual-close-dialog form { padding:16px; }
  #view-pallets .pallet-manual-close-actions { display:grid; grid-template-columns:1fr; }
}
.pallet-screen-weight-suggestion,.pallet-possible-duplicate{border:1px solid rgba(245,158,11,.48);background:rgba(245,158,11,.09);border-radius:14px;padding:12px 14px;color:var(--text)}
.pallet-screen-weight-suggestion{display:grid;gap:4px}.pallet-screen-weight-suggestion span{font-weight:800}.pallet-screen-weight-suggestion small{color:var(--muted)}
.pallet-possible-duplicate{display:grid;grid-template-columns:minmax(220px,1fr) minmax(260px,1.2fr);gap:12px;align-items:center;margin:10px 0}.pallet-possible-duplicate>div{display:grid;gap:5px}.pallet-possible-duplicate span{color:var(--muted)}.pallet-possible-duplicate button{text-align:left;border:1px solid rgba(245,158,11,.35);background:var(--surface);padding:9px 11px;border-radius:10px;color:var(--text)}
@media(max-width:760px){.pallet-possible-duplicate{grid-template-columns:1fr}}

/* Mobile records keep labels, values and actions within the same card. */
#view-pallets.app .pallet-alert-suggestion {
  height: auto !important;
  min-height: 60px;
  grid-template-rows: auto auto;
  line-height: 1.4;
}

@media (max-width: 760px) {
  #view-pallets .pallet-alert-layout .table-wrap {
    max-height: none;
    overflow: visible;
  }
  #view-pallets :is(.pallet-alert-table, .pallet-manual-check-table) tbody tr {
    box-sizing: border-box;
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 14px;
    width: 100%;
  }

  #view-pallets .pallet-alert-table thead { display: none; }
  #view-pallets :is(.pallet-alert-table, .pallet-manual-check-table) td {
    box-sizing: border-box;
    display: grid;
    gap: 5px;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 0 !important;
    height: auto;
    line-height: 1.5;
    text-align: left;
    width: auto;
  }

  #view-pallets .pallet-alert-table td:nth-child(n+4),
  #view-pallets .pallet-manual-check-table td:nth-child(-n+3),
  #view-pallets .pallet-manual-check-table td:nth-child(n+8) {
    grid-column: 1 / -1;
  }

  #view-pallets .pallet-alert-table .pallet-alert-select {
    grid-column: 1 / -1;
    justify-self: end;
  }

  #view-pallets .pallet-alert-table .pallet-alert-select:empty { display: none; }
  #view-pallets .pallet-alert-table .pallet-alert-select::before { content: none; }
  #view-pallets .pallet-alert-table .pallet-alert-select input {
    height: 24px;
    min-height: 24px;
    width: 24px;
  }

  #view-pallets .pallet-alert-suggestion {
    height: auto;
    min-height: 60px;
  }

  #view-pallets :is(.pallet-alert-status, .pallet-employee-note) {
    max-width: 100%;
    white-space: normal;
  }

  #view-pallets .pallet-alert-detail {
    box-sizing: border-box;
    max-height: min(760px, calc(100dvh - 24px));
    overscroll-behavior: contain;
    width: 100%;
  }

  #view-pallets .pallet-alert-detail :is(section, input, select, textarea) {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
  }

  #view-pallets :is(.pallet-alert-detail-head, .pallet-alert-history div) {
    flex-wrap: wrap;
    overflow-wrap: anywhere;
  }

  #view-pallets .pallet-manual-check-panel { padding: 10px; }
  #view-pallets .pallet-manual-close-dialog { box-sizing: border-box; }
}

/* Date ranges stay together; expanded filters remain in the document flow. */
#palletReportExportStatus:empty, .pallet-export-status:empty { display: none; }
#palletReportExportStatus, .pallet-export-status { overflow-wrap: anywhere; }
.pallet-export-status {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 8px 0;
  color: var(--text);
  font-size: 13px;
}
#palletReportExportStatus a, .pallet-export-status a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: underline;
}
@media (max-width: 760px) {
  #view-pallets .pallet-report-center input,
  #view-pallets .pallet-report-center select {
    min-width: 0;
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }
}

.pallet-save-feedback {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
  order: 5;
}
.pallet-save-feedback.error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}
#view-pallets .pallet-verify-actions > button:only-child { grid-column: 1 / -1; }

@media (max-width: 760px) {
  #view-pallets .pallet-verify-fields {
    grid-template-columns: 1fr;
  }
  #view-pallets :is(.pallet-verify-form, .pallet-weight-review-form) input {
    font-size: 16px;
    min-height: 46px;
  }
  #view-pallets .pallet-verify-actions { grid-template-columns: 1fr; }
  #view-pallets .pallet-verify-actions button {
    height: auto;
    min-height: 48px;
    white-space: normal;
    line-height: 1.4;
  }
  #view-pallets .pallet-form-heading { align-items: start; flex-direction: column; }
}

@media (max-width: 760px) {
  #view-pallets .pallet-workspace:not(.detail-open) .pallet-detail {
    display: none;
  }

  #view-pallets .pallet-workspace.detail-open .pallet-layout > .table-wrap {
    display: none;
  }

  #view-pallets .pallet-alert-detail {
    position: fixed;
    inset: 12px;
    width: auto;
    max-height: calc(100dvh - 24px);
    z-index: 250;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  #view-pallets .pallet-mobile-back {
    position: sticky;
    top: 8px;
    z-index: 5;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  #view-pallets .pallet-filters > .pallet-filter-bar {
    display: grid;
    gap: 12px 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  #view-pallets .pallet-filter-bar > :is(input, select, details, button, .pallet-queue-problem-direct) {
    grid-column: 1 / -1;
  }

  #view-pallets .pallet-filter-bar > .pallet-date-filter {
    grid-column: auto;
    align-content: start;
    align-self: stretch;
    line-height: 1.4;
  }

  #view-pallets :is(.pallet-filter-bar, .pallet-alert-filters, #palletManualChecksFilters) :is(input, select, button) {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    min-height: 46px;
  }

  #view-pallets :is(.pallet-filter-bar, .pallet-alert-filters, #palletManualChecksFilters) :is(input, select) {
    font-size: 16px;
  }

  #view-pallets .pallet-date-filter input {
    padding-inline: 8px;
  }

  #view-pallets .pallet-filter-more > div {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    position: static;
    margin-top: 8px;
    padding: 12px;
    box-shadow: none;
  }

  #view-pallets .pallet-filter-more > div > * {
    min-width: 0;
    margin: 0;
  }

  #view-pallets .pallet-column-options > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #view-pallets .pallet-filter-bar .pallet-column-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    overflow-wrap: anywhere;
  }

  #view-pallets .pallet-filter-bar .pallet-column-options input[type="checkbox"] {
    min-height: 20px !important;
    height: 20px !important;
    width: 20px !important;
    flex: 0 0 20px;
    margin: 0;
  }

  #view-pallets .pallet-alert-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;
    padding: 14px;
  }

  #view-pallets .pallet-alert-filters > label:nth-child(n+3),
  #view-pallets .pallet-alert-filters > .actions {
    grid-column: 1 / -1;
  }

  #view-pallets .pallet-alert-filters > .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #view-pallets .pallet-alert-filters label {
    min-width: 0;
    line-height: 1.4;
  }
}
.client-control-proof {
  align-self: start;
  height: fit-content;
  min-width: 0;
  padding: 12px;
  margin-block: 10px;
  border: 1px solid var(--border);
  border-left: 4px solid #c58c1a;
  border-radius: 6px;
  background: var(--surface-soft);
  overflow-wrap: anywhere;
}
.client-control-proof.confirmed { border-left-color: #249b86; }
.client-control-proof p { margin: 6px 0; }
.client-control-proof small { display: block; color: var(--muted); }
.client-control-proof details { margin-top: 8px; }

/* Queue-only layout: one editing surface and distinct operational actions. */
#view-pallets.queue-active > .topbar { position: static; padding: 14px 20px; }
#view-pallets.queue-active > .topbar h1 { font-size: 26px; }
#view-pallets .pallet-filter-tools { display: contents; }
#view-pallets .queue-mode .pallet-review-groups { gap: 12px; padding: 20px; background: var(--panel); }
#view-pallets .pallet-review-groups h2 { margin: 0; font-size: 18px; line-height: 1.4; }
#view-pallets .queue-mode .pallet-review-group-buttons { gap: 8px; }
#view-pallets .queue-mode .pallet-review-group-buttons button {
  min-height: 68px;
  padding: 12px 14px;
  background: var(--panel-soft);
  box-shadow: none;
  transition: background .15s, border-color .15s;
}
#view-pallets .queue-mode .pallet-review-group-buttons button strong {
  display: grid;
  place-items: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--panel);
  font-size: 22px;
}
#view-pallets .queue-mode .pallet-review-group-buttons button:hover { border-color: var(--accent); }
#view-pallets .queue-mode .pallet-review-group-buttons button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}
#view-pallets .queue-mode .pallet-review-group-buttons button[aria-pressed="true"] strong { color: var(--accent-strong); }
#view-pallets .queue-mode .pallet-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 16px 20px;
  background: var(--panel-soft);
}
#view-pallets .queue-mode .pallet-filters > .pallet-filter-bar {
  display: grid;
  grid-template-columns: minmax(200px, 1.4fr) repeat(2, minmax(145px, .7fr)) minmax(200px, 1fr);
  grid-column: 1 / -1;
  gap: 12px;
  align-items: end;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
#view-pallets .queue-mode .pallet-filters > .pallet-list-meta { grid-column: 1; grid-row: 1; }
#view-pallets .queue-mode .pallet-filters > .table-export-menu { grid-column: 2; grid-row: 1; margin: 0; justify-self: end; }
#view-pallets .queue-mode .pallet-filter-bar > *,
#view-pallets .queue-mode .pallet-filter-bar :is(input, select) { min-width: 0; max-width: 100%; box-sizing: border-box; }
#view-pallets .queue-mode .pallet-filter-bar > :is(input, label) { grid-column: auto; }
#view-pallets .queue-mode .pallet-filter-bar > label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; align-self: end; }
#view-pallets .queue-mode .pallet-filter-bar :is(input, select) { width: 100%; min-height: 44px; border-radius: 6px; }
#view-pallets .queue-mode .pallet-filter-tools {
  display: flex;
  align-items: start;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
  padding-top: 2px;
}
#view-pallets .queue-mode .pallet-filter-more { width: auto; }
#view-pallets .queue-mode .pallet-filter-more > summary {
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}
#view-pallets .queue-mode .pallet-filter-more > div { left: 0; right: auto; border-radius: 8px; }
#view-pallets .queue-mode .pallet-column-options { display: none; }
#view-pallets .queue-mode #palletWarehouseExportBtn { margin-left: auto; }
#view-pallets .queue-mode #palletWarehouseExportStatus:empty { display: none; }
#view-pallets .queue-mode :is(button, .pallet-filter-more > summary) {
  min-height: 44px;
  height: auto;
  border-radius: 6px;
  letter-spacing: 0;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: none;
}
#view-pallets .queue-mode :is(button, summary):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#view-pallets .queue-mode button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
#view-pallets .queue-mode .pallet-filter-tools > button { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
#view-pallets .queue-mode #palletRefreshBtn { width: 44px; flex: 0 0 44px; font-size: 22px; padding: 6px; }
#view-pallets .queue-mode .pallet-layout { border-top: 1px solid var(--line); }
#view-pallets .queue-mode .pallet-layout > .table-wrap { background: var(--panel-soft); }
#view-pallets .queue-mode .pallet-register-table tbody { gap: 8px; padding: 12px; }
#view-pallets .queue-mode .pallet-register-table tbody tr:hover { border-color: var(--accent); background: var(--accent-soft); }
#view-pallets .queue-mode .pallet-register-table tbody tr.selected { background: var(--accent-soft); }
#view-pallets .queue-mode .pallet-register-table tbody td[data-pallet-column="date"] { font-size: 11px; line-height: 1.5; }
#view-pallets .queue-mode .pallet-queue-nav {
  position: static;
  margin: 0 0 16px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
  gap: 8px 12px;
  font-size: 12px;
}
#view-pallets .queue-mode .pallet-queue-nav > span { color: var(--muted); }
#view-pallets .queue-mode .pallet-queue-total { background: transparent; padding: 0; border-radius: 0; white-space: normal; }
#view-pallets .queue-mode .pallet-queue-nav .actions { gap: 8px; }
#view-pallets .queue-mode .pallet-queue-nav .actions { padding: 0; background: transparent; border: 0; box-shadow: none; }
#view-pallets .queue-mode .pallet-queue-nav button { background: var(--panel-soft); border: 1px solid var(--line); color: var(--text); }
#view-pallets .queue-mode .pallet-detail > .panel-head { padding: 0; margin-bottom: 12px; gap: 12px; align-items: start; flex-wrap: wrap; background: transparent; border: 0; box-shadow: none; }
#view-pallets .queue-mode .pallet-detail > .panel-head > div { min-width: 0; }
#view-pallets .queue-mode .pallet-badge { max-width: 100%; white-space: normal; line-height: 1.5; }
#view-pallets .queue-mode .pallet-badge.actionable { color: var(--accent-strong); background: var(--accent-soft); }
#view-pallets .queue-mode .pallet-badge.warehouse { color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, var(--panel)); }
#view-pallets .queue-mode .pallet-detail > .panel-head h2 { font-size: 21px; line-height: 1.4; overflow-wrap: anywhere; }
#view-pallets .queue-mode .pallet-review-guidance { border-radius: 6px; padding: 12px 14px; gap: 12px 20px; }
#view-pallets .queue-mode .pallet-review-guidance strong { line-height: 1.55; }
#view-pallets .queue-mode .pallet-review-guidance small { letter-spacing: 0; }
#view-pallets .queue-mode .pallet-review-editor { max-height: none; overflow: visible; padding: 0; scrollbar-gutter: auto; }
#view-pallets .queue-mode .pallet-review-visual { position: static; }
#view-pallets .queue-mode .pallet-photo { min-height: 260px; height: 460px; max-height: 60vh; border-radius: 8px; }
#view-pallets .queue-mode :is(.pallet-review-message, .pallet-photo-context, .pallet-sto-selection, .pallet-key-facts article) { border-radius: 6px; }
#view-pallets .queue-mode .pallet-review-editor .pallet-verify-form { border-radius: 8px; padding: 16px; }
#view-pallets .queue-mode .pallet-verify-form > .pallet-correction-note { order: 3; }
#view-pallets .queue-mode .pallet-verify-form .pallet-verify-actions { order: 4; }
#view-pallets .queue-mode .pallet-shortcuts { display: none; }
#view-pallets .queue-mode .pallet-saved-data { order: 4; }
#view-pallets :is(.pallet-saved-data, .pallet-extra-actions) > summary { padding: 12px 0; min-height: 44px; box-sizing: border-box; cursor: pointer; font-size: 13px; font-weight: 700; line-height: 1.5; color: var(--text); }
#view-pallets .pallet-saved-data { border-block: 1px solid var(--line); margin-top: 8px; }
#view-pallets .queue-mode .pallet-detail-empty { min-height: 260px; display: grid; align-content: center; justify-items: start; gap: 14px; border: 0; background: transparent; }
#view-pallets .queue-mode .pallet-detail-empty h2 { font-size: 19px; margin: 0; }
#view-pallets .queue-mode .pallet-verify-actions button { padding: 12px; }
#view-pallets .queue-mode .pallet-action-approve { background: #087f75; border-color: #087f75; color: #fff; }
#view-pallets .queue-mode .pallet-action-stay { background: var(--panel); color: var(--text); }
#view-pallets .queue-mode .pallet-detail-footer { gap: 0; margin-top: 20px; padding: 0; }
#view-pallets .queue-mode .pallet-detail-footer > :is(.pallet-case-close-action, .pallet-process-action, .pallet-warehouse-review-state, .pallet-warehouse-review-form) {
  padding: 16px 0;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  gap: 16px;
  line-height: 1.5;
}
#view-pallets .queue-mode .pallet-detail-footer > :is(.pallet-warehouse-review-state, .pallet-warehouse-review-form) { order: 0; }
#view-pallets .queue-mode .pallet-detail-footer > .pallet-case-close-action { order: 1; }
#view-pallets .queue-mode .pallet-detail-footer > .pallet-process-action { order: 2; }
#view-pallets .queue-mode .pallet-detail-footer > .pallet-extra-actions { order: 2; border-bottom: 1px solid var(--line); padding-block: 4px; }
#view-pallets .queue-mode .pallet-extra-actions .pallet-process-action { border: 0; border-radius: 0; background: transparent; padding: 4px 0 16px; line-height: 1.6; }
#view-pallets .queue-mode .pallet-history article { border-left: 2px solid var(--line); padding: 10px 14px; background: transparent; border-radius: 0; }
#view-pallets .queue-mode .pallet-history article > small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.5; }
#view-pallets .queue-mode .pallet-detail-footer > .pallet-history-disclosure { order: 3; border: 0; margin: 0; }
#view-pallets .queue-mode .pallet-warehouse-review-state > div { border-left: 3px solid var(--warning); padding-left: 12px; }
#view-pallets .queue-mode .pallet-detail-footer button { flex-shrink: 0; max-width: 100%; padding: 10px 14px; }
#view-pallets .queue-mode .pallet-detail-footer :is(strong, small) { overflow-wrap: anywhere; }
#view-pallets .queue-mode .pallet-detail-footer :is([data-pallet-warehouse-restore], [data-pallet-case-action="close"]) {
  color: var(--text);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}
#view-pallets .queue-mode .pallet-detail-footer button:hover { border-color: var(--accent); background: var(--accent-soft); }
#view-pallets .queue-mode .pallet-warehouse-review-form summary { padding-block: 6px; color: var(--text); }

@media (max-width: 1100px) {
  #view-pallets .queue-mode .pallet-review-group-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-pallets .queue-mode .pallet-filters > .pallet-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-pallets .queue-mode .pallet-filter-bar > input[type="search"] { grid-column: 1 / -1; }
  #view-pallets .queue-mode .pallet-filter-bar > .pallet-queue-problem-direct { grid-column: 1 / -1; }
}
@media (max-width: 1000px) {
  #view-pallets .pallet-workspace.queue-mode .pallet-review-workbench { grid-template-columns: minmax(0, 1fr); }
  #view-pallets .queue-mode .pallet-photo { height: 350px; min-height: 200px; max-height: 45vh; }
  #view-pallets .queue-mode .pallet-warehouse-review-state { align-items: stretch; flex-direction: column; }
  #view-pallets .queue-mode .pallet-warehouse-review-state button { align-self: start; }
}
@media (max-width: 760px) {
  #view-pallets .queue-mode :is(.pallet-review-groups, .pallet-filters) { padding: 14px; }
  #view-pallets .queue-mode .pallet-review-group-buttons { grid-template-columns: minmax(0, 1fr); }
  #view-pallets .queue-mode .pallet-review-group-buttons button { min-height: 56px; }
  #view-pallets .queue-mode .pallet-review-group-buttons button strong { font-size: 20px; min-height: 30px; }
  #view-pallets .queue-mode .pallet-filters > .pallet-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-pallets .queue-mode .pallet-filter-tools { display: grid; grid-template-columns: minmax(0, 1fr) 44px; width: 100%; }
  #view-pallets .queue-mode .pallet-filter-tools > :is(.pallet-filter-more, #palletWarehouseExportBtn) { grid-column: 1 / -1; width: 100%; margin: 0; }
  #view-pallets .queue-mode .pallet-filter-tools > .pallet-filter-more > div { min-width: 0; left: auto; }
  #view-pallets .queue-mode .pallet-filter-tools > button { width: 100%; }
  #view-pallets .queue-mode #palletRefreshBtn { width: 44px; }
  #view-pallets .queue-mode .pallet-filter-tools #palletClearFiltersBtn { grid-column: 1; }
  #view-pallets .queue-mode .pallet-filter-bar :is(input, select) { font-size: 16px; }
  #view-pallets .queue-mode .pallet-queue-nav .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-pallets .queue-mode .pallet-review-guidance { grid-template-columns: minmax(0, 1fr); }
  #view-pallets .queue-mode .pallet-detail-footer > :is(.pallet-case-close-action, .pallet-process-action) { align-items: stretch; flex-direction: column; gap: 10px; }
  #view-pallets .queue-mode .pallet-detail-footer button { align-self: stretch; width: 100%; min-height: 48px; }
  #view-pallets .queue-mode .pallet-review-editor .pallet-verify-form { padding: 12px; }
}
@media (min-width: 380px) and (max-width: 760px) {
  #view-pallets .queue-mode .pallet-review-group-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-pallets .queue-mode .pallet-review-group-buttons button { min-height: 76px; padding: 10px; gap: 6px; font-size: 13px; }
  #view-pallets .queue-mode .pallet-review-group-buttons button strong { min-width: 24px; padding: 0 4px; font-size: 18px; }
}
