.fulfillment-page {
  width: 100%;
  max-width: 100%;
  padding: 16px 18px 36px;
  color: #07162f;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fulfillment-topbar,
.fulfillment-panel,
.fulfillment-form {
  background: rgba(255, 255, 255, .96);
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .06);
}

.fulfillment-topbar {
  min-height: 74px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.fulfillment-topbar span {
  display: block;
  color: #5b31e6;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: .04em;
}

.fulfillment-topbar h1,
.fulfillment-panel-title h2 {
  margin: 0;
  color: #07162f;
  letter-spacing: 0;
}

.fulfillment-topbar h1 {
  font-size: 24px;
  line-height: 1.1;
}

.fulfillment-toolbar,
.fulfillment-actions,
.fulfillment-links,
.fulfillment-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.fulfillment-company-tabs {
  width: 100%;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
}

.fulfillment-company-tabs button {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid #c8d7eb;
  border-radius: 8px;
  background: #fff;
  color: #12345d;
  padding: 0 12px;
  font-weight: 950;
}

.fulfillment-company-tabs button span {
  margin-left: 6px;
  color: #667085;
  font-size: 11px;
  font-weight: 900;
}

.fulfillment-company-tabs button.is-active {
  border-color: #0f766e;
  background: #e6fffb;
  color: #0f766e;
}

.fulfillment-company-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #c8d7eb;
  border-radius: 8px;
  background: #fff;
}

.fulfillment-company-filter span {
  color: #667085;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.fulfillment-company-filter select {
  min-width: 190px;
  border: 0;
  background: transparent;
  color: #12345d;
  font-weight: 900;
  outline: 0;
}

.fulfillment-page button {
  min-height: 34px;
  border: 1px solid #c8d7eb;
  border-radius: 8px;
  background: #fff;
  color: #12345d;
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
}

.fulfillment-toolbar button:first-child,
.fulfillment-form-actions button[type="submit"],
.fulfillment-lot-form button[type="submit"] {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.fulfillment-page button:disabled {
  opacity: .58;
  cursor: not-allowed;
}

.fulfillment-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.fulfillment-metric {
  min-height: 86px;
  border: 1px solid #dce6f2;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.fulfillment-metric.is-alert {
  border-color: #fed7aa;
  background: #fff7ed;
}

.fulfillment-metric.is-danger {
  border-color: #fecaca;
  background: #fff1f2;
}

.fulfillment-metric span,
.fulfillment-metric small,
.fulfillment-table small,
.fulfillment-panel-title small {
  display: block;
  color: #667085;
  font-size: 12px;
  font-weight: 750;
}

.fulfillment-metric strong {
  display: block;
  margin: 6px 0 4px;
  color: #0f172a;
  font-size: 22px;
  line-height: 1.15;
}

.fulfillment-panel {
  overflow: hidden;
}

.fulfillment-panel-title {
  min-height: 52px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5ecf5;
  background: #f8fbff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fulfillment-panel-title h2 {
  font-size: 15px;
}

.fulfillment-form {
  padding: 14px;
}

.fulfillment-form[hidden] {
  display: none;
}

.fulfillment-form-grid,
.fulfillment-lot-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.fulfillment-form label,
.fulfillment-lot-form label,
.fulfillment-compact-grid label,
.fulfillment-lot-table label {
  color: #475467;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.fulfillment-form input,
.fulfillment-form select,
.fulfillment-lot-form input,
.fulfillment-compact-grid input,
.fulfillment-table select,
.fulfillment-lot-table input {
  width: 100%;
  min-height: 34px;
  margin-top: 4px;
  border: 1px solid #cad8ea;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  padding: 7px 9px;
  font-size: 13px;
  font-weight: 750;
}

.fulfillment-form input:focus,
.fulfillment-form select:focus,
.fulfillment-lot-form input:focus,
.fulfillment-compact-grid input:focus,
.fulfillment-table select:focus,
.fulfillment-lot-table input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.fulfillment-form-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.fulfillment-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.fulfillment-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.fulfillment-table th {
  padding: 10px 12px;
  color: #475467;
  background: #f8fafc;
  border-bottom: 1px solid #e4ebf5;
  font-size: 11px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.fulfillment-table td {
  padding: 12px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: top;
}

.fulfillment-table tbody tr:hover {
  background: #f7fbff;
}

.fulfillment-product-cell,
.fulfillment-company-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fulfillment-product-cell {
  align-items: flex-start;
  min-width: 330px;
}

.fulfillment-product-cell.is-clickable {
  cursor: pointer;
  border-radius: 8px;
  padding: 4px;
  margin: -4px;
}

.fulfillment-product-cell.is-clickable:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .24);
  outline-offset: 2px;
}

.fulfillment-product-cell.is-clickable:hover strong {
  color: #0f766e;
}

.fulfillment-product-cell strong,
.fulfillment-company-cell strong {
  color: #07162f;
  font-weight: 950;
}

.fulfillment-image,
.fulfillment-image-placeholder {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border: 1px solid #d8e4f2;
  border-radius: 8px;
  background: #f8fafc;
  object-fit: contain;
}

.fulfillment-image-placeholder {
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 900;
}

.fulfillment-company-cell > span {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 950;
}

.fulfillment-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.fulfillment-badges span,
.fulfillment-chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border: 1px solid #cfe0f5;
  border-radius: 999px;
  background: #f1f7ff;
  color: #174375;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 850;
}

.fulfillment-badges strong {
  margin-left: 3px;
}

