.haccp-workspace {
  --haccp-green: #274b32;
  --haccp-gold: #c9952d;
  --haccp-cream: #fbf8f1;
  display: grid;
  gap: 22px;
  padding: 28px;
  background: #fff;
}

.haccp-header,
.haccp-content,
.haccp-detail-actions,
.haccp-view-tabs,
.haccp-filters {
  display: flex;
  align-items: center;
}

.haccp-header {
  justify-content: space-between;
  gap: 24px;
}

.haccp-header > div:first-child > span,
.haccp-detail header span {
  color: #a5603f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
}

.haccp-header h3 {
  margin: 7px 0 4px;
  color: var(--haccp-green);
  font-size: clamp(25px, 2.2vw, 34px);
}

.haccp-header p,
.haccp-detail p {
  margin: 0;
  color: #776f64;
}

.haccp-notice {
  padding: 14px 16px;
  border: 1px solid #d6dfca;
  border-radius: 14px;
  background: #f1f6ec;
  color: #34553a;
  font-weight: 700;
}

.haccp-notice.is-error {
  border-color: #e3b6b6;
  background: #fff1f1;
  color: #8d3434;
}

.haccp-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.haccp-metrics article {
  min-height: 130px;
  padding: 20px;
  border: 1px solid #e4ddd1;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff 35%, #fbf8f1);
  box-shadow: 0 12px 32px rgba(55, 48, 39, .055);
}

.haccp-metrics small,
.haccp-metrics span {
  display: block;
  color: #7a7268;
}

.haccp-metrics small {
  font-weight: 750;
}

.haccp-metrics strong {
  display: block;
  margin: 10px 0 6px;
  color: var(--haccp-green);
  font-size: 30px;
}

.haccp-metrics span {
  font-size: 13px;
}

.haccp-view-tabs {
  gap: 4px;
  overflow-x: auto;
  padding: 5px;
  border: 1px solid #e4d9c8;
  border-radius: 17px;
  background: var(--haccp-cream);
}

.haccp-view-tabs button {
  flex: 0 0 auto;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #4d5d43;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.haccp-view-tabs button.is-active {
  background: var(--haccp-green);
  color: #fff;
  box-shadow: 0 7px 18px rgba(39, 75, 50, .2);
}

.haccp-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1.6fr) repeat(2, minmax(170px, .7fr)) repeat(3, auto);
  gap: 12px;
  align-items: end;
  padding: 17px;
  border: 1px solid #e5ddd1;
  border-radius: 17px;
  background: #fff;
}

.haccp-filter-action {
  min-height: 48px;
  align-self: end;
  padding-inline: 18px;
  border: 0;
  white-space: nowrap;
  box-shadow: 0 7px 18px rgba(39, 55, 42, .12);
}

.haccp-filter-action.is-csv {
  background: #385b39;
  color: #fff;
}

.haccp-filter-action.is-json {
  background: #efc96d;
  color: #2d3c2b;
}

.haccp-filter-action.is-print {
  background: #a93b63;
  color: #fff;
}

.haccp-filter-action:hover {
  filter: brightness(.96);
  transform: translateY(-1px);
}

.haccp-filters label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #554e45;
  font-weight: 750;
}

.haccp-filters input,
.haccp-filters select,
.haccp-dialog input,
.haccp-dialog select,
.haccp-dialog textarea {
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  padding: 11px 13px;
  border: 1px solid #d9d3ca;
  border-radius: 12px;
  background: #fff;
  color: #2f2d29;
  font: inherit;
}

.haccp-search {
  position: relative;
}

.haccp-search svg {
  position: absolute;
  bottom: 15px;
  left: 13px;
  width: 18px;
  height: 18px;
  color: #766f66;
}

.haccp-search input {
  padding-left: 42px;
}

.haccp-content {
  align-items: stretch;
  gap: 18px;
  min-width: 0;
}

.haccp-list {
  display: grid;
  flex: 1 1 62%;
  gap: 10px;
  min-width: 0;
}

