body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  background: #eef1f4;
  color: #1a1a1a;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  padding: 32px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 400px;
}

.login-card .brand {
  font-size: 1.6em;
  font-weight: 700;
  color: #1e3a5f;
  margin-bottom: 8px;
}

.login-card .subtitle,
.muted {
  color: #666;
}

.login-card .subtitle {
  margin: 0 0 20px;
}

.login-card label,
.stack-form label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 600;
  font-size: 0.92em;
}

.login-card input,
.login-card select,
.stack-form input,
.stack-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  box-sizing: border-box;
  font-size: 1em;
}

.login-card button,
.stack-form button,
.tab-btn,
.btn-small {
  padding: 10px 18px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
}

.login-card button {
  width: 100%;
  margin-top: 20px;
}

.login-card button:hover,
.stack-form button:hover,
.tab-btn:hover,
.btn-small:hover {
  background: #1d4ed8;
}

.hint {
  font-weight: 400;
  color: #888;
  font-size: 0.85em;
}

.login-help {
  margin-top: 16px;
  font-size: 0.85em;
  color: #777;
  line-height: 1.4;
}

.login-help a,
.error a {
  color: #2563eb;
  font-weight: 600;
}

.link-btn {
  padding: 0;
  border: none;
  background: none;
  color: #2563eb;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.link-btn:hover,
.link-btn:focus {
  color: #1d4ed8;
}

.setup-steps {
  margin: 0 0 16px 1.2em;
  padding: 0;
  color: #555;
  line-height: 1.5;
}

.setup-steps li {
  margin-bottom: 8px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.choice-btn {
  padding: 28px 20px;
  font-size: 1.05em;
  font-weight: 600;
  background: #fff;
  color: #1e3a5f;
  border: 2px solid #2563eb;
  border-radius: 10px;
  cursor: pointer;
}

.choice-btn[data-recv-type="master_company"] {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a5f;
}

.choice-btn[data-recv-type="master_company"]:hover,
.choice-btn[data-recv-type="master_company"]:focus {
  background: #bfdbfe;
  border-color: #60a5fa;
}

.choice-btn[data-recv-type="individual_brand"] {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
}

.choice-btn[data-recv-type="individual_brand"]:hover,
.choice-btn[data-recv-type="individual_brand"]:focus {
  background: #fed7aa;
  border-color: #fb923c;
}

.panel-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.panel-head-row h2,
.panel-head-row h3 {
  margin: 0;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.sub-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.sub-panel h3 {
  margin-top: 0;
}

.brand-field-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.brand-field-row input {
  flex: 1;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn-secondary {
  background: #64748b;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #475569;
}

.brand-chips {
  margin-bottom: 16px;
  line-height: 1.8;
}

.brand-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px 16px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  margin: 12px 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.brand-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
}

.brand-check-item.is-disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.brand-check-item .brand-name-with-logo {
  flex: 1;
  min-width: 0;
}

.brand-check-pending {
  background: #fef9c3;
  border-radius: 6px;
  padding: 4px 8px;
  margin: -4px -8px;
}

.brand-pending-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #854d0e;
  background: #fde047;
  border-radius: 999px;
  vertical-align: middle;
}

.brand-row-pending {
  background: #fef9c3;
}

.brand-row-pending td {
  border-color: #fde047;
}

.btn-approve {
  background: #16a34a;
  color: #fff;
  border-color: #15803d;
  margin-right: 6px;
}

.btn-approve:hover {
  background: #15803d;
}

.recv-temp-brand-block {
  margin-top: 12px;
}

.recv-temp-brand-add {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.recv-temp-brand-add input[type="text"] {
  flex: 1;
  min-width: 180px;
}

.recv-temp-brand-note {
  margin-top: 6px;
  font-size: 0.9em;
}

.recv-temp-brand-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}

.recv-temp-brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 999px;
  font-weight: 500;
}

.recv-temp-brand-remove {
  border: none;
  background: transparent;
  color: #854d0e;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.brand-assigned-note {
  font-size: 0.82em;
  color: #64748b;
  font-weight: 400;
}

.company-brands-cell {
  line-height: 1.8;
}

.chip {
  display: inline-block;
  background: #e0e7ff;
  color: #1e3a5f;
  padding: 4px 10px;
  border-radius: 999px;
  margin: 2px 4px 2px 0;
  font-size: 0.9em;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-weight: 500;
}

.checkbox-label.inline-check {
  display: inline-flex;
  margin: 6px 16px 6px 0;
}

.brand-picker {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
}

.brand-picker legend {
  font-weight: 600;
  padding: 0 6px;
}

select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  box-sizing: border-box;
  font-size: 1em;
  background: #fff;
}