.fulfillment-chip.is-ok {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.fulfillment-chip.is-alert {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.fulfillment-active-lots {
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fulfillment-active-lot {
  display: grid;
  grid-template-columns: minmax(118px, 1fr) auto;
  gap: 3px 8px;
  align-items: center;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  padding: 7px 9px;
}

.fulfillment-active-lot.is-ready {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.fulfillment-active-lot.is-missing {
  border-color: #fed7aa;
  background: #fff7ed;
}

.fulfillment-active-lot strong {
  color: #0f172a;
  font-size: 12px;
}

.fulfillment-active-lot span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 950;
  text-align: right;
}

.fulfillment-active-lot small {
  grid-column: 1 / -1;
}

.fulfillment-active-lots.is-empty {
  max-width: 180px;
}

.fulfillment-stock-readonly,
.fulfillment-stock-now,
.fulfillment-lot-summary,
.fulfillment-lot-qty-readonly {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fulfillment-stock-now {
  min-width: 130px;
  flex-direction: column;
  gap: 2px;
}

.fulfillment-stock-now strong {
  color: #0f766e;
  font-size: 28px;
  line-height: 1;
}

.fulfillment-stock-now span {
  color: #0f172a;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.fulfillment-stock-readonly {
  width: 260px;
  margin-bottom: 8px;
}

.fulfillment-stock-readonly span,
.fulfillment-lot-summary span,
.fulfillment-lot-qty-readonly span {
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  background: #f8fafc;
  color: #475467;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.fulfillment-stock-readonly strong,
.fulfillment-lot-summary strong,
.fulfillment-lot-qty-readonly strong {
  color: #0f172a;
  margin-left: 4px;
}

.fulfillment-compact-grid {
  width: 160px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.fulfillment-actions {
  min-width: 128px;
}

.fulfillment-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 18px;
  background: rgba(15, 23, 42, .38);
}

.fulfillment-modal {
  width: min(1420px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}

.fulfillment-lot-panel {
  border-color: #bfdbfe;
}

.fulfillment-lot-summary {
  padding: 12px 14px;
  border-bottom: 1px solid #e5ecf5;
  background: #fff;
}

.fulfillment-lot-form {
  grid-template-columns: repeat(8, minmax(100px, 1fr));
  padding: 12px 14px;
  border-bottom: 1px solid #e5ecf5;
  background: #fbfdff;
}

.fulfillment-lot-table {
  min-width: 1080px;
}

.fulfillment-lot-table td:nth-child(4),
.fulfillment-lot-table td:nth-child(5) {
  display: grid;
  grid-template-columns: minmax(180px, 1fr);
  gap: 8px;
}

.fulfillment-lot-table tr.is-consumed-lot {
  background: #fafafa;
}

.fulfillment-lot-table tr.is-consumed-lot td {
  color: #667085;
}

.fulfillment-lot-qty-readonly {
  min-width: 210px;
}

.fulfillment-lot-movements {
  min-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.fulfillment-lot-movement {
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  color: #344054;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 850;
}

.fulfillment-lot-movement strong,
.fulfillment-lot-movement span,
.fulfillment-lot-movement small {
  display: block;
}

.fulfillment-lot-movement.is-in {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.fulfillment-lot-movement.is-in strong {
  color: #166534;
}

.fulfillment-lot-movement.is-out {
  border-color: #fed7aa;
  background: #fff7ed;
}

.fulfillment-lot-movement.is-out strong {
  color: #9a3412;
}

.fulfillment-lot-movement.is-muted {
  border-style: dashed;
  background: #f8fafc;
  color: #667085;
}

.fulfillment-divergences {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.fulfillment-divergence {
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.fulfillment-divergence.is-high {
  border-color: #fecaca;
  background: #fff7f7;
}

.fulfillment-divergence strong,
.fulfillment-divergence span,
.fulfillment-divergence small {
  display: block;
}

.fulfillment-divergence strong {
  color: #991b1b;
  font-size: 12px;
  text-transform: uppercase;
}

.fulfillment-divergence span {
  margin: 5px 0;
  color: #344054;
  font-weight: 750;
}

.fulfillment-empty,
.fulfillment-error {
  margin: 14px;
  padding: 24px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #667085;
  text-align: center;
  font-weight: 850;
}

.fulfillment-empty.is-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.fulfillment-error {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
  text-align: left;
}

.fulfillment-skeleton {
  min-height: 280px;
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  background: linear-gradient(90deg, #eef2f7, #fff, #eef2f7);
  background-size: 220% 100%;
  animation: fulfillmentPulse 1.3s ease-in-out infinite;
}

.fulfillment-toast {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 9999;
  max-width: min(420px, calc(100vw - 32px));
  padding: 13px 15px;
  border-radius: 8px;
  background: #ecfdf3;
  color: #0f5132;
  border: 1px solid #a7f3d0;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
  font-weight: 850;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.fulfillment-toast[data-type="error"] {
  background: #fff1f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.fulfillment-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fulfillmentPulse {
  0% { background-position: 0% 50%; }
  100% { background-position: 220% 50%; }
}

@media (max-width: 1180px) {
  .fulfillment-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fulfillment-form-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .fulfillment-lot-form {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

@media (max-width: 760px) {
  .fulfillment-page {
    padding: 12px 12px 92px;
  }

  .fulfillment-topbar,
  .fulfillment-panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .fulfillment-metrics,
  .fulfillment-form-grid,
  .fulfillment-lot-form,
  .fulfillment-divergences {
    grid-template-columns: 1fr;
  }
}