.haccp-lot-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(125px, .8fr) minmax(120px, .7fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 70px;
  padding: 14px 16px;
  border: 1px solid #e6e0d7;
  border-radius: 15px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.haccp-lot-row:hover,
.haccp-lot-row:focus-visible,
.haccp-lot-row.is-active {
  border-color: #9aab80;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(87, 112, 67, .12);
}

.haccp-lot-row strong,
.haccp-lot-row small {
  display: block;
}

.haccp-lot-row small {
  margin-top: 3px;
  color: #80786e;
}

.haccp-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e9f2e3;
  color: #3f6b3b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.haccp-status.is-quarantined,
.haccp-status.is-rejected {
  background: #fbe7e4;
  color: #9a3f3f;
}

.haccp-status.is-accepted_with_warning {
  background: #fff0cf;
  color: #946317;
}

.haccp-detail {
  flex: 1 1 38%;
  min-width: 310px;
  max-height: 720px;
  overflow: auto;
  padding: 20px;
  border: 1px solid #dce2d2;
  border-radius: 18px;
  background: linear-gradient(160deg, #f5f8f1, #fff);
}

.haccp-detail h4 {
  margin: 7px 0 15px;
  color: var(--haccp-green);
  font-size: 22px;
}

.haccp-detail-actions {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.haccp-genealogy-node {
  margin: 8px 0;
  padding: 12px;
  border-left: 3px solid var(--haccp-gold);
  border-radius: 0 10px 10px 0;
  background: #fff;
}

.haccp-dialog-body {
  display: grid;
  gap: 15px;
}

.haccp-dialog-body > label {
  display: grid;
  gap: 7px;
  color: #4b463f;
  font-weight: 750;
}

.production-complete-lot {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(130px, .8fr) minmax(110px, .5fr);
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #dde5d6;
  border-radius: 12px;
  background: #f8faf6;
}

.production-complete-lot-group {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid #d9e2d1;
  border-radius: 15px;
  background: #fff;
}

.production-complete-lot-group > span {
  color: #71695e;
  font-size: 13px;
}

.production-complete-lot-warning {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff0e5;
  color: #8b4d28 !important;
  font-weight: 750;
}

.production-complete-lot small {
  display: block;
  margin-top: 3px;
  color: #7c746a;
}

.production-complete-lot input:disabled {
  cursor: not-allowed;
  background: #eceae6;
  color: #777;
}

.production-complete-lot label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
}

/* HACCP-invoer gebruikt dezelfde ruime, leesbare veldhiërarchie als de overige dialogen. */
#haccpCheckDialog .haccp-dialog-body {
  gap: 19px;
}

#haccpCheckDialog .haccp-dialog-body > label,
#haccpCheckDialog .production-form-grid label {
  gap: 8px;
  font-size: 15px;
  line-height: 1.3;
}

#haccpCheckDialog .production-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

#haccpCheckDialog .haccp-dialog-body :is(input, select, textarea) {
  min-height: 56px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

#haccpCheckDialog .haccp-dialog-body textarea {
  min-height: 108px;
  padding-block: 14px;
}

#haccpCheckDialog .haccp-dialog-body :is(input, textarea)::placeholder {
  color: #817b74;
  font-weight: 550;
  opacity: 1;
}

#haccpCheckDialog .inventory-counting-confirm {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

@media (max-width: 1100px) {
  .haccp-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .haccp-filters {
    grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(160px, .7fr));
  }
  .haccp-filters button {
    width: 100%;
  }
  .haccp-content {
    align-items: stretch;
    flex-direction: column;
  }
  .haccp-detail {
    min-width: 0;
    max-height: 520px;
  }
}

@media (max-width: 720px) {
  .haccp-workspace {
    padding: 18px;
  }
  .haccp-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .haccp-metrics,
  .haccp-filters {
    grid-template-columns: 1fr;
  }
  .haccp-lot-row,
  .production-complete-lot {
    grid-template-columns: 1fr;
  }
  .haccp-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }
  #haccpCheckDialog .production-form-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .app-sidebar,
  .topbar,
  #inventoryHero,
  #inventoryTabs,
  .haccp-workspace__actions,
  .haccp-filterbar,
  dialog {
    display: none !important;
  }

  .app-shell,
  .app-main,
  #haccpWorkspace,
  .haccp-panel {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    overflow: visible !important;
    box-shadow: none !important;
  }
}