.error {
  background: #ffebee;
  color: #c62828;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.success-msg {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.hidden {
  display: none !important;
}

.app-header {
  background: #1e3a5f;
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.4em;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.95em;
}

.user-bar a {
  color: #bfdbfe;
  text-decoration: none;
}

.user-bar a:hover {
  text-decoration: underline;
}

.user-bar .header-backup-btn {
  display: inline-block;
  padding: 6px 14px;
  background: #f59e0b;
  color: #1e3a5f;
  font-weight: 700;
  border-radius: 6px;
  text-decoration: none;
}

.user-bar .header-backup-btn:hover {
  background: #fbbf24;
  text-decoration: none;
}

.backup-panel {
  margin-top: 20px;
  border: 2px solid #f59e0b;
}

.backup-status {
  margin: 8px 0 0;
}

.btn-backup {
  background: #f59e0b;
  color: #1e3a5f;
  border: none;
  border-radius: 6px;
  padding: 12px 22px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.btn-backup:hover {
  background: #fbbf24;
}

.btn-backup:disabled {
  opacity: 0.7;
  cursor: wait;
}

.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.tab-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tab-btn {
  background: #fff;
  color: #1e3a5f;
  border: 2px solid #cbd5e1;
}

.tab-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
}

.panel-card h2,
.panel-card h3 {
  margin: 0 0 12px;
  color: #1e3a5f;
}

.panel-desc {
  color: #666;
  margin: 0 0 16px;
}

.stack-form button {
  margin-top: 8px;
  width: auto;
}

.inline-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.inline-fields label {
  margin-top: 0;
}

.field-grow {
  flex: 1 1 200px;
}

.field-narrow {
  flex: 0 0 90px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.data-table th {
  background: #f1f5f9;
  font-weight: 600;
  color: #334155;
}

.data-table tr:hover td {
  background: #f8fafc;
}

.status-open {
  color: #b45309;
  font-weight: 600;
}

.status-resolved {
  color: #15803d;
  font-weight: 600;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.85em;
  background: #64748b;
}

.btn-small:hover {
  background: #475569;
}

.btn-add {
  background: #2563eb;
}

.btn-add:hover {
  background: #1d4ed8;
}

.btn-danger {
  background: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
}

.col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.reports-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.reports-period-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reports-period-btn {
  padding: 8px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1e3a5f;
  font-weight: 600;
  cursor: pointer;
}

.reports-period-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.reports-period-btn:hover,
.reports-period-btn:focus {
  border-color: #2563eb;
}

.reports-total {
  margin: 0;
  font-size: 0.95em;
}

.reports-chart-wrap {
  width: 100%;
  overflow-x: auto;
  padding-top: 8px;
}

#reportsChart {
  display: block;
  width: 100%;
  min-width: 280px;
  min-height: 380px;
}

.brand-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.catalog-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.catalog-item.in-list {
  background: #ffffff;
  border-color: #cbd5e1;
}

.catalog-name {
  flex: 1 1 100px;
  font-weight: 600;
  color: #1e3a5f;
}

.brand-name-with-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 100px;
  min-width: 0;
}

.brand-name-text,
.catalog-item .brand-name-text {
  font-weight: 600;
  color: #1e3a5f;
}

.brand-logo-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.brand-logo,
.brand-logo-fallback {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
}

.brand-logo {
  position: absolute;
  inset: 0;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.brand-logo.is-hidden {
  display: none;
}

.brand-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #854d0e;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.data-table .brand-name-with-logo {
  flex: none;
}

.associate-cell {
  min-width: 220px;
}

.associate-cell select {
  max-width: 160px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.actions-cell {
  white-space: nowrap;
}

.recv-wizard-step .btn-row {
  margin-top: 1rem;
}

.recv-wizard-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.recv-wizard-nav-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

@media (max-width: 520px) {
  .recv-wizard-nav .recv-wizard-nav-spacer {
    display: none;
  }

  .recv-wizard-nav #recvSkipPhotoBtn {
    flex: 1 1 100%;
  }
}

.recv-totals-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-top: 0.75rem;
}

.recv-totals-standard {
  padding-right: 1rem;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.recv-totals-standard-label {
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.5rem;
}

.recv-qty-hint {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.recv-qty-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
  max-width: 340px;
  align-items: end;
}

.recv-qty-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.recv-qty-field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  min-height: 2.75em;
  line-height: 1.3;
  display: block;
}

.recv-qty-field-solo {
  max-width: 140px;
  margin-bottom: 0.75rem;
}

.recv-qty-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  max-width: none;
  min-height: 88px;
  padding: 8px;
  border: 2px solid #93c5fd;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  font-family: inherit;
}

.recv-qty-box.has-value {
  background: #dbeafe;
  border-color: #3b82f6;
}

.recv-qty-box-value {
  font-size: 2rem;
  font-weight: 800;
  color: #1e3a5f;
  line-height: 1;
}

.recv-qty-box:not(.has-value) .recv-qty-box-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #64748b;
}

.recv-qty-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.recv-numpad-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.recv-numpad-modal.hidden {
  display: none;
}

.recv-numpad-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.recv-numpad-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
}

.recv-numpad-title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: #1e3a5f;
  text-align: center;
}

.recv-numpad-display {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: #f1f5f9;
  border-radius: 10px;
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  color: #1e3a5f;
  min-height: 3.5rem;
  line-height: 1.2;
}

.recv-numpad-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 0.75rem;
}

.recv-numpad-key {
  min-height: 52px;
  border: none;
  border-radius: 10px;
  background: #e2e8f0;
  color: #1e293b;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.recv-numpad-key:active {
  background: #cbd5e1;
}

.recv-numpad-key-wide {
  font-size: 1rem;
}

.recv-numpad-done {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.recv-numpad-done:active {
  background: #1d4ed8;
}

.recv-quick-receiving {
  padding-left: 0.25rem;
}

.recv-quick-receiving h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: #1e3a5f;
}

.recv-quick-brand-grid {
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.recv-quick-carton-label {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #475569;
}

.recv-carton-box-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.recv-carton-box {
  aspect-ratio: 1;
  min-height: 52px;
  border: 2px solid #a67c52;
  border-radius: 6px;
  background: linear-gradient(145deg, #e8d4b8 0%, #c9a66b 45%, #b8894f 100%);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.45),
    inset 0 -3px 6px rgba(0, 0, 0, 0.12),
    0 2px 4px rgba(0, 0, 0, 0.15);
  color: #3d2914;
  font-size: 1.35rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}

.recv-carton-box:hover,
.recv-carton-box:focus {
  border-color: #1e3a5f;
  outline: none;
  transform: translateY(-1px);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.5),
    0 4px 8px rgba(30, 58, 95, 0.25);
}

.recv-carton-box:active {
  transform: translateY(1px);
}

@media (max-width: 720px) {
  .recv-totals-layout {
    grid-template-columns: 1fr;
  }

  .recv-totals-standard {
    padding-right: 0;
    border-right: none;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  .recv-quick-receiving {
    padding-left: 0;
    padding-top: 0.5rem;
  }
}

.camera-upload-btn {
  display: inline-block;
  padding: 1rem 1.5rem;
  background: #f9a8d4;
  color: #831843;
  border: 2px solid #f472b6;
  border-radius: 10px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  margin: 0.75rem 0;
}

.camera-upload-btn:hover,
.camera-upload-btn:focus {
  background: #f472b6;
  color: #fff;
}

.camera-upload-btn:active {
  background: #ec4899;
  color: #fff;
}

#recvWizard .recv-confirm-btn {
  background: #22c55e;
  color: #fff;
  border: none;
  padding: 18px 28px;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  min-height: 56px;
  border-radius: 10px;
}

.recv-wizard-nav .recv-confirm-btn {
  flex: 1 1 100%;
  width: 100%;
  margin-top: 6px;
}

.recv-wizard-nav #recvSkipPhotoBtn {
  flex: 1 1 auto;
}

#recvWizard .recv-confirm-btn:hover:not(:disabled),
#recvWizard .recv-confirm-btn:focus:not(:disabled) {
  background: #16a34a;
}

#recvWizard .recv-confirm-btn:active:not(:disabled) {
  background: #15803d;
}

#recvWizard .recv-confirm-btn:disabled {
  background: #86efac;
  color: #fff;
  cursor: not-allowed;
  opacity: 0.85;
}

.recv-numpad-done.recv-confirm-btn {
  background: #22c55e;
  width: 100%;
  min-height: 56px;
  font-size: 1.2rem;
  padding: 18px 24px;
}

.recv-numpad-done.recv-confirm-btn:hover:not(:disabled) {
  background: #16a34a;
}

.recv-photo-captured-block {
  margin: 0.75rem 0 1rem;
  padding: 1rem;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
}

.recv-photo-captured-block.hidden {
  display: none;
}

.recv-photo-count-badge {
  margin: 0 0 0.75rem;
  padding: 0.65rem 1rem;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
}

.recv-photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.recv-photo-thumb {
  margin: 0;
  text-align: center;
}

.recv-photo-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.recv-photo-thumb figcaption {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #64748b;
}

.recv-add-photo-btn.hidden {
  display: none;
}

.packing-slip-modal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.packing-slip-modal-nav.hidden {
  display: none;
}

.packing-slip-photo-indicator {
  font-weight: 600;
  color: #475569;
  min-width: 6rem;
  text-align: center;
}

.packing-slip-modal-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.packing-slip-thumb-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.packing-slip-thumb-tools {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.packing-slip-thumb-tools .btn-small {
  padding: 4px 6px;
  font-size: 11px;
  line-height: 1.2;
}

.packing-slip-thumb-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  overflow: hidden;
}

.packing-slip-thumb-btn.is-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.packing-slip-thumb-btn.is-empty {
  border-style: dashed;
  color: #64748b;
}

.packing-slip-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.packing-slip-thumb-label {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 4px;
}

.packing-slip-thumb-add {
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1;
}

.packing-slip-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}

.packing-slip-modal-actions .hidden {
  display: none;
}

.recv-photo-count-pill {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.btn-icon.recv-packing-slip-btn {
  position: relative;
}

.recv-photo-remove-btn {
  margin-top: 6px;
}

.recv-success-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  gap: 1rem;
}

.recv-success-overlay.hidden {
  display: none;
}

.recv-success-check {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: 4.5rem;
  line-height: 120px;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 8px 32px rgba(22, 163, 74, 0.45);
}

.recv-success-overlay p {
  font-size: 1.5rem;
  font-weight: 700;
  color: #166534;
  margin: 0;
}

.recv-skid-recount-fields label {
  margin-top: 0.75rem;
}

.recv-skid-recount-fields input {
  margin-bottom: 0.25rem;
}

.data-table .col-brand-count {
  width: 5.5rem;
  text-align: center;
  white-space: nowrap;
}

.recv-brands-cell {
  max-width: 220px;
}

.recv-brands-btn {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  color: #1e3a5f;
  font: inherit;
}

.recv-brands-btn:hover .recv-brands-text,
.recv-brands-btn:focus .recv-brands-text {
  text-decoration: underline;
}

.recv-brands-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.recv-brands-modal-panel {
  width: min(96vw, 420px);
}

.recv-brands-modal-body {
  text-align: left;
}

.recv-brands-modal-company {
  margin: 0 0 0.75rem;
  font-weight: 600;
  color: #1e3a5f;
}

.recv-brands-modal-list {
  margin: 0;
  padding: 0 0 0 1.25rem;
  list-style: disc;
}

.recv-brands-modal-list li {
  margin: 0.35rem 0;
  color: #334155;
}

.data-table .col-slip {
  min-width: 48px;
  text-align: center;
  vertical-align: middle;
}

.receiving-month-archive {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.receiving-month-archive.hidden {
  display: none;
}

.receiving-month-group {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.receiving-month-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  font-weight: 700;
  color: #1e3a5f;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.receiving-month-summary::-webkit-details-marker {
  display: none;
}

.receiving-month-name::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s ease;
}

.receiving-month-group[open] .receiving-month-name::before {
  transform: rotate(90deg);
}

.receiving-month-count {
  font-weight: 500;
  font-size: 0.9rem;
}

.receiving-month-table-wrap {
  border-top: 1px solid #e2e8f0;
  overflow-x: auto;
  background: #fff;
}

.receiving-month-table {
  margin: 0;
}

.receiving-month-table tbody tr:first-child td {
  border-top: none;
}

.recv-packing-slip-icons {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-icon.recv-packing-slip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: none;
  border-radius: 8px;
  background: #e8f0fa;
  color: #1e3a5f;
  cursor: pointer;
}

.btn-icon.recv-packing-slip-btn:hover,
.btn-icon.recv-packing-slip-btn:focus {
  background: #c5d9f2;
  outline: none;
}

.btn-icon.recv-packing-slip-btn:active {
  transform: scale(0.96);
}

.packing-slip-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.packing-slip-modal.hidden {
  display: none;
}

.packing-slip-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.packing-slip-modal-panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 720px);
  max-height: 92vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.packing-slip-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.packing-slip-modal-head h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #1e3a5f;
}

.packing-slip-modal-body {
  padding: 1rem;
  overflow: auto;
  text-align: center;
  background: #f8fafc;
}

.packing-slip-modal-error {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 8px;
  text-align: center;
}

.packing-slip-modal-error.hidden,
.packing-slip-modal-body img.hidden {
  display: none;
}

.packing-slip-modal-body img {
  max-width: 100%;
  max-height: 75vh;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .inline-fields {
    flex-direction: column;
    align-items: stretch;
  }

  .field-narrow {
    flex: 1 1 auto;
  }
}
